diff --git a/src/application.c b/src/application.c index 31ff045..34ed9f1 100644 --- a/src/application.c +++ b/src/application.c @@ -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;