]> Dogcows Code - chaz/openbox/commitdiff
hover theme elements for window titlebar buttons
authorDana Jansens <danakj@orodu.net>
Mon, 28 Jul 2003 19:21:45 +0000 (19:21 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 28 Jul 2003 19:21:45 +0000 (19:21 +0000)
openbox/event.c
openbox/frame.c
openbox/frame.h
openbox/framerender.c

index a35c5258a24858a85f7ba5b65ade8f2cc6ff67e6..e1ab8fef63f75fca06b565ae4c092952e687809c 100644 (file)
@@ -658,36 +658,77 @@ static void event_handle_client(ObClient *client, XEvent *e)
             client_iconify(client, TRUE, TRUE);
         frame_adjust_focus(client->frame, FALSE);
        break;
-    case EnterNotify:
+    case LeaveNotify:
+        con = frame_context(client, e->xcrossing.window);
         switch (con) {
         case OB_FRAME_CONTEXT_MAXIMIZE:
+            client->frame->max_hover = FALSE;
+            frame_adjust_state(client->frame);
+            break;
         case OB_FRAME_CONTEXT_ALLDESKTOPS:
+            client->frame->desk_hover = FALSE;
+            frame_adjust_state(client->frame);
+            break;
         case OB_FRAME_CONTEXT_SHADE:
+            client->frame->shade_hover = FALSE;
+            frame_adjust_state(client->frame);
+            break;
         case OB_FRAME_CONTEXT_ICONIFY:
+            client->frame->iconify_hover = FALSE;
+            frame_adjust_state(client->frame);
+            break;
         case OB_FRAME_CONTEXT_CLOSE:
-            g_message("hi");
+            client->frame->close_hover = FALSE;
             frame_adjust_state(client->frame);
             break;
         default:
             break;
         }
-        con = frame_context(client, e->xcrossing.subwindow);
-        if (client_normal(client)) {
-            if (ob_state() == OB_STATE_STARTING) {
-                /* move it to the top of the focus order */
-                guint desktop = client->desktop;
-                if (desktop == DESKTOP_ALL) desktop = screen_desktop;
-                focus_order[desktop] = g_list_remove(focus_order[desktop],
-                                                     client);
-                focus_order[desktop] = g_list_prepend(focus_order[desktop],
-                                                      client);
-            } else if (config_focus_follow) {
+        break;
+    case EnterNotify:
+        con = frame_context(client, e->xcrossing.window);
+        switch (con) {
+        case OB_FRAME_CONTEXT_MAXIMIZE:
+            client->frame->max_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        case OB_FRAME_CONTEXT_ALLDESKTOPS:
+            client->frame->desk_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        case OB_FRAME_CONTEXT_SHADE:
+            client->frame->shade_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        case OB_FRAME_CONTEXT_ICONIFY:
+            client->frame->iconify_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        case OB_FRAME_CONTEXT_CLOSE:
+            client->frame->close_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        case OB_FRAME_CONTEXT_FRAME:
+            if (client_normal(client)) {
+                if (ob_state() == OB_STATE_STARTING) {
+                    /* move it to the top of the focus order */
+                    guint desktop = client->desktop;
+                    if (desktop == DESKTOP_ALL) desktop = screen_desktop;
+                    focus_order[desktop] = g_list_remove(focus_order[desktop],
+                                                         client);
+                    focus_order[desktop] = g_list_prepend(focus_order[desktop],
+                                                          client);
+                } else if (config_focus_follow) {
 #ifdef DEBUG_FOCUS
-                ob_debug("EnterNotify on %lx, focusing window\n",
-                         client->window);
+                    ob_debug("EnterNotify on %lx, focusing window\n",
+                             client->window);
 #endif
-                client_focus(client);
+                    client_focus(client);
+                }
             }
+            break;
+        default:
+            break;
         }
         break;
     case ConfigureRequest:
index 3e90c3e2ccffd46768fda18d281fda541767fa4e..1c9913a121276e0776a863973424e46de3417d5b 100644 (file)
@@ -9,7 +9,8 @@
 #define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \
                          ButtonPressMask | ButtonReleaseMask)
 #define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \
-                           ButtonMotionMask | ExposureMask)
+                           ButtonMotionMask | ExposureMask | \
+                           EnterWindowMask | LeaveWindowMask)
 
 #define FRAME_HANDLE_Y(f) (f->innersize.top + f->client->area.height + \
                           f->cbwidth)
@@ -106,6 +107,8 @@ ObFrame *frame_new()
 
     self->max_press = self->close_press = self->desk_press = 
        self->iconify_press = self->shade_press = FALSE;
+    self->max_hover = self->close_hover = self->desk_hover = 
+       self->iconify_hover = self->shade_hover = FALSE;
 
     return (ObFrame*)self;
 }
index 0295a6beb2a32853498327ab242a93cf951aa89c..0fd7aba326504ba0c159101fb490ae2efada69ea 100644 (file)
@@ -95,6 +95,11 @@ struct _ObFrame
     gboolean  desk_press;
     gboolean  shade_press;
     gboolean  iconify_press;
+    gboolean  max_hover;
+    gboolean  close_hover;
+    gboolean  desk_hover;
+    gboolean  shade_hover;
+    gboolean  iconify_hover;
 
     gboolean  focused;
 };
index 5f2f25945fec3ad07560a747595eec9ca474f272..d5269c00eec35c1083a61c6c052b2d645a952e57 100644 (file)
@@ -38,12 +38,16 @@ void framerender_frame(ObFrame *self)
                ob_rr_theme->a_focused_pressed_set_max :
                (self->max_press ?
                 ob_rr_theme->a_focused_pressed_max :
-                ob_rr_theme->a_focused_unpressed_max)) :
+                (self->max_hover ?
+                 ob_rr_theme->a_hover_focused_max : 
+                 ob_rr_theme->a_focused_unpressed_max))) :
               (self->client->max_vert || self->client->max_horz ?
                ob_rr_theme->a_unfocused_pressed_set_max :
                (self->max_press ?
                 ob_rr_theme->a_unfocused_pressed_max :
-                ob_rr_theme->a_unfocused_unpressed_max))));
+                (self->max_hover ?
+                 ob_rr_theme->a_hover_unfocused_max : 
+                 ob_rr_theme->a_unfocused_unpressed_max)))));
         n = self->a_icon;
         i = (!(self->decorations & OB_FRAME_DECOR_ICONIFY) ?
              (self->focused ?
@@ -52,10 +56,14 @@ void framerender_frame(ObFrame *self)
              (self->focused ?
               (self->iconify_press ?
                ob_rr_theme->a_focused_pressed_iconify :
-               ob_rr_theme->a_focused_unpressed_iconify) :
+               (self->iconify_hover ?
+                ob_rr_theme->a_hover_focused_iconify : 
+                ob_rr_theme->a_focused_unpressed_iconify)) :
               (self->iconify_press ?
                ob_rr_theme->a_unfocused_pressed_iconify :
-               ob_rr_theme->a_unfocused_unpressed_iconify)));
+               (self->iconify_hover ?
+                ob_rr_theme->a_hover_unfocused_iconify : 
+                ob_rr_theme->a_unfocused_unpressed_iconify))));
         d = (!(self->decorations & OB_FRAME_DECOR_ALLDESKTOPS) ?
              (self->focused ?
               ob_rr_theme->a_disabled_focused_desk :
@@ -65,12 +73,16 @@ void framerender_frame(ObFrame *self)
                ob_rr_theme->a_focused_pressed_set_desk :
                (self->desk_press ?
                 ob_rr_theme->a_focused_pressed_desk :
-                ob_rr_theme->a_focused_unpressed_desk)) :
+                (self->desk_hover ?
+                 ob_rr_theme->a_hover_focused_desk : 
+                 ob_rr_theme->a_focused_unpressed_desk))) :
               (self->client->desktop == DESKTOP_ALL ?
                ob_rr_theme->a_unfocused_pressed_set_desk :
                (self->desk_press ?
                 ob_rr_theme->a_unfocused_pressed_desk :
-                ob_rr_theme->a_unfocused_unpressed_desk))));
+                (self->desk_hover ?
+                 ob_rr_theme->a_hover_unfocused_desk : 
+                 ob_rr_theme->a_unfocused_unpressed_desk)))));
         s = (!(self->decorations & OB_FRAME_DECOR_SHADE) ?
              (self->focused ?
               ob_rr_theme->a_disabled_focused_shade :
@@ -80,12 +92,16 @@ void framerender_frame(ObFrame *self)
                ob_rr_theme->a_focused_pressed_set_shade :
                (self->shade_press ?
                 ob_rr_theme->a_focused_pressed_shade :
-                ob_rr_theme->a_focused_unpressed_shade)) :
+                (self->shade_hover ?
+                 ob_rr_theme->a_hover_focused_shade : 
+                 ob_rr_theme->a_focused_unpressed_shade))) :
               (self->client->shaded ?
                ob_rr_theme->a_unfocused_pressed_set_shade :
                (self->shade_press ?
                 ob_rr_theme->a_unfocused_pressed_shade :
-                ob_rr_theme->a_unfocused_unpressed_shade))));
+                (self->shade_hover ?
+                 ob_rr_theme->a_hover_unfocused_shade : 
+                 ob_rr_theme->a_unfocused_unpressed_shade)))));
         c = (!(self->decorations & OB_FRAME_DECOR_CLOSE) ?
              (self->focused ?
               ob_rr_theme->a_disabled_focused_close :
@@ -93,10 +109,14 @@ void framerender_frame(ObFrame *self)
              (self->focused ?
               (self->close_press ?
                ob_rr_theme->a_focused_pressed_close :
-               ob_rr_theme->a_focused_unpressed_close) :
+               (self->close_hover ?
+                ob_rr_theme->a_hover_focused_close : 
+                ob_rr_theme->a_focused_unpressed_close)) :
               (self->close_press ?
                ob_rr_theme->a_unfocused_pressed_close :
-               ob_rr_theme->a_unfocused_unpressed_close)));
+               (self->close_hover ?
+                ob_rr_theme->a_hover_unfocused_close : 
+                ob_rr_theme->a_unfocused_unpressed_close))));
 
         RrPaint(t, self->title, self->width, ob_rr_theme->title_height);
 
This page took 0.035266 seconds and 4 git commands to generate.