Exit when we loose the WM_Sn selection
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
5a17b3978c
commit
e824f8f30d
|
@ -227,7 +227,6 @@ acquire_WM_Sn(void)
|
||||||
{
|
{
|
||||||
xcb_intern_atom_cookie_t atom_q;
|
xcb_intern_atom_cookie_t atom_q;
|
||||||
xcb_intern_atom_reply_t *atom_r;
|
xcb_intern_atom_reply_t *atom_r;
|
||||||
xcb_atom_t atom;
|
|
||||||
char *atom_name;
|
char *atom_name;
|
||||||
|
|
||||||
/* Get the WM_Sn atom */
|
/* Get the WM_Sn atom */
|
||||||
|
@ -251,11 +250,12 @@ acquire_WM_Sn(void)
|
||||||
if(!atom_r)
|
if(!atom_r)
|
||||||
fatal("error getting WM_Sn atom");
|
fatal("error getting WM_Sn atom");
|
||||||
|
|
||||||
atom = atom_r->atom;
|
globalconf.selection_atom = atom_r->atom;
|
||||||
p_delete(&atom_r);
|
p_delete(&atom_r);
|
||||||
|
|
||||||
/* Acquire the selection */
|
/* Acquire the selection */
|
||||||
xcb_set_selection_owner(globalconf.connection, globalconf.selection_owner_window, atom, XCB_CURRENT_TIME);
|
xcb_set_selection_owner(globalconf.connection, globalconf.selection_owner_window,
|
||||||
|
globalconf.selection_atom, XCB_CURRENT_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
11
event.c
11
event.c
|
@ -862,6 +862,16 @@ event_handle_reparentnotify(xcb_reparent_notify_event_t *ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_handle_selectionclear(xcb_selection_clear_event_t *ev)
|
||||||
|
{
|
||||||
|
if(ev->selection == globalconf.selection_atom)
|
||||||
|
{
|
||||||
|
warn("Lost WM_Sn selection, exiting...");
|
||||||
|
g_main_loop_quit(globalconf.loop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief awesome xerror function.
|
/** \brief awesome xerror function.
|
||||||
* There's no way to check accesses to destroyed windows, thus those cases are
|
* There's no way to check accesses to destroyed windows, thus those cases are
|
||||||
* ignored (especially on UnmapNotify's).
|
* ignored (especially on UnmapNotify's).
|
||||||
|
@ -921,6 +931,7 @@ void event_handle(xcb_generic_event_t *event)
|
||||||
EVENT(XCB_PROPERTY_NOTIFY, property_handle_propertynotify);
|
EVENT(XCB_PROPERTY_NOTIFY, property_handle_propertynotify);
|
||||||
EVENT(XCB_REPARENT_NOTIFY, event_handle_reparentnotify);
|
EVENT(XCB_REPARENT_NOTIFY, event_handle_reparentnotify);
|
||||||
EVENT(XCB_UNMAP_NOTIFY, event_handle_unmapnotify);
|
EVENT(XCB_UNMAP_NOTIFY, event_handle_unmapnotify);
|
||||||
|
EVENT(XCB_SELECTION_CLEAR, event_handle_selectionclear);
|
||||||
#undef EVENT
|
#undef EVENT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,8 @@ typedef struct
|
||||||
key_array_t keys;
|
key_array_t keys;
|
||||||
/** Root window mouse bindings */
|
/** Root window mouse bindings */
|
||||||
button_array_t buttons;
|
button_array_t buttons;
|
||||||
|
/** Atom for WM_Sn */
|
||||||
|
xcb_atom_t selection_atom;
|
||||||
/** Window owning the WM_Sn selection */
|
/** Window owning the WM_Sn selection */
|
||||||
xcb_window_t selection_owner_window;
|
xcb_window_t selection_owner_window;
|
||||||
/** Modifiers masks */
|
/** Modifiers masks */
|
||||||
|
|
Loading…
Reference in New Issue