summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-04-21 21:09:09 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-04-21 21:09:09 -0400
commita2cd21cab663a0034214c34682960c12b0ad3393 (patch)
tree77525e516c727533e91a9660299ff5c4571aa481
parent760e60fa0487ded9b053ccd94200582cc24e52db (diff)
downloadgtk+-a2cd21cab663a0034214c34682960c12b0ad3393.tar.gz
window: Tweak resize borders
Make windows resizable in the padding and border area of the css box as well. This naturally makes solid-csd borders work again.
-rw-r--r--gtk/gtkwindow.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 2270690357..bacbb1f920 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1332,10 +1332,10 @@ static void
get_box_border (GtkCssStyle *style,
GtkBorder *border)
{
- border->top = get_number (style->border->border_top_width);
- border->left = get_number (style->border->border_left_width);
- border->bottom = get_number (style->border->border_bottom_width);
- border->right = get_number (style->border->border_right_width);
+ border->top = get_number (style->border->border_top_width) + get_number (style->size->padding_top);
+ border->left = get_number (style->border->border_left_width) + get_number (style->size->padding_left);
+ border->bottom = get_number (style->border->border_bottom_width) + get_number (style->size->padding_bottom);
+ border->right = get_number (style->border->border_right_width) + get_number (style->size->padding_right);
}
static int
@@ -1364,7 +1364,10 @@ get_edge_for_coordinates (GtkWindow *window,
return -1;
gtk_css_boxes_init (&css_boxes, GTK_WIDGET (window));
- border_rect = gtk_css_boxes_get_padding_rect (&css_boxes);
+ border_rect = gtk_css_boxes_get_content_rect (&css_boxes);
+
+ get_box_border (gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (window))),
+ &handle_size);
if (priv->use_client_shadow)
{
@@ -1373,16 +1376,10 @@ get_edge_for_coordinates (GtkWindow *window,
get_shadow_width (window, &shadow);
/* This logic is duplicated in update_realized_window_properties() */
- handle_size.left = MIN (RESIZE_HANDLE_SIZE, shadow.left);
- handle_size.top = MIN (RESIZE_HANDLE_SIZE, shadow.top);
- handle_size.right = MIN (RESIZE_HANDLE_SIZE, shadow.right);
- handle_size.bottom = MIN (RESIZE_HANDLE_SIZE, shadow.bottom);
- }
- else
- {
- /* Use border */
- get_box_border (gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (window))),
- &handle_size);
+ handle_size.left += MIN (RESIZE_HANDLE_SIZE, shadow.left);
+ handle_size.top += MIN (RESIZE_HANDLE_SIZE, shadow.top);
+ handle_size.right += MIN (RESIZE_HANDLE_SIZE, shadow.right);
+ handle_size.bottom += MIN (RESIZE_HANDLE_SIZE, shadow.bottom);
}
left = border_rect->origin.x;
@@ -3976,7 +3973,7 @@ get_shadow_width (GtkWindow *window,
if (!priv->decorated)
goto out;
- if (!priv->client_decorated &&
+ if (!priv->client_decorated ||
!(gtk_window_should_use_csd (window) &&
gtk_window_supports_client_shadow (window)))
goto out;