wayland: Phase 9 — guard XGetGeometry/XGetWindowAttributes in application.c
Skip X11 window validation calls when dpy is NULL (Wayland mode). makeMainWindow splits on dpy to avoid XGetWindowAttributes/XSelectInput; wApplicationCreate skips XGetGeometry for synthetic Wayland window IDs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b576025f9b
commit
f5cf71a28a
|
|
@ -43,23 +43,41 @@
|
|||
static WWindow *makeMainWindow(WScreen * scr, Window window)
|
||||
{
|
||||
WWindow *wwin;
|
||||
XWindowAttributes attr;
|
||||
|
||||
if (!XGetWindowAttributes(dpy, window, &attr))
|
||||
return NULL;
|
||||
/* Phase 79: Wayland — synthetic IDs are not X11 windows; skip the
|
||||
* XGetWindowAttributes/XSelectInput calls that would crash with dpy==NULL.
|
||||
* The WWindow is still created so wapp->main_window_desc is non-NULL. */
|
||||
if (dpy) {
|
||||
XWindowAttributes attr;
|
||||
|
||||
wwin = wWindowCreate();
|
||||
wwin->screen_ptr = scr;
|
||||
wwin->client_win = window;
|
||||
wwin->main_window = window;
|
||||
wwin->wm_hints = wm_backend->prop_get_wm_hints(window);
|
||||
if (!XGetWindowAttributes(dpy, window, &attr))
|
||||
return NULL;
|
||||
|
||||
PropGetWMClass(window, &wwin->wm_class, &wwin->wm_instance);
|
||||
wwin = wWindowCreate();
|
||||
wwin->screen_ptr = scr;
|
||||
wwin->client_win = window;
|
||||
wwin->main_window = window;
|
||||
wwin->wm_hints = wm_backend->prop_get_wm_hints(window);
|
||||
|
||||
wDefaultFillAttributes(wwin->wm_instance, wwin->wm_class, &wwin->user_flags,
|
||||
&wwin->defined_user_flags, True);
|
||||
PropGetWMClass(window, &wwin->wm_class, &wwin->wm_instance);
|
||||
|
||||
wDefaultFillAttributes(wwin->wm_instance, wwin->wm_class, &wwin->user_flags,
|
||||
&wwin->defined_user_flags, True);
|
||||
|
||||
XSelectInput(dpy, window, attr.your_event_mask | PropertyChangeMask | StructureNotifyMask);
|
||||
} else {
|
||||
wwin = wWindowCreate();
|
||||
wwin->screen_ptr = scr;
|
||||
wwin->client_win = window;
|
||||
wwin->main_window = window;
|
||||
wwin->wm_hints = wm_backend->prop_get_wm_hints(window);
|
||||
|
||||
PropGetWMClass(window, &wwin->wm_class, &wwin->wm_instance);
|
||||
|
||||
wDefaultFillAttributes(wwin->wm_instance, wwin->wm_class, &wwin->user_flags,
|
||||
&wwin->defined_user_flags, True);
|
||||
}
|
||||
|
||||
XSelectInput(dpy, window, attr.your_event_mask | PropertyChangeMask | StructureNotifyMask);
|
||||
return wwin;
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +103,8 @@ WApplication *wApplicationCreate(WWindow * wwin)
|
|||
if (main_window == None || main_window == scr->root_win)
|
||||
return NULL;
|
||||
|
||||
{
|
||||
/* Phase 79: skip X11 geometry validation for Wayland synthetic IDs */
|
||||
if (dpy) {
|
||||
Window root;
|
||||
int foo;
|
||||
unsigned int bar;
|
||||
|
|
|
|||
Loading…
Reference in New Issue