summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Wong <gtw@gnu.org>2009-08-30 22:06:34 -0600
committerGary Wong <gtw@gnu.org>2009-08-30 22:06:34 -0600
commit6c0db89a37170f2326f6156bdec1a52f1e813b67 (patch)
tree2703e0a2e0a6bf8d5252d5647c1616e45ce20847
parent20e28ea41bc3deae601e5995937c22d5d968cccd (diff)
Fix frame passive grab handling, esp. if a window is destroyed with a grab.
-rw-r--r--ChangeLog6
-rw-r--r--frame.c38
2 files changed, 33 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 066b10a..9d75d95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-08-30 Gary Wong <gtw@gnu.org>
+ * frame.c (frame_button_release): Ignore the event unless the
+ window was the one to establish the passive grab.
+ (frame_destroy_notify): New function.
+
+2009-08-30 Gary Wong <gtw@gnu.org>
+
* decorate-render.c (lookup_face): New function.
(query_metrics, query_glyph, replace_glyph, render_text): Take style
into consideration.
diff --git a/frame.c b/frame.c
index 271c6b5..8faac26 100644
--- a/frame.c
+++ b/frame.c
@@ -531,7 +531,7 @@ static void frame_motion_notify( struct gwm_window *window,
static void frame_button_release( struct gwm_window *window,
xcb_button_release_event_t *ev ) {
- if( !final_release( ev ) )
+ if( !final_release( ev ) || window->w != passive_grab )
return;
if( moved )
@@ -613,6 +613,30 @@ static void frame_enter_notify( struct gwm_window *window,
ev->time );
}
+static void frame_destroy_notify( struct gwm_window *window,
+ xcb_destroy_notify_event_t *ev ) {
+
+ if( window->w != passive_grab )
+ return;
+
+ if( moved )
+ free_edges();
+
+ if( feedback ) {
+ xcb_destroy_window( c, feedback->w );
+ forget_window( feedback );
+ feedback = NULL;
+ }
+}
+
+static void frame_map_request( struct gwm_window *window,
+ xcb_map_request_event_t *ev ) {
+
+ if( ev->window == window->u.frame.child->w )
+ /* A transition to the Normal state (ICCCM 2.0, section 4.1.4). */
+ iconic_to_normal( window->u.frame.child );
+}
+
extern void synthetic_configure_notify( struct gwm_window *window ) {
xcb_configure_notify_event_t msg;
@@ -636,14 +660,6 @@ extern void synthetic_configure_notify( struct gwm_window *window ) {
XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char *) &msg );
}
-static void frame_map_request( struct gwm_window *window,
- xcb_map_request_event_t *ev ) {
-
- if( ev->window == window->u.frame.child->w )
- /* A transition to the Normal state (ICCCM 2.0, section 4.1.4). */
- iconic_to_normal( window->u.frame.child );
-}
-
static void frame_configure_notify( struct gwm_window *window,
xcb_configure_notify_event_t *ev ) {
@@ -732,7 +748,7 @@ event_handler frame_handlers[] = {
NULL, /* NoExposure */
NULL, /* VisibilityNotify */
NULL, /* CreateNotify */
- NULL, /* DestroyNotify */
+ (event_handler) frame_destroy_notify,
NULL, /* UnmapNotify */
NULL, /* MapNotify */
(event_handler) frame_map_request,
@@ -772,7 +788,7 @@ event_handler childless_handlers[] = {
NULL, /* NoExposure */
NULL, /* VisibilityNotify */
NULL, /* CreateNotify */
- NULL, /* DestroyNotify */
+ (event_handler) frame_destroy_notify,
NULL, /* UnmapNotify */
NULL, /* MapNotify */
(event_handler) withdrawn_map_request,