174 lines
6.8 KiB
Diff
174 lines
6.8 KiB
Diff
diff -U0 emacs-23.3/src/ChangeLog.wm-state-hidden emacs-23.3/src/ChangeLog
|
|
--- emacs-23.3/src/ChangeLog.wm-state-hidden 2011-03-07 06:08:03.000000000 +0100
|
|
+++ emacs-23.3/src/ChangeLog 2011-11-23 11:49:57.053019839 +0100
|
|
@@ -1,0 +2,13 @@
|
|
+2011-10-30 Jan Djärv <jan.h.d@swipnet.se>
|
|
+
|
|
+ * xterm.h (x_display_info): Add Xatom_net_wm_state_hidden (Bug#9893).
|
|
+
|
|
+ * xterm.c: Declare x_handle_net_wm_state to return int.
|
|
+ (handle_one_xevent): Check if we are iconified but don't have
|
|
+ _NET_WM_STATE_HIDDEN. If do, treat as deiconify (Bug#9893).
|
|
+ (get_current_wm_state): Return non-zero if not hidden,
|
|
+ check for _NET_WM_STATE_HIDDEN (Bug#9893).
|
|
+ (do_ewmh_fullscreen): Ignore return value from get_current_wm_state.
|
|
+ (x_handle_net_wm_state): Return what get_current_wm_state returns.
|
|
+ (x_term_init): Initialize dpyinfo->Xatom_net_wm_state_hidden.
|
|
+
|
|
diff -up emacs-23.3/src/xterm.c.wm-state-hidden emacs-23.3/src/xterm.c
|
|
--- emacs-23.3/src/xterm.c.wm-state-hidden 2011-02-12 01:27:01.000000000 +0100
|
|
+++ emacs-23.3/src/xterm.c 2011-11-23 11:55:10.867096378 +0100
|
|
@@ -375,7 +375,7 @@ static void x_scroll_bar_report_motion P
|
|
enum scroll_bar_part *,
|
|
Lisp_Object *, Lisp_Object *,
|
|
unsigned long *));
|
|
-static void x_handle_net_wm_state P_ ((struct frame *, XPropertyEvent *));
|
|
+static int x_handle_net_wm_state P_ ((struct frame *, XPropertyEvent *));
|
|
static void x_check_fullscreen P_ ((struct frame *));
|
|
static void x_check_expected_move P_ ((struct frame *, int, int));
|
|
static void x_sync_with_move P_ ((struct frame *, int, int, int));
|
|
@@ -6121,7 +6121,19 @@ handle_one_xevent (dpyinfo, eventp, fini
|
|
last_user_time = event.xproperty.time;
|
|
f = x_top_window_to_frame (dpyinfo, event.xproperty.window);
|
|
if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state)
|
|
- x_handle_net_wm_state (f, &event.xproperty);
|
|
+ if (x_handle_net_wm_state (f, &event.xproperty) && f->iconified)
|
|
+ {
|
|
+ /* Gnome shell does not iconify us when C-z is pressed. It hides
|
|
+ the frame. So if our state says we aren't hidden anymore,
|
|
+ treat is as deiconfied. */
|
|
+ if (! f->async_iconified)
|
|
+ SET_FRAME_GARBAGED (f);
|
|
+ f->async_visible = 1;
|
|
+ f->async_iconified = 0;
|
|
+ f->output_data.x->has_been_visible = 1;
|
|
+ inev.ie.kind = DEICONIFY_EVENT;
|
|
+ XSETFRAME (inev.ie.frame_or_window, f);
|
|
+ }
|
|
|
|
x_handle_property_notify (&event.xproperty);
|
|
xft_settings_event (dpyinfo, &event);
|
|
@@ -8573,9 +8585,10 @@ x_set_sticky (f, new_value, old_value)
|
|
|
|
/* Return the current _NET_WM_STATE.
|
|
SIZE_STATE is set to one of the FULLSCREEN_* values.
|
|
- STICKY is set to 1 if the sticky state is set, 0 if not. */
|
|
+ STICKY is set to 1 if the sticky state is set, 0 if not.
|
|
+ Return non-zero if we are not hidden, zero if we are. */
|
|
|
|
-static void
|
|
+static int
|
|
get_current_vm_state (struct frame *f,
|
|
Window window,
|
|
int *size_state,
|
|
@@ -8583,7 +8596,7 @@ get_current_vm_state (struct frame *f,
|
|
{
|
|
Atom actual_type;
|
|
unsigned long actual_size, bytes_remaining;
|
|
- int i, rc, actual_format;
|
|
+ int i, rc, actual_format, is_hidden = 0;
|
|
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
|
|
long max_len = 65536;
|
|
Display *dpy = FRAME_X_DISPLAY (f);
|
|
@@ -8605,7 +8618,7 @@ get_current_vm_state (struct frame *f,
|
|
if (tmp_data) XFree (tmp_data);
|
|
x_uncatch_errors ();
|
|
UNBLOCK_INPUT;
|
|
- return;
|
|
+ return ! f->iconified;
|
|
}
|
|
|
|
x_uncatch_errors ();
|
|
@@ -8613,7 +8626,9 @@ get_current_vm_state (struct frame *f,
|
|
for (i = 0; i < actual_size; ++i)
|
|
{
|
|
Atom a = ((Atom*)tmp_data)[i];
|
|
- if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
|
|
+ if (a == dpyinfo->Xatom_net_wm_state_hidden)
|
|
+ is_hidden = 1;
|
|
+ else if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
|
|
{
|
|
if (*size_state == FULLSCREEN_HEIGHT)
|
|
*size_state = FULLSCREEN_MAXIMIZED;
|
|
@@ -8635,6 +8650,7 @@ get_current_vm_state (struct frame *f,
|
|
|
|
if (tmp_data) XFree (tmp_data);
|
|
UNBLOCK_INPUT;
|
|
+ return ! is_hidden;
|
|
}
|
|
|
|
/* Do fullscreen as specified in extended window manager hints */
|
|
@@ -8647,7 +8663,7 @@ do_ewmh_fullscreen (f)
|
|
Lisp_Object lval = get_frame_param (f, Qfullscreen);
|
|
int cur, dummy;
|
|
|
|
- get_current_vm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
|
|
+ (void)get_current_vm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
|
|
|
|
/* Some window managers don't say they support _NET_WM_STATE, but they do say
|
|
they support _NET_WM_STATE_FULLSCREEN. Try that also. */
|
|
@@ -8721,7 +8737,7 @@ XTfullscreen_hook (f)
|
|
}
|
|
|
|
|
|
-static void
|
|
+static int
|
|
x_handle_net_wm_state (f, event)
|
|
struct frame *f;
|
|
XPropertyEvent *event;
|
|
@@ -8729,10 +8745,10 @@ x_handle_net_wm_state (f, event)
|
|
int value = FULLSCREEN_NONE;
|
|
Lisp_Object lval;
|
|
int sticky = 0;
|
|
+ int not_hidden = get_current_vm_state (f, event->window, &value, &sticky);
|
|
|
|
- get_current_vm_state (f, event->window, &value, &sticky);
|
|
lval = Qnil;
|
|
- switch (value)
|
|
+ switch (value)
|
|
{
|
|
case FULLSCREEN_WIDTH:
|
|
lval = Qfullwidth;
|
|
@@ -8747,9 +8763,10 @@ x_handle_net_wm_state (f, event)
|
|
lval = Qmaximized;
|
|
break;
|
|
}
|
|
-
|
|
store_frame_param (f, Qfullscreen, lval);
|
|
store_frame_param (f, Qsticky, sticky ? Qt : Qnil);
|
|
+
|
|
+ return not_hidden;
|
|
}
|
|
|
|
/* Check if we need to resize the frame due to a fullscreen request.
|
|
@@ -9487,7 +9504,7 @@ x_iconify_frame (f)
|
|
if (!NILP (type))
|
|
x_bitmap_icon (f, type);
|
|
|
|
-#ifdef USE_GTK
|
|
+#if defined (USE_GTK)
|
|
if (FRAME_GTK_OUTER_WIDGET (f))
|
|
{
|
|
if (! FRAME_VISIBLE_P (f))
|
|
@@ -10518,6 +10535,8 @@ x_term_init (display_name, xrm_option, r
|
|
= XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
|
|
dpyinfo->Xatom_net_wm_state_sticky
|
|
= XInternAtom (dpyinfo->display, "_NET_WM_STATE_STICKY", False);
|
|
+ dpyinfo->Xatom_net_wm_state_hidden
|
|
+ = XInternAtom (dpyinfo->display, "_NET_WM_STATE_HIDDEN", False);
|
|
dpyinfo->Xatom_net_window_type
|
|
= XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False);
|
|
dpyinfo->Xatom_net_window_type_tooltip
|
|
diff -up emacs-23.3/src/xterm.h.wm-state-hidden emacs-23.3/src/xterm.h
|
|
--- emacs-23.3/src/xterm.h.wm-state-hidden 2011-01-08 18:45:14.000000000 +0100
|
|
+++ emacs-23.3/src/xterm.h 2011-11-23 11:56:01.219467181 +0100
|
|
@@ -365,7 +365,7 @@ struct x_display_info
|
|
/* Atoms dealing with EWMH (i.e. _NET_...) */
|
|
Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen_atom,
|
|
Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert,
|
|
- Xatom_net_wm_state_sticky, Xatom_net_frame_extents;
|
|
+ Xatom_net_wm_state_sticky, Xatom_net_wm_state_hidden, Xatom_net_frame_extents;
|
|
|
|
/* XSettings atoms and windows. */
|
|
Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;
|