diff options
| author | Pip Cet | 2015-08-24 09:41:35 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2015-08-24 09:41:35 +0200 |
| commit | 93da8ac5d79e742e1b1391f449c0456b9eb1f534 (patch) | |
| tree | 98df56649a77c1e3824d10d53ebb7b0b69d96190 /src | |
| parent | d56d62b13b608cd2d13dd2098f73d2fc7e494819 (diff) | |
| download | emacs-93da8ac5d79e742e1b1391f449c0456b9eb1f534.tar.gz emacs-93da8ac5d79e742e1b1391f449c0456b9eb1f534.zip | |
Fix full-screen code when there is no window manager (Bug#21317)
* src/xterm.h (x_wm_supports): Declare external.
* src/xterm.c (wm_suppports): Rename to `x_wm_supports', export.
(do_ewmh_fullscreen, x_ewmh_activate_frame): Adjust for rename.
(x_check_fullscreen): Call `x_wm_set_size_hint', restore
`fullscreen' frame parameter.
* gtkutil.c (x_wm_set_size_hint): Set size hints when running
without a window manager.
Copyright-paperwork-exempt: yes
Diffstat (limited to 'src')
| -rw-r--r-- | src/gtkutil.c | 4 | ||||
| -rw-r--r-- | src/xterm.c | 27 | ||||
| -rw-r--r-- | src/xterm.h | 1 |
3 files changed, 25 insertions, 7 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index d684cd90888..5fc2bebdc6d 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -1375,7 +1375,9 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) | |||
| 1375 | 1375 | ||
| 1376 | XSETFRAME (frame, f); | 1376 | XSETFRAME (frame, f); |
| 1377 | fs_state = Fframe_parameter (frame, Qfullscreen); | 1377 | fs_state = Fframe_parameter (frame, Qfullscreen); |
| 1378 | if (EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) | 1378 | if ((EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) && |
| 1379 | (x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state) || | ||
| 1380 | x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state_fullscreen))) | ||
| 1379 | { | 1381 | { |
| 1380 | /* Don't set hints when maximized or fullscreen. Apparently KWin and | 1382 | /* Don't set hints when maximized or fullscreen. Apparently KWin and |
| 1381 | Gtk3 don't get along and the frame shrinks (!). | 1383 | Gtk3 don't get along and the frame shrinks (!). |
diff --git a/src/xterm.c b/src/xterm.c index b7aacfa8dca..7bb20328ba7 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -9782,8 +9782,8 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_ | |||
| 9782 | Specification/Extended Window Manager Hints at | 9782 | Specification/Extended Window Manager Hints at |
| 9783 | http://freedesktop.org/wiki/Specifications/wm-spec. */ | 9783 | http://freedesktop.org/wiki/Specifications/wm-spec. */ |
| 9784 | 9784 | ||
| 9785 | static bool | 9785 | bool |
| 9786 | wm_supports (struct frame *f, Atom want_atom) | 9786 | x_wm_supports (struct frame *f, Atom want_atom) |
| 9787 | { | 9787 | { |
| 9788 | Atom actual_type; | 9788 | Atom actual_type; |
| 9789 | unsigned long actual_size, bytes_remaining; | 9789 | unsigned long actual_size, bytes_remaining; |
| @@ -9976,7 +9976,7 @@ static bool | |||
| 9976 | do_ewmh_fullscreen (struct frame *f) | 9976 | do_ewmh_fullscreen (struct frame *f) |
| 9977 | { | 9977 | { |
| 9978 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); | 9978 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 9979 | bool have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state); | 9979 | bool have_net_atom = x_wm_supports (f, dpyinfo->Xatom_net_wm_state); |
| 9980 | int cur; | 9980 | int cur; |
| 9981 | bool dummy; | 9981 | bool dummy; |
| 9982 | 9982 | ||
| @@ -9985,7 +9985,7 @@ do_ewmh_fullscreen (struct frame *f) | |||
| 9985 | /* Some window managers don't say they support _NET_WM_STATE, but they do say | 9985 | /* Some window managers don't say they support _NET_WM_STATE, but they do say |
| 9986 | they support _NET_WM_STATE_FULLSCREEN. Try that also. */ | 9986 | they support _NET_WM_STATE_FULLSCREEN. Try that also. */ |
| 9987 | if (!have_net_atom) | 9987 | if (!have_net_atom) |
| 9988 | have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen); | 9988 | have_net_atom = x_wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen); |
| 9989 | 9989 | ||
| 9990 | if (have_net_atom && cur != f->want_fullscreen) | 9990 | if (have_net_atom && cur != f->want_fullscreen) |
| 9991 | { | 9991 | { |
| @@ -10155,6 +10155,8 @@ x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event) | |||
| 10155 | static void | 10155 | static void |
| 10156 | x_check_fullscreen (struct frame *f) | 10156 | x_check_fullscreen (struct frame *f) |
| 10157 | { | 10157 | { |
| 10158 | Lisp_Object lval = Qnil; | ||
| 10159 | |||
| 10158 | if (do_ewmh_fullscreen (f)) | 10160 | if (do_ewmh_fullscreen (f)) |
| 10159 | return; | 10161 | return; |
| 10160 | 10162 | ||
| @@ -10173,22 +10175,31 @@ x_check_fullscreen (struct frame *f) | |||
| 10173 | switch (f->want_fullscreen) | 10175 | switch (f->want_fullscreen) |
| 10174 | { | 10176 | { |
| 10175 | /* No difference between these two when there is no WM */ | 10177 | /* No difference between these two when there is no WM */ |
| 10176 | case FULLSCREEN_BOTH: | ||
| 10177 | case FULLSCREEN_MAXIMIZED: | 10178 | case FULLSCREEN_MAXIMIZED: |
| 10179 | lval = Qmaximized; | ||
| 10180 | width = x_display_pixel_width (dpyinfo); | ||
| 10181 | height = x_display_pixel_height (dpyinfo); | ||
| 10182 | break; | ||
| 10183 | case FULLSCREEN_BOTH: | ||
| 10184 | lval = Qfullboth; | ||
| 10178 | width = x_display_pixel_width (dpyinfo); | 10185 | width = x_display_pixel_width (dpyinfo); |
| 10179 | height = x_display_pixel_height (dpyinfo); | 10186 | height = x_display_pixel_height (dpyinfo); |
| 10180 | break; | 10187 | break; |
| 10181 | case FULLSCREEN_WIDTH: | 10188 | case FULLSCREEN_WIDTH: |
| 10189 | lval = Qfullwidth; | ||
| 10182 | width = x_display_pixel_width (dpyinfo); | 10190 | width = x_display_pixel_width (dpyinfo); |
| 10183 | height = height + FRAME_MENUBAR_HEIGHT (f); | 10191 | height = height + FRAME_MENUBAR_HEIGHT (f); |
| 10184 | break; | 10192 | break; |
| 10185 | case FULLSCREEN_HEIGHT: | 10193 | case FULLSCREEN_HEIGHT: |
| 10194 | lval = Qfullheight; | ||
| 10186 | height = x_display_pixel_height (dpyinfo); | 10195 | height = x_display_pixel_height (dpyinfo); |
| 10187 | } | 10196 | } |
| 10188 | 10197 | ||
| 10189 | frame_size_history_add | 10198 | frame_size_history_add |
| 10190 | (f, Qx_check_fullscreen, width, height, Qnil); | 10199 | (f, Qx_check_fullscreen, width, height, Qnil); |
| 10191 | 10200 | ||
| 10201 | x_wm_set_size_hint (f, 0, false); | ||
| 10202 | |||
| 10192 | XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), | 10203 | XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
| 10193 | width, height); | 10204 | width, height); |
| 10194 | 10205 | ||
| @@ -10201,6 +10212,10 @@ x_check_fullscreen (struct frame *f) | |||
| 10201 | x_sync (f); | 10212 | x_sync (f); |
| 10202 | } | 10213 | } |
| 10203 | } | 10214 | } |
| 10215 | |||
| 10216 | /* `x_net_wm_state' might have reset the fullscreen frame parameter, | ||
| 10217 | restore it. */ | ||
| 10218 | store_frame_param (f, Qfullscreen, lval); | ||
| 10204 | } | 10219 | } |
| 10205 | 10220 | ||
| 10206 | /* This function is called by x_set_offset to determine whether the window | 10221 | /* This function is called by x_set_offset to determine whether the window |
| @@ -10564,7 +10579,7 @@ x_ewmh_activate_frame (struct frame *f) | |||
| 10564 | 10579 | ||
| 10565 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); | 10580 | struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 10566 | 10581 | ||
| 10567 | if (FRAME_VISIBLE_P (f) && wm_supports (f, dpyinfo->Xatom_net_active_window)) | 10582 | if (FRAME_VISIBLE_P (f) && x_wm_supports (f, dpyinfo->Xatom_net_active_window)) |
| 10568 | { | 10583 | { |
| 10569 | Lisp_Object frame; | 10584 | Lisp_Object frame; |
| 10570 | XSETFRAME (frame, f); | 10585 | XSETFRAME (frame, f); |
diff --git a/src/xterm.h b/src/xterm.h index 5622344d97c..61659066809 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -1072,6 +1072,7 @@ x_display_set_last_user_time (struct x_display_info *dpyinfo, Time t) | |||
| 1072 | } | 1072 | } |
| 1073 | 1073 | ||
| 1074 | extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object); | 1074 | extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object); |
| 1075 | extern bool x_wm_supports (struct frame *, Atom); | ||
| 1075 | extern void x_wait_for_event (struct frame *, int); | 1076 | extern void x_wait_for_event (struct frame *, int); |
| 1076 | extern void x_clear_under_internal_border (struct frame *f); | 1077 | extern void x_clear_under_internal_border (struct frame *f); |
| 1077 | 1078 | ||