[Xfce4-commits] [xfce/xfwm4] 02/04: frame: Set the size of the top resize handle
noreply at xfce.org
noreply at xfce.org
Wed May 22 22:17:39 CEST 2019
This is an automated email from the git hooks/post-receive script.
o l i v i e r p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfwm4.
commit 39ef96191273706e8df552117bd2491a329cb68c
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Wed May 22 22:03:26 2019 +0200
frame: Set the size of the top resize handle
Change the newly added “frame_border_top” setting to set the size of
the top resize handle as well.
Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
src/frame.c | 836 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 424 insertions(+), 412 deletions(-)
diff --git a/src/frame.c b/src/frame.c
index 8bac82f..923203b 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -45,43 +45,16 @@ typedef struct
xfwmPixmap pm_sides[SIDE_COUNT];
} FramePixmap;
-int
-frameDecorationLeft (ScreenInfo *screen_info)
-{
- TRACE ("entering");
-
- g_return_val_if_fail (screen_info != NULL, 0);
- return screen_info->sides[SIDE_LEFT][ACTIVE].width;
-}
-
-int
-frameDecorationRight (ScreenInfo *screen_info)
-{
- TRACE ("entering");
-
- g_return_val_if_fail (screen_info != NULL, 0);
- return screen_info->sides[SIDE_RIGHT][ACTIVE].width;
-}
-
-int
-frameDecorationTop (ScreenInfo *screen_info)
-{
- TRACE ("entering");
-
- g_return_val_if_fail (screen_info != NULL, 0);
- return screen_info->title[TITLE_3][ACTIVE].height;
-}
-
-int
-frameDecorationBottom (ScreenInfo *screen_info)
+static int
+frameDecorationBorderTop (ScreenInfo *screen_info)
{
TRACE ("entering");
g_return_val_if_fail (screen_info != NULL, 0);
- return screen_info->sides[SIDE_BOTTOM][ACTIVE].height;
+ return screen_info->params->frame_border_top;
}
-int
+static int
frameBorderTop (Client * c)
{
g_return_val_if_fail (c != NULL, 0);
@@ -92,392 +65,163 @@ frameBorderTop (Client * c)
&& FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
&& (c->screen_info->params->borderless_maximize))
{
- return c->screen_info->params->frame_border_top;
+ return frameDecorationBorderTop (c->screen_info);
}
return 0;
}
-int
-frameLeft (Client * c)
+static int
+frameTopLeftWidth (Client * c, int state)
{
g_return_val_if_fail (c != NULL, 0);
TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
- && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
- && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
- || !(c->screen_info->params->borderless_maximize)))
+ if (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+ && c->screen_info->params->borderless_maximize)
{
- return c->screen_info->sides[SIDE_LEFT][ACTIVE].width;
+ return 0;
}
- return 0;
+ return c->screen_info->corners[CORNER_TOP_LEFT][state].width;
+
}
-int
-frameRight (Client * c)
+static int
+frameTopRightWidth (Client * c, int state)
{
g_return_val_if_fail (c != NULL, 0);
TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
- && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
- && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
- || !(c->screen_info->params->borderless_maximize)))
+ if (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+ && c->screen_info->params->borderless_maximize)
{
- return c->screen_info->sides[SIDE_RIGHT][ACTIVE].width;
+ return 0;
}
- return 0;
+ return c->screen_info->corners[CORNER_TOP_RIGHT][state].width;
}
-int
-frameTop (Client * c)
+static int
+frameButtonOffset (Client *c)
{
g_return_val_if_fail (c != NULL, 0);
TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
- if (CLIENT_HAS_FRAME (c))
+ if (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+ && c->screen_info->params->borderless_maximize)
{
- return frameDecorationTop(c->screen_info) - frameBorderTop (c);
+ return MAX (0, c->screen_info->params->maximized_offset);
}
- return 0;
+ return c->screen_info->params->button_offset;
}
-int
-frameBottom (Client * c)
+static void
+frameFillTitlePixmap (Client * c, int state, int part, int x, int w, int h, xfwmPixmap * title_pm, xfwmPixmap * top_pm)
{
- g_return_val_if_fail (c != NULL, 0);
+ ScreenInfo *screen_info;
+
+ g_return_if_fail (c);
+ g_return_if_fail (title_pm);
+ g_return_if_fail (top_pm);
TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
- && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
- && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
- || !(c->screen_info->params->borderless_maximize)))
+ screen_info = c->screen_info;
+
+ if (!xfwmPixmapNone(&screen_info->top[part][state]))
{
- return c->screen_info->sides[SIDE_BOTTOM][ACTIVE].height;
+ xfwmPixmapFill (&screen_info->top[part][state], top_pm, x, 0, w, h);
}
- return 0;
-}
-
-int
-frameX (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
- && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
- && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
- || !(c->screen_info->params->borderless_maximize)))
+ else
{
- return c->x - frameLeft (c);
+ xfwmPixmapFill (&screen_info->title[part][state], top_pm, x, 0, w, h);
}
- return c->x;
+ xfwmPixmapFill (&screen_info->title[part][state], title_pm, x, 0, w, frameDecorationTop(screen_info));
}
-int
-frameY (Client * c)
+static void
+frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap * title_pm, xfwmPixmap * top_pm)
{
- g_return_val_if_fail (c != NULL, 0);
+ ScreenInfo *screen_info;
+ cairo_surface_t *surface;
+ cairo_t *cr;
+ PangoLayout *layout;
+ PangoRectangle logical_rect;
+ int width, x, hoffset, w1, w2, w3, w4, w5, temp;
+ int voffset, title_x, title_y;
+ int title_height, top_height;
+
+ g_return_if_fail (c);
+ g_return_if_fail (title_pm);
+ g_return_if_fail (top_pm);
TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
- && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
+ screen_info = c->screen_info;
+
+ if (left > right)
{
- return c->y - frameTop (c);
+ temp = left;
+ left = right;
+ right = temp;
}
- return c->y;
-}
-
-int
-frameWidth (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
- && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
- && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
- || !(c->screen_info->params->borderless_maximize)))
+ width = frameWidth (c) - frameTopLeftWidth (c, state) - frameTopRightWidth (c, state);
+ if (width < 1)
{
- return c->width + frameLeft (c) + frameRight (c);
+ return;
}
- return c->width;
-}
-
-int
-frameHeight (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
- && FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)
- && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
+ if (left < frameTopLeftWidth (c, state))
{
- return frameTop (c) + frameBottom (c);
+ left = frameTopLeftWidth (c, state);
}
- else if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
- && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
+ if (right > frameWidth (c) - frameTopRightWidth (c, state))
{
- return c->height + frameTop (c) + frameBottom (c);
+ right = frameWidth (c) - frameTopRightWidth (c, state);
}
- return c->height;
-}
-
-int
-frameExtentLeft (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ if (right < frameTopLeftWidth (c, state))
{
- return -c->frame_extents[SIDE_LEFT];
+ right = frameTopLeftWidth (c, state);
}
- return frameLeft(c);
-}
-int
-frameExtentRight (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+ left = left - frameTopLeftWidth (c, state);
+ right = right - frameTopLeftWidth (c, state);
- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ x = 0;
+ hoffset = 0;
+
+ if (state == ACTIVE)
{
- return -c->frame_extents[SIDE_RIGHT];
+ voffset = screen_info->params->title_vertical_offset_active;
}
- return frameRight(c);
-}
-
-int
-frameExtentTop (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ else
{
- return -c->frame_extents[SIDE_TOP];
+ voffset = screen_info->params->title_vertical_offset_inactive;
}
- return frameTop(c);
-}
-int
-frameExtentBottom (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+ layout = gtk_widget_create_pango_layout (myScreenGetGtkWidget (screen_info), c->name);
+ pango_layout_set_font_description (layout, myScreenGetFontDescription (screen_info));
+ pango_layout_set_auto_dir (layout, FALSE);
+ pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ title_height = screen_info->font_height;
+ if (!title_height)
{
- return -c->frame_extents[SIDE_BOTTOM];
+ /* If for some reason the font height is not known,
+ * use the actual pango layout height.
+ */
+ title_height = logical_rect.height;
}
- return frameBottom(c);
-}
-
-int
-frameExtentX (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ title_y = voffset + (frameDecorationTop(screen_info) - title_height) / 2;
+ if (title_y + title_height > frameDecorationTop(screen_info))
{
- return c->x + c->frame_extents[SIDE_LEFT];
+ title_y = MAX (0, frameDecorationTop(screen_info) - title_height);
}
- return frameX(c);
-}
-int
-frameExtentY (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ if (!xfwmPixmapNone(&screen_info->top[3][ACTIVE]))
{
- return c->y + c->frame_extents[SIDE_TOP];
- }
- return frameY(c);
-}
-
-int
-frameExtentWidth (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
- {
- return MAX (0, c->width - c->frame_extents[SIDE_LEFT]
- - c->frame_extents[SIDE_RIGHT]);
- }
- return frameWidth(c);
-}
-
-int
-frameExtentHeight (Client * c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
- {
- return MAX (0, c->height - c->frame_extents[SIDE_TOP]
- - c->frame_extents[SIDE_BOTTOM]);
- }
- return frameHeight(c);
-}
-
-static int
-frameTopLeftWidth (Client * c, int state)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
- && c->screen_info->params->borderless_maximize)
- {
- return 0;
- }
- return c->screen_info->corners[CORNER_TOP_LEFT][state].width;
-
-}
-
-static int
-frameTopRightWidth (Client * c, int state)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
- && c->screen_info->params->borderless_maximize)
- {
- return 0;
- }
- return c->screen_info->corners[CORNER_TOP_RIGHT][state].width;
-}
-
-static int
-frameButtonOffset (Client *c)
-{
- g_return_val_if_fail (c != NULL, 0);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- if (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
- && c->screen_info->params->borderless_maximize)
- {
- return MAX (0, c->screen_info->params->maximized_offset);
- }
- return c->screen_info->params->button_offset;
-}
-
-static void
-frameFillTitlePixmap (Client * c, int state, int part, int x, int w, int h, xfwmPixmap * title_pm, xfwmPixmap * top_pm)
-{
- ScreenInfo *screen_info;
-
- g_return_if_fail (c);
- g_return_if_fail (title_pm);
- g_return_if_fail (top_pm);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- screen_info = c->screen_info;
-
- if (!xfwmPixmapNone(&screen_info->top[part][state]))
- {
- xfwmPixmapFill (&screen_info->top[part][state], top_pm, x, 0, w, h);
- }
- else
- {
- xfwmPixmapFill (&screen_info->title[part][state], top_pm, x, 0, w, h);
- }
- xfwmPixmapFill (&screen_info->title[part][state], title_pm, x, 0, w, frameDecorationTop(screen_info));
-}
-
-static void
-frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap * title_pm, xfwmPixmap * top_pm)
-{
- ScreenInfo *screen_info;
- cairo_surface_t *surface;
- cairo_t *cr;
- PangoLayout *layout;
- PangoRectangle logical_rect;
- int width, x, hoffset, w1, w2, w3, w4, w5, temp;
- int voffset, title_x, title_y;
- int title_height, top_height;
-
- g_return_if_fail (c);
- g_return_if_fail (title_pm);
- g_return_if_fail (top_pm);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- screen_info = c->screen_info;
-
- if (left > right)
- {
- temp = left;
- left = right;
- right = temp;
- }
-
- width = frameWidth (c) - frameTopLeftWidth (c, state) - frameTopRightWidth (c, state);
- if (width < 1)
- {
- return;
- }
-
- if (left < frameTopLeftWidth (c, state))
- {
- left = frameTopLeftWidth (c, state);
- }
- if (right > frameWidth (c) - frameTopRightWidth (c, state))
- {
- right = frameWidth (c) - frameTopRightWidth (c, state);
- }
- if (right < frameTopLeftWidth (c, state))
- {
- right = frameTopLeftWidth (c, state);
- }
-
- left = left - frameTopLeftWidth (c, state);
- right = right - frameTopLeftWidth (c, state);
-
- x = 0;
- hoffset = 0;
-
- if (state == ACTIVE)
- {
- voffset = screen_info->params->title_vertical_offset_active;
- }
- else
- {
- voffset = screen_info->params->title_vertical_offset_inactive;
- }
-
- layout = gtk_widget_create_pango_layout (myScreenGetGtkWidget (screen_info), c->name);
- pango_layout_set_font_description (layout, myScreenGetFontDescription (screen_info));
- pango_layout_set_auto_dir (layout, FALSE);
- pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
-
- title_height = screen_info->font_height;
- if (!title_height)
- {
- /* If for some reason the font height is not known,
- * use the actual pango layout height.
- */
- title_height = logical_rect.height;
- }
- title_y = voffset + (frameDecorationTop(screen_info) - title_height) / 2;
- if (title_y + title_height > frameDecorationTop(screen_info))
- {
- title_y = MAX (0, frameDecorationTop(screen_info) - title_height);
+ top_height = screen_info->top[3][ACTIVE].height;
}
-
- if (!xfwmPixmapNone(&screen_info->top[3][ACTIVE]))
+ else if (frameDecorationBorderTop(c->screen_info) > 0)
{
- top_height = screen_info->top[3][ACTIVE].height;
+ top_height = frameDecorationBorderTop(c->screen_info);
}
else
{
@@ -962,39 +706,6 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
XShapeCombineShape (display_info->dpy, c->frame, ShapeBounding, 0, 0, screen_info->shape_win, ShapeBounding, ShapeSet);
}
-void
-frameSetShapeInput (Client * c)
-{
- ScreenInfo *screen_info;
- DisplayInfo *display_info;
-
- g_return_if_fail (c != NULL);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
-
- screen_info = c->screen_info;
- display_info = screen_info->display_info;
-
- if (!myDisplayHaveShapeInput(display_info))
- {
- return;
- }
-
- if (screen_info->shape_win == None)
- {
- screen_info->shape_win = XCreateSimpleWindow (display_info->dpy, screen_info->xroot, 0, 0, frameWidth (c), frameHeight (c), 0, 0, 0);
- }
- else
- {
- XResizeWindow (display_info->dpy, screen_info->shape_win, frameWidth (c), frameHeight (c));
- }
-
- /* Set Input shape when using XShape extension 1.1 and later */
- XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, 0, 0, c->frame, ShapeBounding, ShapeSet);
- XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeBounding, ShapeSubtract);
- XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeInput, ShapeUnion);
- XShapeCombineShape(display_info->dpy, c->frame, ShapeInput, 0, 0, screen_info->shape_win, ShapeInput, ShapeSet);
-}
-
static void
frameDrawWin (Client * c)
{
@@ -1349,46 +1060,315 @@ update_frame_idle_cb (gpointer data)
return (FALSE);
}
-void
-frameClearQueueDraw (Client * c)
+int
+frameDecorationLeft (ScreenInfo *screen_info)
{
- g_return_if_fail (c);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+ TRACE ("entering");
- if (c->frame_timeout_id)
- {
- g_source_remove (c->frame_timeout_id);
- c->frame_timeout_id = 0;
- }
+ g_return_val_if_fail (screen_info != NULL, 0);
+ return screen_info->sides[SIDE_LEFT][ACTIVE].width;
}
-void
-frameDraw (Client * c, gboolean clear_all)
+int
+frameDecorationRight (ScreenInfo *screen_info)
{
- g_return_if_fail (c);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+ TRACE ("entering");
- if (clear_all)
- {
- FLAG_SET (c->xfwm_flags, XFWM_FLAG_NEEDS_REDRAW);
- }
- frameDrawWin (c);
+ g_return_val_if_fail (screen_info != NULL, 0);
+ return screen_info->sides[SIDE_RIGHT][ACTIVE].width;
}
-void
-frameQueueDraw (Client * c, gboolean clear_all)
+int
+frameDecorationTop (ScreenInfo *screen_info)
{
- g_return_if_fail (c);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+ TRACE ("entering");
- /* Reschedule update */
- if (c->frame_timeout_id)
- {
- frameClearQueueDraw (c);
- }
- if (clear_all)
- {
- FLAG_SET (c->xfwm_flags, XFWM_FLAG_NEEDS_REDRAW);
+ g_return_val_if_fail (screen_info != NULL, 0);
+ return screen_info->title[TITLE_3][ACTIVE].height;
+}
+
+int
+frameDecorationBottom (ScreenInfo *screen_info)
+{
+ TRACE ("entering");
+
+ g_return_val_if_fail (screen_info != NULL, 0);
+ return screen_info->sides[SIDE_BOTTOM][ACTIVE].height;
+}
+
+int
+frameLeft (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
+ && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
+ && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+ || !(c->screen_info->params->borderless_maximize)))
+ {
+ return c->screen_info->sides[SIDE_LEFT][ACTIVE].width;
+ }
+ return 0;
+}
+
+int
+frameRight (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
+ && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
+ && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+ || !(c->screen_info->params->borderless_maximize)))
+ {
+ return c->screen_info->sides[SIDE_RIGHT][ACTIVE].width;
+ }
+ return 0;
+}
+
+int
+frameTop (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (CLIENT_HAS_FRAME (c))
+ {
+ return frameDecorationTop(c->screen_info) - frameBorderTop (c);
+ }
+ return 0;
+}
+
+int
+frameBottom (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
+ && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
+ && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+ || !(c->screen_info->params->borderless_maximize)))
+ {
+ return c->screen_info->sides[SIDE_BOTTOM][ACTIVE].height;
+ }
+ return 0;
+}
+
+int
+frameX (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
+ && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
+ && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+ || !(c->screen_info->params->borderless_maximize)))
+ {
+ return c->x - frameLeft (c);
+ }
+ return c->x;
+}
+
+int
+frameY (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
+ && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
+ {
+ return c->y - frameTop (c);
+ }
+ return c->y;
+}
+
+int
+frameWidth (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
+ && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
+ && (!FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
+ || !(c->screen_info->params->borderless_maximize)))
+ {
+ return c->width + frameLeft (c) + frameRight (c);
+ }
+ return c->width;
+}
+
+int
+frameHeight (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
+ && FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)
+ && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
+ {
+ return frameTop (c) + frameBottom (c);
+ }
+ else if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
+ && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
+ {
+ return c->height + frameTop (c) + frameBottom (c);
+ }
+ return c->height;
+}
+
+int
+frameExtentLeft (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ {
+ return -c->frame_extents[SIDE_LEFT];
+ }
+ return frameLeft(c);
+}
+
+int
+frameExtentRight (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ {
+ return -c->frame_extents[SIDE_RIGHT];
+ }
+ return frameRight(c);
+}
+
+int
+frameExtentTop (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ {
+ return -c->frame_extents[SIDE_TOP];
+ }
+ return frameTop(c);
+}
+
+int
+frameExtentBottom (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ {
+ return -c->frame_extents[SIDE_BOTTOM];
+ }
+ return frameBottom(c);
+}
+
+int
+frameExtentX (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ {
+ return c->x + c->frame_extents[SIDE_LEFT];
+ }
+ return frameX(c);
+}
+
+int
+frameExtentY (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ {
+ return c->y + c->frame_extents[SIDE_TOP];
+ }
+ return frameY(c);
+}
+
+int
+frameExtentWidth (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ {
+ return MAX (0, c->width - c->frame_extents[SIDE_LEFT]
+ - c->frame_extents[SIDE_RIGHT]);
+ }
+ return frameWidth(c);
+}
+
+int
+frameExtentHeight (Client * c)
+{
+ g_return_val_if_fail (c != NULL, 0);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_FRAME_EXTENTS))
+ {
+ return MAX (0, c->height - c->frame_extents[SIDE_TOP]
+ - c->frame_extents[SIDE_BOTTOM]);
+ }
+ return frameHeight(c);
+}
+
+void
+frameClearQueueDraw (Client * c)
+{
+ g_return_if_fail (c);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (c->frame_timeout_id)
+ {
+ g_source_remove (c->frame_timeout_id);
+ c->frame_timeout_id = 0;
+ }
+}
+
+void
+frameDraw (Client * c, gboolean clear_all)
+{
+ g_return_if_fail (c);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ if (clear_all)
+ {
+ FLAG_SET (c->xfwm_flags, XFWM_FLAG_NEEDS_REDRAW);
+ }
+ frameDrawWin (c);
+}
+
+void
+frameQueueDraw (Client * c, gboolean clear_all)
+{
+ g_return_if_fail (c);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ /* Reschedule update */
+ if (c->frame_timeout_id)
+ {
+ frameClearQueueDraw (c);
+ }
+ if (clear_all)
+ {
+ FLAG_SET (c->xfwm_flags, XFWM_FLAG_NEEDS_REDRAW);
}
/* Otherwise leave previous schedule */
if (c->frame_timeout_id == 0)
@@ -1398,3 +1378,35 @@ frameQueueDraw (Client * c, gboolean clear_all)
}
}
+void
+frameSetShapeInput (Client * c)
+{
+ ScreenInfo *screen_info;
+ DisplayInfo *display_info;
+
+ g_return_if_fail (c != NULL);
+ TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
+
+ screen_info = c->screen_info;
+ display_info = screen_info->display_info;
+
+ if (!myDisplayHaveShapeInput(display_info))
+ {
+ return;
+ }
+
+ if (screen_info->shape_win == None)
+ {
+ screen_info->shape_win = XCreateSimpleWindow (display_info->dpy, screen_info->xroot, 0, 0, frameWidth (c), frameHeight (c), 0, 0, 0);
+ }
+ else
+ {
+ XResizeWindow (display_info->dpy, screen_info->shape_win, frameWidth (c), frameHeight (c));
+ }
+
+ /* Set Input shape when using XShape extension 1.1 and later */
+ XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, 0, 0, c->frame, ShapeBounding, ShapeSet);
+ XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeBounding, ShapeSubtract);
+ XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeInput, ShapeUnion);
+ XShapeCombineShape(display_info->dpy, c->frame, ShapeInput, 0, 0, screen_info->shape_win, ShapeInput, ShapeSet);
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list