src/solaris/native/sun/awt/awt_GraphicsEnv.c
Print this page
*** 1799,1852 ****
X11GD_SetFullscreenMode(Window win, jboolean enabled)
{
Atom wmState = XInternAtom(awt_display, "_NET_WM_STATE", False);
Atom wmStateFs = XInternAtom(awt_display,
"_NET_WM_STATE_FULLSCREEN", False);
! Window root, parent, *children = NULL;
! unsigned int numchildren;
XEvent event;
- Status status;
! if (wmState == None || wmStateFs == None) {
return;
}
- /*
- * Note: the Window passed to this method is typically the "content
- * window" of the top-level, but we need the actual shell window for
- * the purposes of constructing the XEvent. Therefore, we walk up the
- * window hierarchy here to find the true top-level.
- */
- do {
- if (!XQueryTree(awt_display, win,
- &root, &parent,
- &children, &numchildren))
- {
- return;
- }
-
- if (children != NULL) {
- XFree(children);
- }
-
- if (parent == root) {
- break;
- }
-
- win = parent;
- } while (root != parent);
-
memset(&event, 0, sizeof(event));
event.xclient.type = ClientMessage;
event.xclient.message_type = wmState;
event.xclient.display = awt_display;
event.xclient.window = win;
event.xclient.format = 32;
event.xclient.data.l[0] = enabled ? 1 : 0; // 1==add, 0==remove
event.xclient.data.l[1] = wmStateFs;
! XSendEvent(awt_display, root, False,
SubstructureRedirectMask | SubstructureNotifyMask,
&event);
XSync(awt_display, False);
}
#endif /* !HEADLESS */
--- 1799,1826 ----
X11GD_SetFullscreenMode(Window win, jboolean enabled)
{
Atom wmState = XInternAtom(awt_display, "_NET_WM_STATE", False);
Atom wmStateFs = XInternAtom(awt_display,
"_NET_WM_STATE_FULLSCREEN", False);
! XWindowAttributes attr;
XEvent event;
! if (wmState == None || wmStateFs == None
! || !XGetWindowAttributes(awt_display, win, &attr)) {
return;
}
memset(&event, 0, sizeof(event));
event.xclient.type = ClientMessage;
event.xclient.message_type = wmState;
event.xclient.display = awt_display;
event.xclient.window = win;
event.xclient.format = 32;
event.xclient.data.l[0] = enabled ? 1 : 0; // 1==add, 0==remove
event.xclient.data.l[1] = wmStateFs;
! XSendEvent(awt_display, attr.root, False,
SubstructureRedirectMask | SubstructureNotifyMask,
&event);
XSync(awt_display, False);
}
#endif /* !HEADLESS */