Lines Matching refs:pState

120 static int initDisplay(struct DISPLAYSTATE *pState)
129 pState->pDisplay = XOpenDisplay(NULL);
130 if (!pState->pDisplay)
132 pState->fHaveRandR12 = false;
133 pState->pcszXrandr = "xrandr";
135 pState->pcszXrandr = "/usr/X11/bin/xrandr";
136 status = system(pState->pcszXrandr);
139 RTStrPrintf(szCommand, sizeof(szCommand), "%s --q12", pState->pcszXrandr);
142 pState->fHaveRandR12 = true;
143 pState->cScreensTracked = 0;
144 pState->paScreenInformation = NULL;
148 static void updateScreenInformation(struct DISPLAYSTATE *pState, unsigned cx, unsigned cy, unsigned cBPP, unsigned iDisplay,
153 if (iDisplay >= pState->cScreensTracked)
155 pState->paScreenInformation =
156 (struct screenInformation *)RTMemRealloc(pState->paScreenInformation,
157 (iDisplay + 1) * sizeof(*pState->paScreenInformation));
158 if (!pState->paScreenInformation)
160 for (i = pState->cScreensTracked; i < iDisplay + 1; ++i)
161 RT_ZERO(pState->paScreenInformation[i]);
162 pState->cScreensTracked = iDisplay + 1;
164 pState->paScreenInformation[iDisplay].cx = cx;
165 pState->paScreenInformation[iDisplay].cy = cy;
166 pState->paScreenInformation[iDisplay].cBPP = cBPP;
167 pState->paScreenInformation[iDisplay].x = x;
168 pState->paScreenInformation[iDisplay].y = y;
169 pState->paScreenInformation[iDisplay].fEnabled = fEnabled;
170 pState->paScreenInformation[iDisplay].fUpdateSize = true;
171 pState->paScreenInformation[iDisplay].fUpdatePosition = fUpdatePosition;
174 static void updateSizeHintsProperty(struct DISPLAYSTATE *pState)
176 long *paSizeHints = (long *)RTMemTmpAllocZ(pState->cScreensTracked * sizeof(long));
181 for (i = 0; i < pState->cScreensTracked; ++i)
183 if ( pState->paScreenInformation[i].fEnabled
184 && pState->paScreenInformation[i].cx != 0 && pState->paScreenInformation[i].cy != 0)
185 paSizeHints[i] = (pState->paScreenInformation[i].cx & 0x8fff) << 16 | (pState->paScreenInformation[i].cy & 0x8fff);
186 else if (pState->paScreenInformation[i].cx != 0 && pState->paScreenInformation[i].cy != 0)
189 XChangeProperty(pState->pDisplay, DefaultRootWindow(pState->pDisplay), XInternAtom(pState->pDisplay, "VBOX_SIZE_HINTS", 0),
190 XA_INTEGER, 32, PropModeReplace, (unsigned char *)paSizeHints, pState->cScreensTracked);
191 XFlush(pState->pDisplay);
195 static void notifyXServer(struct DISPLAYSTATE *pState)
204 for (i = 0; i < pState->cScreensTracked; ++i)
205 if (pState->paScreenInformation[i].fUpdateSize)
207 if ( !pState->fHaveRandR12 && pState->paScreenInformation[0].fUpdateSize
208 && pState->paScreenInformation[0].cx > 0 && pState->paScreenInformation[0].cy > 0)
211 pState->pcszXrandr, pState->paScreenInformation[0].cx, pState->paScreenInformation[0].cy);
213 pState->paScreenInformation[0].fUpdateSize = false;
215 else if (pState->fHaveRandR12 && fUpdateInformation)
216 for (i = 0; i < pState->cScreensTracked; ++i)
218 if (pState->paScreenInformation[i].fUpdateSize)
220 RTStrPrintf(szCommand, sizeof(szCommand), "%s --output VGA-%u --preferred", pState->pcszXrandr, i);
223 if (pState->paScreenInformation[i].fUpdatePosition)
226 pState->pcszXrandr, i, pState->paScreenInformation[i].x, pState->paScreenInformation[i].y);
229 pState->paScreenInformation[i].fUpdateSize = pState->paScreenInformation[i].fUpdatePosition = false;
233 RTStrPrintf(szCommand, sizeof(szCommand), "%s", pState->pcszXrandr);
238 static void updateMouseCapabilities(struct DISPLAYSTATE *pState)
248 XChangeProperty(pState->pDisplay, DefaultRootWindow(pState->pDisplay),
249 XInternAtom(pState->pDisplay, "VBOX_MOUSE_CAPABILITIES", 0), XA_INTEGER, 32, PropModeReplace,
251 XFlush(pState->pDisplay);
252 if (pState->fHaveRandR12)
253 for (i = 0; i < pState->cScreensTracked; ++i)
254 pState->paScreenInformation[i].fUpdateSize = true;
256 pState->paScreenInformation[0].fUpdateSize = true;
262 static void runDisplay(struct DISPLAYSTATE *pState)
273 updateScreenInformation(pState, 1024, 768, 0, 1, 0, 0, true, false);
288 updateScreenInformation(pState, cx, cy, cBPP, i, x, y, fEnabled, true);
294 updateMouseCapabilities(pState);
295 updateSizeHintsProperty(pState);
296 notifyXServer(pState);
323 updateScreenInformation(pState, cx, cy, cBPP, iDisplay, x, y, fEnabled, fUpdatePosition);