treewide: use inline helper for accessing first screen

Instead of everybody directly accessing the (internal) screenInfo struct,
let those consumers only interested in first screen use a little helper.

Also caching the value if it's needed several times.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-09-03 13:35:03 +02:00
committed by Enrico Weigelt
parent d0a155c824
commit 6bc438ab5a
28 changed files with 227 additions and 147 deletions

View File

@@ -35,6 +35,7 @@
#include <xwin-config.h>
#endif
#include "dix/screenint_priv.h"
#include "mi/mi_priv.h"
#include "win.h"
@@ -256,8 +257,8 @@ winRestoreModeKeyStates(void)
/* Only process events if the rootwindow is mapped. The keyboard events
* will cause segfaults otherwise */
if (screenInfo.screens[0]->root &&
screenInfo.screens[0]->root->mapped == FALSE)
ScreenPtr firstScreen = dixGetFirstScreenPtr();
if (firstScreen->root && firstScreen->root->mapped == FALSE)
processEvents = FALSE;
/* Force to process all pending events in the mi event queue */

View File

@@ -26,6 +26,8 @@
#include <xwin-config.h>
#endif
#include "dix/screenint_priv.h"
#include "win.h"
/*
@@ -56,7 +58,7 @@ winMsgWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
has set the DE_TERMINATE flag so exits the msg dispatch loop.
*/
{
ScreenPtr pScreen = screenInfo.screens[0];
ScreenPtr pScreen = dixGetFirstScreenPtr();
winScreenPriv(pScreen);
PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);