diff options
author | Pip Cet <pipcet@gmail.com> | 2015-08-24 09:41:35 +0200 |
---|---|---|
committer | Martin Rudalics <rudalics@gmx.at> | 2015-08-24 09:41:35 +0200 |
commit | 93da8ac5d79e742e1b1391f449c0456b9eb1f534 (patch) | |
tree | 98df56649a77c1e3824d10d53ebb7b0b69d96190 | |
parent | d56d62b13b608cd2d13dd2098f73d2fc7e494819 (diff) | |
download | emacs-93da8ac5d79e742e1b1391f449c0456b9eb1f534.tar.gz |
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
-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) XSETFRAME (frame, f); fs_state = Fframe_parameter (frame, Qfullscreen); - if (EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) + if ((EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) && + (x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state) || + x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state_fullscreen))) { /* Don't set hints when maximized or fullscreen. Apparently KWin and 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_ Specification/Extended Window Manager Hints at http://freedesktop.org/wiki/Specifications/wm-spec. */ -static bool -wm_supports (struct frame *f, Atom want_atom) +bool +x_wm_supports (struct frame *f, Atom want_atom) { Atom actual_type; unsigned long actual_size, bytes_remaining; @@ -9976,7 +9976,7 @@ static bool do_ewmh_fullscreen (struct frame *f) { struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); - bool have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state); + bool have_net_atom = x_wm_supports (f, dpyinfo->Xatom_net_wm_state); int cur; bool dummy; @@ -9985,7 +9985,7 @@ do_ewmh_fullscreen (struct frame *f) /* Some window managers don't say they support _NET_WM_STATE, but they do say they support _NET_WM_STATE_FULLSCREEN. Try that also. */ if (!have_net_atom) - have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen); + have_net_atom = x_wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen); if (have_net_atom && cur != f->want_fullscreen) { @@ -10155,6 +10155,8 @@ x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event) static void x_check_fullscreen (struct frame *f) { + Lisp_Object lval = Qnil; + if (do_ewmh_fullscreen (f)) return; @@ -10173,22 +10175,31 @@ x_check_fullscreen (struct frame *f) switch (f->want_fullscreen) { /* No difference between these two when there is no WM */ - case FULLSCREEN_BOTH: case FULLSCREEN_MAXIMIZED: + lval = Qmaximized; + width = x_display_pixel_width (dpyinfo); + height = x_display_pixel_height (dpyinfo); + break; + case FULLSCREEN_BOTH: + lval = Qfullboth; width = x_display_pixel_width (dpyinfo); height = x_display_pixel_height (dpyinfo); break; case FULLSCREEN_WIDTH: + lval = Qfullwidth; width = x_display_pixel_width (dpyinfo); height = height + FRAME_MENUBAR_HEIGHT (f); break; case FULLSCREEN_HEIGHT: + lval = Qfullheight; height = x_display_pixel_height (dpyinfo); } frame_size_history_add (f, Qx_check_fullscreen, width, height, Qnil); + x_wm_set_size_hint (f, 0, false); + XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), width, height); @@ -10201,6 +10212,10 @@ x_check_fullscreen (struct frame *f) x_sync (f); } } + + /* `x_net_wm_state' might have reset the fullscreen frame parameter, + restore it. */ + store_frame_param (f, Qfullscreen, lval); } /* This function is called by x_set_offset to determine whether the window @@ -10564,7 +10579,7 @@ x_ewmh_activate_frame (struct frame *f) struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); - if (FRAME_VISIBLE_P (f) && wm_supports (f, dpyinfo->Xatom_net_active_window)) + if (FRAME_VISIBLE_P (f) && x_wm_supports (f, dpyinfo->Xatom_net_active_window)) { Lisp_Object frame; 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) } extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object); +extern bool x_wm_supports (struct frame *, Atom); extern void x_wait_for_event (struct frame *, int); extern void x_clear_under_internal_border (struct frame *f); |