mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-07-09 02:26:23 +00:00
XCurses: Make sure the window can be focused
Sets the WM_TAKE_FOCUS procotol and the WM_HINTS input field
This commit is contained in:
@@ -605,8 +605,11 @@ int PDC_scr_open(void)
|
||||
wm_atom[0] = XInternAtom(XtDisplay(pdc_toplevel), "WM_DELETE_WINDOW",
|
||||
False);
|
||||
|
||||
/* Make sure we tell X that we'd like to take focus */
|
||||
wm_atom[1] = XInternAtom(XtDisplay(pdc_toplevel), "WM_TAKE_FOCUS",
|
||||
False);
|
||||
XSetWMProtocols(XtDisplay(pdc_toplevel), XtWindow(pdc_toplevel),
|
||||
wm_atom, 1);
|
||||
wm_atom, 2);
|
||||
|
||||
/* Create the Graphics Context for drawing. This MUST be done AFTER
|
||||
the associated widget has been realized. */
|
||||
@@ -651,6 +654,13 @@ int PDC_scr_open(void)
|
||||
XSync(XtDisplay(pdc_toplevel), True);
|
||||
SP->resized = pdc_resize_now = FALSE;
|
||||
|
||||
/* Make sure that we say that we're allowed to have input focus.
|
||||
Otherwise some window managers will refuse to focus the window. */
|
||||
XWMHints* hints = XGetWMHints(XtDisplay(pdc_toplevel), XtWindow(pdc_toplevel));
|
||||
hints->input=true;
|
||||
XSetWMHints(XtDisplay(pdc_toplevel), XtWindow(pdc_toplevel), hints);
|
||||
XFree(hints);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user