X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fevent.c;h=766be8fd9a5c58370fbd13f2e618aa677e06a423;hb=58cfbb7f8419e084af6b6b8b00c88ed270c29e88;hp=5dd1f7057f6361a211858914fe6943f5974d4713;hpb=a8a4a2cca30602b66b7a7f68bb9f3fffd34e92c9;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index 5dd1f705..766be8fd 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1,4 +1,5 @@ #include "openbox.h" +#include "slit.h" #include "client.h" #include "xerror.h" #include "prop.h" @@ -23,6 +24,8 @@ static void event_process(XEvent *e); static void event_handle_root(XEvent *e); +static void event_handle_slit(Slit *s, XEvent *e); +static void event_handle_slitapp(SlitApp *app, XEvent *e); static void event_handle_client(Client *c, XEvent *e); static void event_handle_menu(Menu *menu, XEvent *e); @@ -114,7 +117,7 @@ void event_loop() XNextEvent(ob_display, &e); event_process(&e); - had_event = TRUE; + had_event = TRUE; } if (!had_event) { @@ -313,7 +316,8 @@ static gboolean event_ignore(XEvent *e, Client *client) #endif /* is the focused window getting a FocusOut/In back to itself? */ - if (fe.xfocus.window == e->xfocus.window) { + if (fe.xfocus.window == e->xfocus.window && + !event_ignore(&fe, client)) { #ifdef DEBUG_FOCUS g_message("focused window got an Out/In back to " "itself IGNORED both"); @@ -372,12 +376,16 @@ static gboolean event_ignore(XEvent *e, Client *client) static void event_process(XEvent *e) { Window window; - Client *client; + Client *client = NULL; + Slit *slit = NULL; + SlitApp *slitapp = NULL; Menu *menu = NULL; window = event_get_window(e); if (!(client = g_hash_table_lookup(client_map, &window))) - menu = g_hash_table_lookup(menu_map, &window); + if (!(slitapp = g_hash_table_lookup(slit_app_map, &window))) + if (!(slit = g_hash_table_lookup(slit_map, &window))) + menu = g_hash_table_lookup(menu_map, &window); event_set_lasttime(e); event_hack_mods(e); @@ -390,6 +398,10 @@ static void event_process(XEvent *e) return; } else if (client) event_handle_client(client, e); + else if (slitapp) + event_handle_slitapp(slitapp, e); + else if (slit) + event_handle_slit(slit, e); else if (window == ob_root) event_handle_root(e); else if (e->type == MapRequest) @@ -900,3 +912,42 @@ static void event_handle_menu(Menu *menu, XEvent *e) } } } + +static void event_handle_slit(Slit *s, XEvent *e) +{ + switch (e->type) { + case ButtonPress: + stacking_raise(SLIT_AS_WINDOW(s)); + case EnterNotify: + slit_hide(s, FALSE); + break; + case LeaveNotify: + slit_hide(s, TRUE); + break; + } +} + +static void event_handle_slitapp(SlitApp *app, XEvent *e) +{ + switch (e->type) { + case MotionNotify: + slit_app_drag(app, &e->xmotion); + break; + case UnmapNotify: + if (app->ignore_unmaps) { + app->ignore_unmaps--; + break; + } + slit_remove(app, TRUE); + break; + case DestroyNotify: + slit_remove(app, FALSE); + break; + case ReparentNotify: + slit_remove(app, FALSE); + break; + case ConfigureNotify: + slit_app_configure(app, e->xconfigure.width, e->xconfigure.height); + break; + } +}