// fullscreen is to remove decorations, resize it to cover entire screen
// and set WIN_LAYER_ABOVE_DOCK.
//
// fullscreen is to remove decorations, resize it to cover entire screen
// and set WIN_LAYER_ABOVE_DOCK.
//
// KDE 3 ignores the hint. The only way to make kwin accept our request
// is to emulate the way Qt does it. That is, unmap the window, set
// _NET_WM_WINDOW_TYPE to _KDE_NET_WM_WINDOW_TYPE_OVERRIDE (KDE extension),
// KDE 3 ignores the hint. The only way to make kwin accept our request
// is to emulate the way Qt does it. That is, unmap the window, set
// _NET_WM_WINDOW_TYPE to _KDE_NET_WM_WINDOW_TYPE_OVERRIDE (KDE extension),
// window state which provides cleanest and simplest possible way of
// making a window fullscreen. WM-spec is a de-facto standard adopted
// by GNOME and KDE folks, but _NET_WM_STATE_FULLSCREEN isn't yet widely
// window state which provides cleanest and simplest possible way of
// making a window fullscreen. WM-spec is a de-facto standard adopted
// by GNOME and KDE folks, but _NET_WM_STATE_FULLSCREEN isn't yet widely
// implements, KDE will support it from version 3.2. At toolkits level,
// GTK+ >= 2.1.2 uses it as the only method of making windows fullscreen
// (that's why wxGTK will *not* switch to using gtk_window_fullscreen
// implements, KDE will support it from version 3.2. At toolkits level,
// GTK+ >= 2.1.2 uses it as the only method of making windows fullscreen
// (that's why wxGTK will *not* switch to using gtk_window_fullscreen
// This is what wxWidgets does in wxSetFullScreenStateX11:
// 1) if _NET_WM_STATE_FULLSCREEN is supported, use it
// 2) otherwise try WM-specific hacks (KDE, IceWM)
// This is what wxWidgets does in wxSetFullScreenStateX11:
// 1) if _NET_WM_STATE_FULLSCREEN is supported, use it
// 2) otherwise try WM-specific hacks (KDE, IceWM)
Window window, int layer)
{
wxX11ErrorsSuspender noerrors(display);
Window window, int layer)
{
wxX11ErrorsSuspender noerrors(display);
{
wxMAKE_ATOM(_NET_SUPPORTING_WM_CHECK, display);
wxMAKE_ATOM(_NET_SUPPORTED, display);
{
wxMAKE_ATOM(_NET_SUPPORTING_WM_CHECK, display);
wxMAKE_ATOM(_NET_SUPPORTED, display);
// FIXME: We may want to cache these checks. Note that we can't simply
// remember the results in global variable because the WM may go
// away and be replaced by another one! One possible approach
// FIXME: We may want to cache these checks. Note that we can't simply
// remember the results in global variable because the WM may go
// away and be replaced by another one! One possible approach
// is replaced by another one). This is what GTK+ 2 does.
// Let's do it only if it is needed, it requires changes to
// the event loop.
// is replaced by another one). This is what GTK+ 2 does.
// Let's do it only if it is needed, it requires changes to
// the event loop.
// Is the WM ICCCM supporting?
XGetWindowProperty(display, rootWnd,
_NET_SUPPORTING_WM_CHECK, 0, LONG_MAX,
// Is the WM ICCCM supporting?
XGetWindowProperty(display, rootWnd,
_NET_SUPPORTING_WM_CHECK, 0, LONG_MAX,
Window window, int operation, Atom state)
{
wxMAKE_ATOM(_NET_WM_STATE, display);
Window window, int operation, Atom state)
{
wxMAKE_ATOM(_NET_WM_STATE, display);
xev.xclient.data.l[0] = operation;
xev.xclient.data.l[1] = state;
xev.xclient.data.l[2] = None;
xev.xclient.data.l[0] = operation;
xev.xclient.data.l[1] = state;
xev.xclient.data.l[2] = None;
XSendEvent(display, rootWnd,
False,
SubstructureRedirectMask | SubstructureNotifyMask,
XSendEvent(display, rootWnd,
False,
SubstructureRedirectMask | SubstructureNotifyMask,
static bool wxKwinRunning(Display *display, Window rootWnd)
{
wxMAKE_ATOM(KWIN_RUNNING, display);
static bool wxKwinRunning(Display *display, Window rootWnd)
{
wxMAKE_ATOM(KWIN_RUNNING, display);
// mode will work with it. We have to carefully emulate the Qt way.
static void wxSetKDEFullscreen(Display *display, Window rootWnd,
Window w, bool fullscreen, wxRect *origRect)
// mode will work with it. We have to carefully emulate the Qt way.
static void wxSetKDEFullscreen(Display *display, Window rootWnd,
Window w, bool fullscreen, wxRect *origRect)
}
XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
}
XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
-
- wxWMspecSetState(display, rootWnd, w,
+
+ wxWMspecSetState(display, rootWnd, w,
fullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE,
_NET_WM_STATE_STAYS_ON_TOP);
XSync(display, False);
if (!fullscreen)
{
fullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE,
_NET_WM_STATE_STAYS_ON_TOP);
XSync(display, False);
if (!fullscreen)
{
// position change after the window was mapped. This additional
// move+resize event will ensure that the window is restored in
// position change after the window was mapped. This additional
// move+resize event will ensure that the window is restored in
- // exactly same position as before it was made fullscreen (because
- // wxTopLevelWindow::ShowFullScreen will call SetSize, thus
- // setting the position for second time).
+ // exactly the same position as before it was made fullscreen
+ // (because wxTopLevelWindow::ShowFullScreen will call SetSize, thus
+ // setting the position for the second time).
XMoveResizeWindow(display, w,
origRect->x, origRect->y,
origRect->width, origRect->height);
XMoveResizeWindow(display, w,
origRect->x, origRect->y,
origRect->width, origRect->height);
Display *disp = (Display*)display;
// if WM supports _NET_WM_STATE_FULLSCREEN from wm-spec 1.2, use it:
Display *disp = (Display*)display;
// if WM supports _NET_WM_STATE_FULLSCREEN from wm-spec 1.2, use it:
// if the user is running KDE's kwin WM, use a legacy hack because
// kwin doesn't understand any other method:
if (wxKwinRunning(disp, root))
// if the user is running KDE's kwin WM, use a legacy hack because
// kwin doesn't understand any other method:
if (wxKwinRunning(disp, root))
// finally, fall back to ICCCM heuristic method:
wxLogTrace(_T("fullscreen"), _T("unknown WM, using _WIN_LAYER"));
return wxX11_FS_GENERIC;
// finally, fall back to ICCCM heuristic method:
wxLogTrace(_T("fullscreen"), _T("unknown WM, using _WIN_LAYER"));
return wxX11_FS_GENERIC;
// NB: please see the comment under "Fullscreen mode:" title above
// for implications of changing this code.
// NB: please see the comment under "Fullscreen mode:" title above
// for implications of changing this code.
case WXK_RETURN: keySym = XK_Return; break;
case WXK_SHIFT: keySym = XK_Shift_L; break;
case WXK_CONTROL: keySym = XK_Control_L; break;
case WXK_RETURN: keySym = XK_Return; break;
case WXK_SHIFT: keySym = XK_Shift_L; break;
case WXK_CONTROL: keySym = XK_Control_L; break;
case WXK_MENU : keySym = XK_Menu; break;
case WXK_PAUSE: keySym = XK_Pause; break;
case WXK_ESCAPE: keySym = XK_Escape; break;
case WXK_MENU : keySym = XK_Menu; break;
case WXK_PAUSE: keySym = XK_Pause; break;
case WXK_ESCAPE: keySym = XK_Escape; break;
XQueryPointer(pDisplay, DefaultRootWindow(pDisplay), &wDummy1, &wDummy2,
&iDummy3, &iDummy4, &iDummy5, &iDummy6, &iMask );
XFreeModifiermap(map);
return (iMask & iKeyMask) != 0;
}
XQueryPointer(pDisplay, DefaultRootWindow(pDisplay), &wDummy1, &wDummy2,
&iDummy3, &iDummy4, &iDummy5, &iDummy6, &iMask );
XFreeModifiermap(map);
return (iMask & iKeyMask) != 0;
}