]> Dogcows Code - chaz/openbox/commitdiff
don't focus splash screens and toolbars and menus when you click on them. or enter...
authorDana Jansens <danakj@orodu.net>
Tue, 8 May 2007 22:29:39 +0000 (22:29 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 8 May 2007 22:29:39 +0000 (22:29 +0000)
openbox/action.c
openbox/client.c
openbox/client.h
openbox/event.c

index f8b2b7b3845175971043169876bd2b57fbcf7f63..4ff6bdb95b7049c6e310c4834b807e5e39fadfda 100644 (file)
@@ -1199,10 +1199,7 @@ void action_execute(union ActionData *data)
 void action_activate(union ActionData *data)
 {
     if (data->client.any.c) {
-        /* similar to the openbox dock for dockapps, don't let user actions
-           give focus to 3rd-party docks (panels) either (unless they ask for
-           it themselves). */
-        if (data->client.any.c->type != OB_CLIENT_TYPE_DOCK) {
+        if (!data->any.button || client_mouse_focusable(data->client.any.c)) {
             /* if using focus_delay, stop the timer now so that focus doesn't
                go moving on us */
             event_halt_focus_delay();
@@ -1220,10 +1217,7 @@ void action_activate(union ActionData *data)
 void action_focus(union ActionData *data)
 {
     if (data->client.any.c) {
-        /* similar to the openbox dock for dockapps, don't let user actions
-           give focus to 3rd-party docks (panels) either (unless they ask for
-           it themselves). */
-        if (data->client.any.c->type != OB_CLIENT_TYPE_DOCK) {
+        if (!data->any.button || client_mouse_focusable(data->client.any.c)) {
             /* if using focus_delay, stop the timer now so that focus doesn't
                go moving on us */
             event_halt_focus_delay();
index e2b2636baa52101935b2ec8a105df60322f8169b..21a0accf84db861698bb46476a609ce3bc2881a9 100644 (file)
@@ -2394,6 +2394,22 @@ gboolean client_helper(ObClient *self)
             self->type == OB_CLIENT_TYPE_TOOLBAR);
 }
 
+gboolean client_mouse_focusable(ObClient *self)
+{
+    return !(self->type == OB_CLIENT_TYPE_MENU ||
+             self->type == OB_CLIENT_TYPE_TOOLBAR ||
+             self->type == OB_CLIENT_TYPE_SPLASH ||
+             self->type == OB_CLIENT_TYPE_DOCK);
+}
+
+gboolean client_enter_focusable(ObClient *self)
+{
+    /* you can focus desktops but it shouldn't on enter */
+    return (client_mouse_focusable(self) &&
+            self->type != OB_CLIENT_TYPE_DESKTOP);
+}
+
+
 static void client_apply_startup_state(ObClient *self, gint x, gint y)
 {
     gboolean pos = FALSE; /* has the window's position been configured? */
index 5fb26262a9f2b8e29b5b17ada0b4f21c22acfbc1..5c5fdb90c3494f61c9bd9efcfea114a8247a9392 100644 (file)
@@ -338,6 +338,16 @@ gboolean client_normal(ObClient *self);
   (utilty, menu, etc) */
 gboolean client_helper(ObClient *self);
 
+/*! Return if the client is a type which should be given focus from mouse
+  actions like button presses. This doesn't count for focus cycling, different
+  rules apply to that. */
+gboolean client_mouse_focusable(ObClient *self);
+
+/*! Return if the client is a type which should be given focus from the
+  mouse entering the window. This doesn't count for focus cycling, different
+  rules apply to that. */
+gboolean client_enter_focusable(ObClient *self);
+
 /* Returns if the window is focused */
 gboolean client_focused(ObClient *self);
 
index 44ae7b0a74a3ebaf400cc045830f25a9ec626958..a4090b0c4d5a210d5cd0dd9b1b194e8803de2511 100644 (file)
@@ -676,7 +676,7 @@ void event_enter_client(ObClient *client)
 {
     g_assert(config_focus_follow);
 
-    if (client_normal(client) && client_can_focus(client)) {
+    if (client_enter_focusable(client) && client_can_focus(client)) {
         if (config_focus_delay) {
             ObFocusDelayData *data;
 
This page took 0.034028 seconds and 4 git commands to generate.