From 5eba6007e78eb52da0a20e954fec9d88124c026d Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 12 May 2007 17:54:55 +0000 Subject: [PATCH] change the "handle" context to "bottom". add a "top" context. make the top and bottom contexts resize vertically in the default config file. --- data/rc.xml | 12 ++++++++++-- data/rc.xsd | 3 ++- openbox/config.c | 3 +-- openbox/frame.c | 23 ++++++++++++++++++++--- openbox/frame.h | 4 +++- openbox/framerender.c | 9 ++++++++- openbox/mouse.c | 5 +++-- 7 files changed, 47 insertions(+), 12 deletions(-) diff --git a/data/rc.xml b/data/rc.xml index bda1ca8..515acff 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -256,12 +256,20 @@ client-menu - + + + top + + + + + + bottom - + diff --git a/data/rc.xsd b/data/rc.xsd index af4eda4..a439725 100644 --- a/data/rc.xsd +++ b/data/rc.xsd @@ -388,12 +388,13 @@ - + + diff --git a/openbox/config.c b/openbox/config.c index 99e35b5..c4fed63 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -751,7 +751,7 @@ static void bind_default_mouse() { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS, "Focus" }, { "Right", "Desktop", OB_MOUSE_ACTION_PRESS, "Focus" }, { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS, "Focus" }, - { "Left", "Handle", OB_MOUSE_ACTION_PRESS, "Focus" }, + { "Left", "Bottom", OB_MOUSE_ACTION_PRESS, "Focus" }, { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS, "Focus" }, { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS, "Focus" }, { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS, "Focus" }, @@ -765,7 +765,6 @@ static void bind_default_mouse() { "Left", "Client", OB_MOUSE_ACTION_CLICK, "Raise" }, { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK, "Raise" }, { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK, "Lower" }, - { "Left", "Handle", OB_MOUSE_ACTION_CLICK, "Raise" }, { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK, "Raise" }, { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK, "Raise" }, { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK, "Raise" }, diff --git a/openbox/frame.c b/openbox/frame.c index 716d23a..3b01710 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -139,6 +139,8 @@ ObFrame *frame_new(ObClient *client) self->title = createWindow(self->window, NULL, mask, &attrib); mask |= CWCursor; + attrib.cursor = ob_cursor(OB_CURSOR_NORTH); + self->topresize = createWindow(self->title, NULL, mask, &attrib); attrib.cursor = ob_cursor(OB_CURSOR_NORTHWEST); self->tltresize = createWindow(self->title, NULL, mask, &attrib); self->tllresize = createWindow(self->title, NULL, mask, &attrib); @@ -379,17 +381,27 @@ void frame_adjust_area(ObFrame *self, gboolean moved, XMapWindow(ob_display, self->title); if (self->decorations & OB_FRAME_DECOR_GRIPS) { + XMoveResizeWindow(ob_display, self->topresize, + ob_rr_theme->grip_width + self->bwidth, + 0, + self->width - (ob_rr_theme->grip_width + + self->bwidth) * 2, + ob_rr_theme->paddingy + 1); + XMoveWindow(ob_display, self->tltresize, 0, 0); XMoveWindow(ob_display, self->tllresize, 0, 0); XMoveWindow(ob_display, self->trtresize, self->width - ob_rr_theme->grip_width, 0); XMoveWindow(ob_display, self->trrresize, self->width - ob_rr_theme->paddingx - 1, 0); + + XMapWindow(ob_display, self->topresize); XMapWindow(ob_display, self->tltresize); XMapWindow(ob_display, self->tllresize); XMapWindow(ob_display, self->trtresize); XMapWindow(ob_display, self->trrresize); } else { + XUnmapWindow(ob_display, self->topresize); XUnmapWindow(ob_display, self->tltresize); XUnmapWindow(ob_display, self->tllresize); XUnmapWindow(ob_display, self->trtresize); @@ -579,6 +591,7 @@ void frame_grab_client(ObFrame *self) g_hash_table_insert(window_map, &self->handle, self->client); g_hash_table_insert(window_map, &self->lgrip, self->client); g_hash_table_insert(window_map, &self->rgrip, self->client); + g_hash_table_insert(window_map, &self->topresize, self->client); g_hash_table_insert(window_map, &self->tltresize, self->client); g_hash_table_insert(window_map, &self->tllresize, self->client); g_hash_table_insert(window_map, &self->trtresize, self->client); @@ -636,6 +649,7 @@ void frame_release_client(ObFrame *self) 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->topresize); g_hash_table_remove(window_map, &self->tltresize); g_hash_table_remove(window_map, &self->tllresize); g_hash_table_remove(window_map, &self->trtresize); @@ -819,8 +833,6 @@ ObFrameContext frame_context_from_string(const gchar *name) return OB_FRAME_CONTEXT_CLIENT; else if (!g_ascii_strcasecmp("Titlebar", name)) return OB_FRAME_CONTEXT_TITLEBAR; - else if (!g_ascii_strcasecmp("Handle", 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)) @@ -831,6 +843,10 @@ ObFrameContext frame_context_from_string(const gchar *name) return OB_FRAME_CONTEXT_BLCORNER; else if (!g_ascii_strcasecmp("BRCorner", name)) return OB_FRAME_CONTEXT_BRCORNER; + else if (!g_ascii_strcasecmp("Top", name)) + return OB_FRAME_CONTEXT_TOP; + else if (!g_ascii_strcasecmp("Bottom", name)) + return OB_FRAME_CONTEXT_BOTTOM; else if (!g_ascii_strcasecmp("Maximize", name)) return OB_FRAME_CONTEXT_MAXIMIZE; else if (!g_ascii_strcasecmp("AllDesktops", name)) @@ -900,9 +916,10 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y) if (win == self->window) return OB_FRAME_CONTEXT_FRAME; if (win == self->label) return OB_FRAME_CONTEXT_TITLEBAR; - if (win == self->handle) return OB_FRAME_CONTEXT_HANDLE; + if (win == self->handle) return OB_FRAME_CONTEXT_BOTTOM; if (win == self->lgrip) return OB_FRAME_CONTEXT_BLCORNER; if (win == self->rgrip) return OB_FRAME_CONTEXT_BRCORNER; + if (win == self->topresize) return OB_FRAME_CONTEXT_TOP; if (win == self->tltresize) return OB_FRAME_CONTEXT_TLCORNER; if (win == self->tllresize) return OB_FRAME_CONTEXT_TLCORNER; if (win == self->trtresize) return OB_FRAME_CONTEXT_TRCORNER; diff --git a/openbox/frame.h b/openbox/frame.h index ebd8de9..0f56343 100644 --- a/openbox/frame.h +++ b/openbox/frame.h @@ -34,12 +34,13 @@ typedef enum { OB_FRAME_CONTEXT_DESKTOP, OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_TITLEBAR, - OB_FRAME_CONTEXT_HANDLE, OB_FRAME_CONTEXT_FRAME, OB_FRAME_CONTEXT_BLCORNER, OB_FRAME_CONTEXT_BRCORNER, OB_FRAME_CONTEXT_TLCORNER, OB_FRAME_CONTEXT_TRCORNER, + OB_FRAME_CONTEXT_TOP, + OB_FRAME_CONTEXT_BOTTOM, OB_FRAME_CONTEXT_MAXIMIZE, OB_FRAME_CONTEXT_ALLDESKTOPS, OB_FRAME_CONTEXT_SHADE, @@ -95,6 +96,7 @@ struct _ObFrame Window lgrip; Window rgrip; + Window topresize; Window tltresize; Window tllresize; Window trtresize; diff --git a/openbox/framerender.c b/openbox/framerender.c index 97d5ef5..82a98a8 100644 --- a/openbox/framerender.c +++ b/openbox/framerender.c @@ -177,9 +177,16 @@ 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; + ob_rr_theme->a_clear->surface.parentx = ob_rr_theme->grip_width + + self->bwidth; + RrPaint(ob_rr_theme->a_clear, self->topresize, + self->width - (ob_rr_theme->grip_width + self->bwidth) * 2, + ob_rr_theme->paddingy + 1); + + ob_rr_theme->a_clear->surface.parentx = 0; + if (ob_rr_theme->grip_width > 0) RrPaint(ob_rr_theme->a_clear, self->tltresize, ob_rr_theme->grip_width, ob_rr_theme->paddingy + 1); diff --git a/openbox/mouse.c b/openbox/mouse.c index 9ca7987..8b0cfcc 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -65,16 +65,17 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context, case OB_FRAME_CONTEXT_DESKTOP: case OB_FRAME_CONTEXT_CLIENT: case OB_FRAME_CONTEXT_TITLEBAR: - case OB_FRAME_CONTEXT_HANDLE: case OB_FRAME_CONTEXT_FRAME: case OB_FRAME_CONTEXT_MOVE_RESIZE: break; + case OB_FRAME_CONTEXT_BOTTOM: case OB_FRAME_CONTEXT_BLCORNER: case OB_FRAME_CONTEXT_BRCORNER: - x = OB_FRAME_CONTEXT_HANDLE; + x = OB_FRAME_CONTEXT_BOTTOM; break; case OB_FRAME_CONTEXT_TLCORNER: case OB_FRAME_CONTEXT_TRCORNER: + case OB_FRAME_CONTEXT_TOP: case OB_FRAME_CONTEXT_MAXIMIZE: case OB_FRAME_CONTEXT_ALLDESKTOPS: case OB_FRAME_CONTEXT_SHADE: -- 1.9.1