diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 16:34:00 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 16:34:00 -0600 |
commit | 0eb9f5e217225129b22de1a48fe7300723456da3 (patch) | |
tree | ede5a4dd39476960a1f113a323b34b613cf07987 /src/kernel/qwidget_x11.cpp | |
parent | 336d563830cd5f9f1f9abdce20db839d06431168 (diff) | |
download | qt3-0eb9f5e217225129b22de1a48fe7300723456da3.tar.gz qt3-0eb9f5e217225129b22de1a48fe7300723456da3.zip |
Add NetWM/Motif controls to QWidget
This must break binary compatibility, so version was also bumped to 3.4.0
Diffstat (limited to 'src/kernel/qwidget_x11.cpp')
-rw-r--r-- | src/kernel/qwidget_x11.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/kernel/qwidget_x11.cpp b/src/kernel/qwidget_x11.cpp index 02fdebf..775829c 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 QWidget::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 QWidget::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 QWidget::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, |