diff options
| author | Po Lu | 2022-10-27 19:14:56 +0800 |
|---|---|---|
| committer | Po Lu | 2022-10-27 19:15:50 +0800 |
| commit | af46d8a7ecb5c8c0016cc8dc88fa59ef244a0ced (patch) | |
| tree | 8dd7ecc633c3f8a6fcc215e34a716577c058936a /src/xterm.c | |
| parent | 8deb7978974f87b9fc43babf93a96b045c8e788d (diff) | |
| download | emacs-af46d8a7ecb5c8c0016cc8dc88fa59ef244a0ced.tar.gz emacs-af46d8a7ecb5c8c0016cc8dc88fa59ef244a0ced.zip | |
Fix reporting of iconic state on old window managers
* src/xterm.c (x_handle_wm_state): Handle IconicState if the
window manager does not support _NET_WM_STATE_HIDDEN.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c index 9f6112745e2..c8ac30c72c7 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -17868,6 +17868,7 @@ x_coords_from_dnd_message (struct x_display_info *dpyinfo, | |||
| 17868 | static void | 17868 | static void |
| 17869 | x_handle_wm_state (struct frame *f, struct input_event *ie) | 17869 | x_handle_wm_state (struct frame *f, struct input_event *ie) |
| 17870 | { | 17870 | { |
| 17871 | struct x_display_info *dpyinfo; | ||
| 17871 | Atom type; | 17872 | Atom type; |
| 17872 | int format; | 17873 | int format; |
| 17873 | unsigned long nitems, bytes_after; | 17874 | unsigned long nitems, bytes_after; |
| @@ -17875,10 +17876,11 @@ x_handle_wm_state (struct frame *f, struct input_event *ie) | |||
| 17875 | unsigned long *state; | 17876 | unsigned long *state; |
| 17876 | 17877 | ||
| 17877 | data = NULL; | 17878 | data = NULL; |
| 17879 | dpyinfo = FRAME_DISPLAY_INFO (f); | ||
| 17878 | 17880 | ||
| 17879 | if (XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), | 17881 | if (XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
| 17880 | FRAME_DISPLAY_INFO (f)->Xatom_wm_state, 0, 2, | 17882 | dpyinfo->Xatom_wm_state, 0, 2, False, |
| 17881 | False, AnyPropertyType, &type, &format, &nitems, | 17883 | AnyPropertyType, &type, &format, &nitems, |
| 17882 | &bytes_after, &data) != Success) | 17884 | &bytes_after, &data) != Success) |
| 17883 | return; | 17885 | return; |
| 17884 | 17886 | ||
| @@ -17903,6 +17905,20 @@ x_handle_wm_state (struct frame *f, struct input_event *ie) | |||
| 17903 | ie->kind = DEICONIFY_EVENT; | 17905 | ie->kind = DEICONIFY_EVENT; |
| 17904 | XSETFRAME (ie->frame_or_window, f); | 17906 | XSETFRAME (ie->frame_or_window, f); |
| 17905 | } | 17907 | } |
| 17908 | else if (state[0] == IconicState | ||
| 17909 | /* _NET_WM_STATE_HIDDEN should be used if the window | ||
| 17910 | manager supports that. */ | ||
| 17911 | && !x_wm_supports (f, dpyinfo->Xatom_net_wm_state_hidden)) | ||
| 17912 | { | ||
| 17913 | /* The frame is actually iconified right now. Mark it as | ||
| 17914 | such. */ | ||
| 17915 | |||
| 17916 | SET_FRAME_VISIBLE (f, 0); | ||
| 17917 | SET_FRAME_ICONIFIED (f, true); | ||
| 17918 | |||
| 17919 | ie->kind = ICONIFY_EVENT; | ||
| 17920 | XSETFRAME (ie->frame_or_window, f); | ||
| 17921 | } | ||
| 17906 | 17922 | ||
| 17907 | /* state[0] can also be WithdrawnState, meaning that the window has | 17923 | /* state[0] can also be WithdrawnState, meaning that the window has |
| 17908 | been withdrawn and is no longer iconified. However, Emacs sets | 17924 | been withdrawn and is no longer iconified. However, Emacs sets |