]> Dogcows Code - chaz/openbox/commitdiff
invisible resizing areas/grips in the top corners of the window
authorDana Jansens <danakj@orodu.net>
Sat, 2 Aug 2003 06:20:31 +0000 (06:20 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 2 Aug 2003 06:20:31 +0000 (06:20 +0000)
data/rc3
openbox/frame.c
openbox/frame.h
openbox/framerender.c
render/theme.h

index 9acb3bb5d08f2b97d9f33e3000f1c7176a2d4454..282236ccca6b303d397a7f9cb0a36356f1adb92f 100644 (file)
--- a/data/rc3
+++ b/data/rc3
       <action name="focus"/>
     </mousebind>
   </context>
+  <context name="tlcorner">
+    <mousebind button="Left" action="drag">
+      <action name="resize"/>
+    </mousebind>
+    <mousebind button="Left" action="press">
+      <action name="focus"/>
+    </mousebind>
+  </context>
+  <context name="trcorner">
+    <mousebind button="Left" action="drag">
+      <action name="resize"/>
+    </mousebind>
+    <mousebind button="Left" action="press">
+      <action name="focus"/>
+    </mousebind>
+  </context>
   <context name="client">
     <mousebind button="Left" action="press">
       <action name="focus"/>
index 19ee3297f2b4d6aeb594da389b0e8ca773b2b7de..7e82788a41141122475fa79f5492dee91afd26d5 100644 (file)
@@ -63,7 +63,11 @@ ObFrame *frame_new()
     attrib.cursor = ob_cursor(OB_CURSOR_SOUTHWEST);
     self->lgrip = createWindow(self->handle, mask, &attrib);
     attrib.cursor = ob_cursor(OB_CURSOR_SOUTHEAST);
-    self->rgrip = createWindow(self->handle, mask, &attrib);
+    self->rgrip = createWindow(self->handle, mask, &attrib); 
+    attrib.cursor = ob_cursor(OB_CURSOR_NORTHWEST);
+    self->tlresize = createWindow(self->title, mask, &attrib);
+    attrib.cursor = ob_cursor(OB_CURSOR_NORTHEAST);
+    self->trresize = createWindow(self->title, mask, &attrib);
 
     self->focused = FALSE;
 
@@ -72,6 +76,8 @@ ObFrame *frame_new()
     XMapWindow(ob_display, self->lgrip);
     XMapWindow(ob_display, self->rgrip);
     XMapWindow(ob_display, self->label);
+    XMapWindow(ob_display, self->tlresize);
+    XMapWindow(ob_display, self->trresize);
 
     /* set colors/appearance/sizes for stuff that doesn't change */
     XSetWindowBorder(ob_display, self->window, ob_rr_theme->b_color->pixel);
@@ -95,6 +101,10 @@ ObFrame *frame_new()
                   ob_rr_theme->grip_width, ob_rr_theme->handle_height);
     XResizeWindow(ob_display, self->rgrip,
                   ob_rr_theme->grip_width, ob_rr_theme->handle_height);
+    XResizeWindow(ob_display, self->tlresize,
+                  ob_rr_theme->grip_width, ob_rr_theme->handle_height);
+    XResizeWindow(ob_display, self->trresize,
+                  ob_rr_theme->grip_width, ob_rr_theme->handle_height);
 
     /* set up the dynamic appearances */
     self->a_unfocused_title = RrAppearanceCopy(ob_rr_theme->a_unfocused_title);
@@ -208,12 +218,12 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
         g_assert(self->width > 0);
 
         /* set border widths */
-        XSetWindowBorderWidth(ob_display, self->plate,  self->cbwidth);
-        XSetWindowBorderWidth(ob_display, self->window, self->bwidth);
-        XSetWindowBorderWidth(ob_display, self->title,  self->bwidth);
-        XSetWindowBorderWidth(ob_display, self->handle, self->bwidth);
-        XSetWindowBorderWidth(ob_display, self->lgrip,  self->bwidth);
-        XSetWindowBorderWidth(ob_display, self->rgrip,  self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->plate,    self->cbwidth);
+        XSetWindowBorderWidth(ob_display, self->window,   self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->title,    self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->handle,   self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->lgrip,    self->bwidth);
+        XSetWindowBorderWidth(ob_display, self->rgrip,    self->bwidth);
   
         /* position/size and map/unmap all the windows */
 
@@ -233,6 +243,10 @@ void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
             self->innersize.top += ob_rr_theme->title_height + self->bwidth;
             XMapWindow(ob_display, self->title);
 
+            XMoveWindow(ob_display, self->tlresize, 0, 0);
+            XMoveWindow(ob_display, self->trresize,
+                        self->width - ob_rr_theme->grip_width, 0);
+
             /* layout the title bar elements */
             layout_title(self);
         } else
@@ -375,6 +389,8 @@ void frame_grab_client(ObFrame *self, ObClient *client)
     g_hash_table_insert(window_map, &self->handle, client);
     g_hash_table_insert(window_map, &self->lgrip, client);
     g_hash_table_insert(window_map, &self->rgrip, client);
+    g_hash_table_insert(window_map, &self->tlresize, client);
+    g_hash_table_insert(window_map, &self->trresize, client);
 }
 
 void frame_release_client(ObFrame *self, ObClient *client)
@@ -416,6 +432,8 @@ void frame_release_client(ObFrame *self, ObClient *client)
     g_hash_table_remove(window_map, &self->handle);
     g_hash_table_remove(window_map, &self->lgrip);
     g_hash_table_remove(window_map, &self->rgrip);
+    g_hash_table_remove(window_map, &self->tlresize);
+    g_hash_table_remove(window_map, &self->trresize);
 
     frame_free(self);
 }
@@ -555,6 +573,10 @@ ObFrameContext frame_context_from_string(char *name)
         return OB_FRAME_CONTEXT_HANDLE;
     else if (!g_ascii_strcasecmp("frame", name))
         return OB_FRAME_CONTEXT_FRAME;
+    else if (!g_ascii_strcasecmp("tlcorner", name))
+        return OB_FRAME_CONTEXT_TLCORNER;
+    else if (!g_ascii_strcasecmp("trcorner", name))
+        return OB_FRAME_CONTEXT_TRCORNER;
     else if (!g_ascii_strcasecmp("blcorner", name))
         return OB_FRAME_CONTEXT_BLCORNER;
     else if (!g_ascii_strcasecmp("brcorner", name))
@@ -583,19 +605,21 @@ ObFrameContext frame_context(ObClient *client, Window win)
     if (win == client->window) return OB_FRAME_CONTEXT_CLIENT;
 
     self = client->frame;
-    if (win == self->window) return OB_FRAME_CONTEXT_FRAME;
-    if (win == self->plate)  return OB_FRAME_CONTEXT_CLIENT;
-    if (win == self->title)  return OB_FRAME_CONTEXT_TITLEBAR;
-    if (win == self->label)  return OB_FRAME_CONTEXT_TITLEBAR;
-    if (win == self->handle) return OB_FRAME_CONTEXT_HANDLE;
-    if (win == self->lgrip)  return OB_FRAME_CONTEXT_BLCORNER;
-    if (win == self->rgrip)  return OB_FRAME_CONTEXT_BRCORNER;
-    if (win == self->max)    return OB_FRAME_CONTEXT_MAXIMIZE;
-    if (win == self->iconify)return OB_FRAME_CONTEXT_ICONIFY;
-    if (win == self->close)  return OB_FRAME_CONTEXT_CLOSE;
-    if (win == self->icon)   return OB_FRAME_CONTEXT_ICON;
-    if (win == self->desk)   return OB_FRAME_CONTEXT_ALLDESKTOPS;
-    if (win == self->shade)  return OB_FRAME_CONTEXT_SHADE;
+    if (win == self->window)   return OB_FRAME_CONTEXT_FRAME;
+    if (win == self->plate)    return OB_FRAME_CONTEXT_CLIENT;
+    if (win == self->title)    return OB_FRAME_CONTEXT_TITLEBAR;
+    if (win == self->label)    return OB_FRAME_CONTEXT_TITLEBAR;
+    if (win == self->handle)   return OB_FRAME_CONTEXT_HANDLE;
+    if (win == self->lgrip)    return OB_FRAME_CONTEXT_BLCORNER;
+    if (win == self->rgrip)    return OB_FRAME_CONTEXT_BRCORNER;
+    if (win == self->tlresize) return OB_FRAME_CONTEXT_TLCORNER;
+    if (win == self->trresize) return OB_FRAME_CONTEXT_TRCORNER;
+    if (win == self->max)      return OB_FRAME_CONTEXT_MAXIMIZE;
+    if (win == self->iconify)  return OB_FRAME_CONTEXT_ICONIFY;
+    if (win == self->close)    return OB_FRAME_CONTEXT_CLOSE;
+    if (win == self->icon)     return OB_FRAME_CONTEXT_ICON;
+    if (win == self->desk)     return OB_FRAME_CONTEXT_ALLDESKTOPS;
+    if (win == self->shade)    return OB_FRAME_CONTEXT_SHADE;
 
     return OB_FRAME_CONTEXT_NONE;
 }
index 0fd7aba326504ba0c159101fb490ae2efada69ea..8eacbb1bcdd2d96c021a838c3040bbd428e98d74 100644 (file)
@@ -17,6 +17,8 @@ typedef enum {
     OB_FRAME_CONTEXT_FRAME,
     OB_FRAME_CONTEXT_BLCORNER,
     OB_FRAME_CONTEXT_BRCORNER,
+    OB_FRAME_CONTEXT_TLCORNER,
+    OB_FRAME_CONTEXT_TRCORNER,
     OB_FRAME_CONTEXT_MAXIMIZE,
     OB_FRAME_CONTEXT_ALLDESKTOPS,
     OB_FRAME_CONTEXT_SHADE,
@@ -66,6 +68,9 @@ struct _ObFrame
     Window    lgrip;
     Window    rgrip;
 
+    Window    tlresize;
+    Window    trresize;
+
     RrAppearance *a_unfocused_title;
     RrAppearance *a_focused_title;
     RrAppearance *a_unfocused_label;
index 4115ceba06073d088a2d52cdd2a76aed86c7551d..52001c111e587f2c308d81ea4dda6aaf1abadb7a 100644 (file)
@@ -120,6 +120,20 @@ void framerender_frame(ObFrame *self)
 
         RrPaint(t, self->title, self->width, ob_rr_theme->title_height);
 
+        ob_rr_theme->a_clear->surface.parent = t;
+        ob_rr_theme->a_clear->surface.parentx = 0;
+        ob_rr_theme->a_clear->surface.parenty = 0;
+
+        RrPaint(ob_rr_theme->a_clear, self->tlresize,
+                ob_rr_theme->grip_width, ob_rr_theme->handle_height);
+
+        ob_rr_theme->a_clear->surface.parentx =
+            self->width - ob_rr_theme->grip_width;
+
+        RrPaint(ob_rr_theme->a_clear, self->trresize,
+                ob_rr_theme->grip_width, ob_rr_theme->handle_height);
+
+
         /* set parents for any parent relative guys */
         l->surface.parent = t;
         l->surface.parentx = self->label_x;
index a851b5b5063280366e5a649748c033ffb426cea3..5523b0cea7341bb93c55199dc8ec7544d312f4e5 100644 (file)
@@ -138,6 +138,7 @@ struct _RrTheme {
     RrAppearance *a_menu_item;
     RrAppearance *a_menu_disabled;
     RrAppearance *a_menu_hilite;
+    RrAppearance *a_clear;
 
     RrAppearance *app_hilite_bg;
     RrAppearance *app_unhilite_bg;
This page took 0.035135 seconds and 4 git commands to generate.