From b2c9e95e1abb1d8b22ee62ba1ea547d3adf28146 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 17:15:36 -0600 Subject: Update from qt3 --- src/kernel/qwidget_x11.cpp | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) (limited to 'src/kernel/qwidget_x11.cpp') diff --git a/src/kernel/qwidget_x11.cpp b/src/kernel/qwidget_x11.cpp index 5ba9e45ec..2d77cf658 100644 --- a/src/kernel/qwidget_x11.cpp +++ b/src/kernel/qwidget_x11.cpp @@ -124,6 +124,19 @@ extern Atom qt_net_wm_state_max_h; extern Atom qt_net_wm_state_fullscreen; extern Atom qt_net_wm_state_above; extern Atom qt_net_wm_state_stays_on_top; +extern Atom qt_net_wm_action; +extern Atom qt_net_wm_action_move; +extern Atom qt_net_wm_action_resize; +extern Atom qt_net_wm_action_minimize; +extern Atom qt_net_wm_action_shade; +extern Atom qt_net_wm_action_stick; +extern Atom qt_net_wm_action_max_h; +extern Atom qt_net_wm_action_max_v; +extern Atom qt_net_wm_action_fullscreen; +extern Atom qt_net_wm_action_change_desktop; +extern Atom qt_net_wm_action_close; +extern Atom qt_net_wm_action_above; +extern Atom qt_net_wm_action_below; extern Atom qt_net_wm_window_type; extern Atom qt_net_wm_window_type_normal; extern Atom qt_net_wm_window_type_dialog; @@ -462,7 +475,16 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow) // NET window states long net_winstates[6] = { 0, 0, 0, 0, 0, 0 }; + long net_winactions[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int curr_winstate = 0; + int curr_winaction = 0; + + // Add all default actions that cannot be turned off + net_winactions[curr_winaction++] = qt_net_wm_action_stick; + net_winactions[curr_winaction++] = qt_net_wm_action_fullscreen; + net_winactions[curr_winaction++] = qt_net_wm_action_change_desktop; + net_winactions[curr_winaction++] = qt_net_wm_action_above; + net_winactions[curr_winaction++] = qt_net_wm_action_below; struct { ulong flags, functions, decorations; @@ -475,6 +497,56 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow) mwmhints.input_mode = 0L; mwmhints.status = 0L; + if ( testNFlags(WX11DisableResize) ) { + mwmhints.functions |= (1L << 1); // MWM_FUNC_RESIZE + mwmhints.functions |= (1L << 0); // MWM_FUNC_ALL + mwmhints.flags |= (1L << 0); // MWM_HINTS_FUNCTIONS + } + else { + net_winactions[curr_winaction++] = qt_net_wm_action_resize; + } + + if ( testNFlags(WX11DisableMove) ) { + mwmhints.functions |= (1L << 2); // MWM_FUNC_MOVE + mwmhints.functions |= (1L << 0); // MWM_FUNC_ALL + mwmhints.flags |= (1L << 0); // MWM_HINTS_FUNCTIONS + } + else { + net_winactions[curr_winaction++] = qt_net_wm_action_move; + } + + if ( testNFlags(WX11DisableMinimize) ) { + mwmhints.functions |= (1L << 3); // MWM_FUNC_MINIMIZE + mwmhints.functions |= (1L << 0); // MWM_FUNC_ALL + mwmhints.flags |= (1L << 0); // MWM_HINTS_FUNCTIONS + } + else { + net_winactions[curr_winaction++] = qt_net_wm_action_minimize; + } + + if ( testNFlags(WX11DisableMaximize) ) { + mwmhints.functions |= (1L << 4); // MWM_FUNC_MAXIMIZE + mwmhints.functions |= (1L << 0); // MWM_FUNC_ALL + mwmhints.flags |= (1L << 0); // MWM_HINTS_FUNCTIONS + } + else { + net_winactions[curr_winaction++] = qt_net_wm_action_max_h; + net_winactions[curr_winaction++] = qt_net_wm_action_max_v; + } + + if ( testNFlags(WX11DisableClose) ) { + mwmhints.functions |= (1L << 5); // MWM_FUNC_CLOSE + mwmhints.functions |= (1L << 0); // MWM_FUNC_ALL + mwmhints.flags |= (1L << 0); // MWM_HINTS_FUNCTIONS + } + else { + net_winactions[curr_winaction++] = qt_net_wm_action_close; + } + + if ( ! testNFlags(WX11DisableShade) ) { + net_winactions[curr_winaction++] = qt_net_wm_action_shade; + } + if (topLevel && ! (desktop || popup)) { ulong wsa_mask = 0; @@ -630,6 +702,13 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow) else XDeleteProperty(dpy, id, qt_net_wm_state); + // set _NET_WM_ALLOWED_ACTIONS + if (curr_winaction > 0) + XChangeProperty(dpy, id, qt_net_wm_action, XA_ATOM, 32, PropModeReplace, + (unsigned char *) net_winactions, curr_winaction); + else + XDeleteProperty(dpy, id, qt_net_wm_action); + // set _NET_WM_PID long curr_pid = getpid(); XChangeProperty(dpy, id, qt_net_wm_pid, XA_CARDINAL, 32, PropModeReplace, -- cgit v1.2.1