[gtk/wip/baedert/single-node-window: 24/24] /o\
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/single-node-window: 24/24] /o\
- Date: Tue, 19 May 2020 06:41:06 +0000 (UTC)
commit b9d314e1595170b4c397164fb0c1b0bf6c310d1a
Author: Timm Bäder <mail baedert org>
Date: Sat May 2 18:50:53 2020 +0200
/o\
gtk/gtkdialog.c | 4 +-
gtk/gtkmessagedialog.c | 4 +-
gtk/gtkwidget.c | 35 +-
gtk/gtkwindow.c | 780 +++++++++++++++++------------------------
gtk/gtkwindowprivate.h | 7 -
gtk/inspector/layoutoverlay.c | 6 -
gtk/theme/Adwaita/_common.scss | 64 ++--
tests/testwidgetfocus.c | 2 +-
8 files changed, 373 insertions(+), 529 deletions(-)
---
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index f5c401311a..45dc729757 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -555,8 +555,6 @@ gtk_dialog_class_init (GtkDialogClass *class)
gtk_widget_class_bind_template_child_internal_private (widget_class, GtkDialog, action_area);
gtk_widget_class_bind_template_child_internal_private (widget_class, GtkDialog, content_area);
gtk_widget_class_bind_template_child_private (widget_class, GtkDialog, action_box);
-
- gtk_widget_class_set_css_name (widget_class, I_("dialog"));
}
static void
@@ -564,7 +562,7 @@ gtk_dialog_init (GtkDialog *dialog)
{
GtkDialogPrivate *priv = gtk_dialog_get_instance_private (dialog);
- priv = gtk_dialog_get_instance_private (dialog);
+ gtk_widget_add_css_class (GTK_WIDGET (dialog), "dialog");
priv->use_header_bar = -1;
priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c
index 0d8636a016..b3c9278146 100644
--- a/gtk/gtkmessagedialog.c
+++ b/gtk/gtkmessagedialog.c
@@ -253,8 +253,6 @@ gtk_message_dialog_class_init (GtkMessageDialogClass *class)
gtk_widget_class_bind_template_child_private (widget_class, GtkMessageDialog, label);
gtk_widget_class_bind_template_child_private (widget_class, GtkMessageDialog, secondary_label);
gtk_widget_class_bind_template_child_internal_private (widget_class, GtkMessageDialog, message_area);
-
- gtk_widget_class_set_css_name (widget_class, I_("messagedialog"));
}
static void
@@ -271,6 +269,8 @@ gtk_message_dialog_init (GtkMessageDialog *dialog)
priv->has_secondary_text = FALSE;
priv->message_type = GTK_MESSAGE_OTHER;
+ gtk_widget_add_css_class (GTK_WIDGET (dialog), "message");
+
gtk_widget_init_template (GTK_WIDGET (dialog));
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
gtk_widget_set_halign (action_area, GTK_ALIGN_FILL);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 509bfe860c..d3fa17d7f7 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3447,7 +3447,7 @@ gtk_widget_get_surface_allocation (GtkWidget *widget,
{
GtkWidget *parent;
graphene_rect_t bounds;
- double nx, ny;
+ double native_x, native_y;
/* Don't consider the parent == widget case here. */
parent = _gtk_widget_get_parent (widget);
@@ -3455,13 +3455,13 @@ gtk_widget_get_surface_allocation (GtkWidget *widget,
parent = _gtk_widget_get_parent (parent);
g_assert (GTK_IS_WINDOW (parent) || GTK_IS_POPOVER (parent));
- gtk_native_get_surface_transform (GTK_NATIVE (parent), &nx, &ny);
+ gtk_native_get_surface_transform (GTK_NATIVE (parent), &native_x, &native_y);
if (gtk_widget_compute_bounds (widget, parent, &bounds))
{
*allocation = (GtkAllocation){
- floorf (bounds.origin.x) + nx,
- floorf (bounds.origin.y) + ny,
+ floorf (bounds.origin.x) + native_x,
+ floorf (bounds.origin.y) + native_y,
ceilf (bounds.size.width),
ceilf (bounds.size.height)
};
@@ -4551,8 +4551,6 @@ translate_event_coordinates (GdkEvent *event,
GtkWidget *event_widget;
graphene_point_t p;
double event_x, event_y;
- GtkNative *native;
- double nx, ny;
*x = *y = 0;
@@ -4560,17 +4558,23 @@ translate_event_coordinates (GdkEvent *event,
return FALSE;
event_widget = gtk_get_event_widget (event);
- native = gtk_widget_get_native (event_widget);
- gtk_native_get_surface_transform (native, &nx, &ny);
- event_x -= nx;
- event_y -= ny;
-
if (!gtk_widget_compute_point (event_widget,
widget,
&GRAPHENE_POINT_INIT (event_x, event_y),
&p))
return FALSE;
+ /* POAH */
+ if (G_LIKELY (GTK_IS_NATIVE (event_widget)))
+ {
+ double transform_x, transform_y;
+
+ gtk_native_get_surface_transform (GTK_NATIVE (event_widget), &transform_x, &transform_y);
+
+ p.x -= transform_x;
+ p.y -= transform_y;
+ }
+
*x = p.x;
*y = p.y;
@@ -11651,10 +11655,10 @@ gtk_widget_render (GtkWidget *widget,
GdkSurface *surface,
const cairo_region_t *region)
{
+ GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GtkSnapshot *snapshot;
GskRenderer *renderer;
GskRenderNode *root;
- double x, y;
gint64 before_snapshot = g_get_monotonic_time ();
gint64 before_render = 0;
@@ -11666,9 +11670,12 @@ gtk_widget_render (GtkWidget *widget,
return;
snapshot = gtk_snapshot_new ();
- gtk_native_get_surface_transform (GTK_NATIVE (widget), &x, &y);
- gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
+
+ gtk_snapshot_save (snapshot);
+ gtk_snapshot_transform (snapshot, priv->transform);
gtk_widget_snapshot (widget, snapshot);
+ gtk_snapshot_restore (snapshot);
+
root = gtk_snapshot_free_to_node (snapshot);
if (GDK_PROFILER_IS_RUNNING)
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 1e83c9ee23..fb4e3a0487 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -51,14 +51,13 @@
#include "gtkpointerfocusprivate.h"
#include "gtkprivate.h"
#include "gtkroot.h"
-#include "gtknative.h"
+#include "gtknativeprivate.h"
#include "gtksettings.h"
#include "gtkshortcut.h"
#include "gtkshortcutcontroller.h"
#include "gtkshortcutmanager.h"
#include "gtkshortcuttrigger.h"
#include "gtksnapshot.h"
-#include "gtkstylecontextprivate.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
#include "gtkwindowgroup.h"
@@ -246,8 +245,6 @@ typedef struct
GdkSurface *surface;
GskRenderer *renderer;
- cairo_region_t *extra_input_region;
-
GList *foci;
GtkConstraintSolver *constraint_solver;
@@ -518,9 +515,6 @@ static void gtk_window_native_interface_init (GtkNativeInterface *
static void ensure_state_flag_backdrop (GtkWidget *widget);
static void unset_titlebar (GtkWindow *window);
-static GtkWindowRegion get_active_region_type (GtkWindow *window,
- gint x,
- gint y);
G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_WIDGET,
@@ -738,6 +732,7 @@ gtk_window_class_init (GtkWindowClass *klass)
widget_class->move_focus = gtk_window_move_focus;
widget_class->measure = gtk_window_measure;
widget_class->css_changed = gtk_window_css_changed;
+ /*widget_class->contains = gtk_window_contains;*/
klass->activate_default = gtk_window_real_activate_default;
klass->activate_focus = gtk_window_real_activate_focus;
@@ -1186,6 +1181,142 @@ gtk_window_close (GtkWindow *window)
g_object_unref (window);
}
+static guint
+constraints_for_edge (GdkSurfaceEdge edge)
+{
+ switch (edge)
+ {
+ case GDK_SURFACE_EDGE_NORTH_WEST:
+ return GDK_SURFACE_STATE_LEFT_RESIZABLE | GDK_SURFACE_STATE_TOP_RESIZABLE;
+ case GDK_SURFACE_EDGE_NORTH:
+ return GDK_SURFACE_STATE_TOP_RESIZABLE;
+ case GDK_SURFACE_EDGE_NORTH_EAST:
+ return GDK_SURFACE_STATE_RIGHT_RESIZABLE | GDK_SURFACE_STATE_TOP_RESIZABLE;
+ case GDK_SURFACE_EDGE_WEST:
+ return GDK_SURFACE_STATE_LEFT_RESIZABLE;
+ case GDK_SURFACE_EDGE_EAST:
+ return GDK_SURFACE_STATE_RIGHT_RESIZABLE;
+ case GDK_SURFACE_EDGE_SOUTH_WEST:
+ return GDK_SURFACE_STATE_LEFT_RESIZABLE | GDK_SURFACE_STATE_BOTTOM_RESIZABLE;
+ case GDK_SURFACE_EDGE_SOUTH:
+ return GDK_SURFACE_STATE_BOTTOM_RESIZABLE;
+ case GDK_SURFACE_EDGE_SOUTH_EAST:
+ return GDK_SURFACE_STATE_RIGHT_RESIZABLE | GDK_SURFACE_STATE_BOTTOM_RESIZABLE;
+ default:
+ g_warn_if_reached ();
+ return 0;
+ }
+}
+
+static gint
+get_number (GtkCssValue *value)
+{
+ double d = _gtk_css_number_value_get (value, 100);
+
+ if (d < 1)
+ return ceil (d);
+ else
+ return floor (d);
+}
+
+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);
+}
+
+static int
+get_edge_for_coordinates (GtkWindow *window,
+ double x,
+ double y)
+{
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+ gboolean supports_edge_constraints;
+ GtkBorder handle_size;
+ GtkCssBoxes css_boxes;
+ const graphene_rect_t *border_rect;
+ float left, top;
+
+#define edge_or_minus_one(edge) ((supports_edge_constraints && (priv->edge_constraints &
constraints_for_edge (edge)) != constraints_for_edge (edge)) ? -1 : edge)
+
+ if (!priv->client_decorated ||
+ !priv->resizable ||
+ priv->fullscreen ||
+ priv->maximized)
+ return -1;
+
+ supports_edge_constraints = gdk_toplevel_supports_edge_constraints (GDK_TOPLEVEL (priv->surface));
+
+ if (!supports_edge_constraints && priv->tiled)
+ return -1;
+
+ gtk_css_boxes_init (&css_boxes, GTK_WIDGET (window));
+ border_rect = gtk_css_boxes_get_padding_rect (&css_boxes);
+
+ if (priv->use_client_shadow)
+ {
+ /* We use a maximum of RESIZE_HANDLE_SIZE pixels for the handle size */
+ GtkBorder shadow;
+
+ 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);
+ }
+
+ left = border_rect->origin.x;
+ top = border_rect->origin.y;
+
+ if (x < left && x >= left - handle_size.left)
+ {
+ if (y < top && y >= top - handle_size.top)
+ return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST);
+
+ if (y > top + border_rect->size.height &&
+ y <= top + border_rect->size.height + handle_size.bottom)
+ return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST);
+
+ return edge_or_minus_one (GDK_SURFACE_EDGE_WEST);
+ }
+ else if (x > left + border_rect->size.width &&
+ x <= left + border_rect->size.width + handle_size.right)
+ {
+ if (y < top && y >= top - handle_size.top)
+ return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST);
+
+ if (y > top + border_rect->size.height &&
+ y <= top + border_rect->size.height + handle_size.bottom)
+ return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST);
+
+ return edge_or_minus_one (GDK_SURFACE_EDGE_EAST);
+ }
+
+ if (y < top && y >= top - handle_size.top)
+ {
+ /* NORTH_EAST is handled elsewhere */
+ return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH);
+ }
+ else if (y > top + border_rect->size.height &&
+ y <= top + border_rect->size.height + handle_size.bottom)
+ {
+ return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH);
+ }
+
+ return -1;
+}
+
static void
click_gesture_pressed_cb (GtkGestureClick *gesture,
gint n_press,
@@ -1200,6 +1331,7 @@ click_gesture_pressed_cb (GtkGestureClick *gesture,
GdkDevice *device;
guint button;
double tx, ty;
+ int edge;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
@@ -1218,11 +1350,16 @@ click_gesture_pressed_cb (GtkGestureClick *gesture,
if (gdk_display_device_is_grabbed (gtk_widget_get_display (GTK_WIDGET (window)), device))
return;
- region = get_active_region_type (window, x, y);
+ if (!priv->client_decorated)
+ return;
+
+ edge = get_edge_for_coordinates (window, x, y);
- if (region == GTK_WINDOW_REGION_CONTENT)
+ if (edge == -1)
return;
+ region = (GtkWindowRegion)edge;
+
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
gdk_event_get_position (event, &tx, &ty);
@@ -1262,182 +1399,30 @@ device_removed_cb (GdkSeat *seat,
}
}
-static guint
-constraints_for_edge (GdkSurfaceEdge edge)
-{
- switch (edge)
- {
- case GDK_SURFACE_EDGE_NORTH_WEST:
- return GDK_SURFACE_STATE_LEFT_RESIZABLE | GDK_SURFACE_STATE_TOP_RESIZABLE;
- case GDK_SURFACE_EDGE_NORTH:
- return GDK_SURFACE_STATE_TOP_RESIZABLE;
- case GDK_SURFACE_EDGE_NORTH_EAST:
- return GDK_SURFACE_STATE_RIGHT_RESIZABLE | GDK_SURFACE_STATE_TOP_RESIZABLE;
- case GDK_SURFACE_EDGE_WEST:
- return GDK_SURFACE_STATE_LEFT_RESIZABLE;
- case GDK_SURFACE_EDGE_EAST:
- return GDK_SURFACE_STATE_RIGHT_RESIZABLE;
- case GDK_SURFACE_EDGE_SOUTH_WEST:
- return GDK_SURFACE_STATE_LEFT_RESIZABLE | GDK_SURFACE_STATE_BOTTOM_RESIZABLE;
- case GDK_SURFACE_EDGE_SOUTH:
- return GDK_SURFACE_STATE_BOTTOM_RESIZABLE;
- case GDK_SURFACE_EDGE_SOUTH_EAST:
- return GDK_SURFACE_STATE_RIGHT_RESIZABLE | GDK_SURFACE_STATE_BOTTOM_RESIZABLE;
- default:
- g_warn_if_reached ();
- return 0;
- }
-}
-
-static gboolean
-edge_under_coordinates (GtkWindow *window,
- gint x,
- gint y,
- GdkSurfaceEdge edge)
-{
- GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
- GtkAllocation allocation;
- GtkStyleContext *context;
- gint handle_v, handle_h;
- GtkBorder border;
- gboolean supports_edge_constraints;
- guint constraints;
-
- if (!priv->client_decorated ||
- !priv->resizable ||
- priv->fullscreen ||
- priv->maximized)
- return FALSE;
-
- supports_edge_constraints = gdk_toplevel_supports_edge_constraints (GDK_TOPLEVEL (priv->surface));
- constraints = constraints_for_edge (edge);
-
- if (!supports_edge_constraints && priv->tiled)
- return FALSE;
-
- if (supports_edge_constraints &&
- (priv->edge_constraints & constraints) != constraints)
- return FALSE;
-
- gtk_widget_get_allocation (GTK_WIDGET (window), &allocation);
- context = _gtk_widget_get_style_context (GTK_WIDGET (window));
- /*gtk_style_context_save_to_node (context, priv->decoration_node);*/
-
- if (priv->use_client_shadow)
- {
- handle_h = MIN (RESIZE_HANDLE_SIZE, allocation.width / 2);
- handle_v = MIN (RESIZE_HANDLE_SIZE, allocation.height / 2);
- get_shadow_width (window, &border);
- }
- else
- {
- handle_h = 0;
- handle_v = 0;
- gtk_style_context_get_padding (context, &border);
- }
-
- /*gtk_style_context_restore (context);*/
-
- /* Check whether the click falls outside the handle area */
- if (x >= allocation.x + border.left &&
- x < allocation.x + allocation.width - border.right &&
- y >= allocation.y + border.top &&
- y < allocation.y + allocation.height - border.bottom)
- return FALSE;
-
- /* Check X axis */
- if (x < allocation.x + border.left + handle_h)
- {
- if (edge != GDK_SURFACE_EDGE_NORTH_WEST &&
- edge != GDK_SURFACE_EDGE_WEST &&
- edge != GDK_SURFACE_EDGE_SOUTH_WEST &&
- edge != GDK_SURFACE_EDGE_NORTH &&
- edge != GDK_SURFACE_EDGE_SOUTH)
- return FALSE;
-
- if ((edge == GDK_SURFACE_EDGE_NORTH ||
- edge == GDK_SURFACE_EDGE_SOUTH) &&
- (priv->edge_constraints & constraints_for_edge (GDK_SURFACE_EDGE_WEST)))
- return FALSE;
- }
- else if (x >= allocation.x + allocation.width - border.right - handle_h)
- {
- if (edge != GDK_SURFACE_EDGE_NORTH_EAST &&
- edge != GDK_SURFACE_EDGE_EAST &&
- edge != GDK_SURFACE_EDGE_SOUTH_EAST &&
- edge != GDK_SURFACE_EDGE_NORTH &&
- edge != GDK_SURFACE_EDGE_SOUTH)
- return FALSE;
-
- if ((edge == GDK_SURFACE_EDGE_NORTH ||
- edge == GDK_SURFACE_EDGE_SOUTH) &&
- (priv->edge_constraints & constraints_for_edge (GDK_SURFACE_EDGE_EAST)))
- return FALSE;
- }
- else if (edge != GDK_SURFACE_EDGE_NORTH &&
- edge != GDK_SURFACE_EDGE_SOUTH)
- return FALSE;
-
- /* Check Y axis */
- if (y < allocation.y + border.top + handle_v)
- {
- if (edge != GDK_SURFACE_EDGE_NORTH_WEST &&
- edge != GDK_SURFACE_EDGE_NORTH &&
- edge != GDK_SURFACE_EDGE_NORTH_EAST &&
- edge != GDK_SURFACE_EDGE_EAST &&
- edge != GDK_SURFACE_EDGE_WEST)
- return FALSE;
-
- if ((edge == GDK_SURFACE_EDGE_EAST ||
- edge == GDK_SURFACE_EDGE_WEST) &&
- (priv->edge_constraints & constraints_for_edge (GDK_SURFACE_EDGE_NORTH)))
- return FALSE;
- }
- else if (y > allocation.y + allocation.height - border.bottom - handle_v)
- {
- if (edge != GDK_SURFACE_EDGE_SOUTH_WEST &&
- edge != GDK_SURFACE_EDGE_SOUTH &&
- edge != GDK_SURFACE_EDGE_SOUTH_EAST &&
- edge != GDK_SURFACE_EDGE_EAST &&
- edge != GDK_SURFACE_EDGE_WEST)
- return FALSE;
-
- if ((edge == GDK_SURFACE_EDGE_EAST ||
- edge == GDK_SURFACE_EDGE_WEST) &&
- (priv->edge_constraints & constraints_for_edge (GDK_SURFACE_EDGE_SOUTH)))
- return FALSE;
- }
- else if (edge != GDK_SURFACE_EDGE_WEST &&
- edge != GDK_SURFACE_EDGE_EAST)
- return FALSE;
-
- return TRUE;
-}
-
static void
gtk_window_capture_motion (GtkWidget *widget,
- gdouble x,
- gdouble y)
+ double x,
+ double y)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
- gint i;
- const gchar *cursor_names[8] = {
+ const char *cursor_names[8] = {
"nw-resize", "n-resize", "ne-resize",
"w-resize", "e-resize",
"sw-resize", "s-resize", "se-resize"
};
+ int edge;
+
+ edge = get_edge_for_coordinates (window, x, y);
+ if (edge != -1 &&
+ priv->resize_cursor &&
+ strcmp (gdk_cursor_get_name (priv->resize_cursor), cursor_names[edge]) == 0)
+ return;
g_clear_object (&priv->resize_cursor);
- for (i = 0; i < 8; i++)
- {
- if (edge_under_coordinates (GTK_WINDOW (widget), x, y, i))
- {
- priv->resize_cursor = gdk_cursor_new_from_name (cursor_names[i], NULL);
- break;
- }
- }
+ if (edge != -1)
+ priv->resize_cursor = gdk_cursor_new_from_name (cursor_names[edge], NULL);
gtk_window_maybe_update_cursor (window, widget, NULL);
}
@@ -1499,6 +1484,8 @@ gtk_window_init (GtkWindow *window)
widget = GTK_WIDGET (window);
+ gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN);
+
priv->title = NULL;
priv->geometry_info = NULL;
priv->focus_widget = NULL;
@@ -1896,11 +1883,15 @@ gtk_window_native_get_surface_transform (GtkNative *native,
double *y)
{
GtkBorder shadow;
+ GtkCssBoxes css_boxes;
+ const graphene_rect_t *margin_rect;
get_shadow_width (GTK_WINDOW (native), &shadow);
+ gtk_css_boxes_init (&css_boxes, GTK_WIDGET (native));
+ margin_rect = gtk_css_boxes_get_margin_rect (&css_boxes);
- *x = shadow.left;
- *y = shadow.right;
+ *x = shadow.left - margin_rect->origin.x;
+ *y = shadow.top - margin_rect->origin.y;
}
static void
@@ -3689,7 +3680,6 @@ gtk_window_finalize (GObject *object)
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GdkSeat *seat;
- g_clear_pointer (&priv->extra_input_region, cairo_region_destroy);
g_free (priv->title);
gtk_window_release_application (window);
@@ -4156,136 +4146,33 @@ check_scale_changed (GtkWindow *window)
_gtk_widget_scale_changed (widget);
}
-static void
-sum_borders (GtkBorder *one,
- GtkBorder *two)
-{
- one->top += two->top;
- one->right += two->right;
- one->bottom += two->bottom;
- one->left += two->left;
-}
-
-static void
-max_borders (GtkBorder *one,
- GtkBorder *two)
-{
- one->top = MAX (one->top, two->top);
- one->right = MAX (one->right, two->right);
- one->bottom = MAX (one->bottom, two->bottom);
- one->left = MAX (one->left, two->left);
-}
-
-static void
-subtract_borders (GtkBorder *one,
- GtkBorder *two)
-{
- one->top -= two->top;
- one->right -= two->right;
- one->bottom -= two->bottom;
- one->left -= two->left;
-}
-
static void
get_shadow_width (GtkWindow *window,
GtkBorder *shadow_width)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
- GtkBorder border = { 0 };
- GtkBorder d = { 0 };
- GtkBorder margin;
- GtkStyleContext *context;
- GtkCssValue *shadows;
-
- *shadow_width = border;
+ GtkCssStyle *style;
if (!priv->decorated)
- return;
+ goto out;
if (!priv->client_decorated &&
!(gtk_window_should_use_csd (window) &&
gtk_window_supports_client_shadow (window)))
- return;
+ goto out;
if (priv->maximized ||
priv->fullscreen)
- return;
-
- context = _gtk_widget_get_style_context (GTK_WIDGET (window));
+ goto out;
- /* Always sum border + padding */
- gtk_style_context_get_border (context, &border);
- gtk_style_context_get_padding (context, &d);
- sum_borders (&d, &border);
+ style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (window)));
/* Calculate the size of the drop shadows ... */
- shadows = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BOX_SHADOW);
- gtk_css_shadow_value_get_extents (shadows, &border);
+ gtk_css_shadow_value_get_extents (style->background->box_shadow, shadow_width);
+ return;
- /* ... and compare it to the margin size, which we use for resize grips */
- gtk_style_context_get_margin (context, &margin);
- max_borders (&border, &margin);
-
- sum_borders (&d, &border);
- *shadow_width = d;
-}
-
-static void
-update_csd_shape (GtkWindow *window)
-{
- GtkWidget *widget = (GtkWidget *)window;
- GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
- cairo_rectangle_int_t rect;
- GtkBorder border, tmp;
- GtkBorder window_border;
- GtkStyleContext *context;
-
- if (!priv->client_decorated)
- return;
-
- context = _gtk_widget_get_style_context (widget);
-
- /*gtk_style_context_save_to_node (context, priv->decoration_node);*/
- gtk_style_context_get_margin (context, &border);
- gtk_style_context_get_border (context, &tmp);
- sum_borders (&border, &tmp);
- gtk_style_context_get_padding (context, &tmp);
- sum_borders (&border, &tmp);
- /*gtk_style_context_restore (context);*/
- get_shadow_width (window, &window_border);
-
- /* update the input shape, which makes it so that clicks
- * outside the border windows go through.
- */
-
- subtract_borders (&window_border, &border);
-
- rect.x = window_border.left;
- rect.y = window_border.top;
- rect.width = gtk_widget_get_allocated_width (widget) - window_border.left - window_border.right;
- rect.height = gtk_widget_get_allocated_height (widget) - window_border.top - window_border.bottom;
-
- if (rect.width > 0 && rect.height > 0)
- {
- cairo_region_t *region = cairo_region_create_rectangle (&rect);
-
- if (priv->extra_input_region)
- cairo_region_intersect (region, priv->extra_input_region);
-
- gdk_surface_set_input_region (priv->surface, region);
- cairo_region_destroy (region);
- }
-}
-
-void
-gtk_window_set_extra_input_region (GtkWindow *window,
- cairo_region_t *region)
-{
- GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
-
- g_clear_pointer (&priv->extra_input_region, cairo_region_destroy);
- priv->extra_input_region = cairo_region_copy (region);
- update_csd_shape (window);
+out:
+ *shadow_width = (GtkBorder) {0, 0, 0, 0};
}
static void
@@ -4299,7 +4186,7 @@ corner_rect (cairo_rectangle_int_t *rect,
static void
subtract_decoration_corners_from_region (cairo_region_t *region,
cairo_rectangle_int_t *extents,
- GtkStyleContext *context,
+ GtkCssStyle *style,
GtkWindow *window)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
@@ -4311,64 +4198,67 @@ subtract_decoration_corners_from_region (cairo_region_t *region,
priv->maximized)
return;
- /*gtk_style_context_save_to_node (context, priv->decoration_node);*/
-
- corner_rect (&rect, _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS));
+ corner_rect (&rect, style->border->border_top_left_radius);
rect.x = extents->x;
rect.y = extents->y;
cairo_region_subtract_rectangle (region, &rect);
- corner_rect (&rect, _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS));
+ corner_rect (&rect, style->border->border_top_right_radius);
rect.x = extents->x + extents->width - rect.width;
rect.y = extents->y;
cairo_region_subtract_rectangle (region, &rect);
- corner_rect (&rect, _gtk_style_context_peek_property (context,
GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS));
+ corner_rect (&rect, style->border->border_bottom_left_radius);
rect.x = extents->x;
rect.y = extents->y + extents->height - rect.height;
cairo_region_subtract_rectangle (region, &rect);
- corner_rect (&rect, _gtk_style_context_peek_property (context,
GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS));
+ corner_rect (&rect, style->border->border_bottom_right_radius);
rect.x = extents->x + extents->width - rect.width;
rect.y = extents->y + extents->height - rect.height;
cairo_region_subtract_rectangle (region, &rect);
-
- /*gtk_style_context_restore (context);*/
}
static void
-update_opaque_region (GtkWindow *window,
- const GtkBorder *border,
- const GtkAllocation *allocation)
+update_opaque_region (GtkWindow *window,
+ const GtkBorder *shadow)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *widget = GTK_WIDGET (window);
cairo_region_t *opaque_region;
- GtkStyleContext *context;
gboolean is_opaque = FALSE;
+ GtkCssStyle *style;
if (!_gtk_widget_get_realized (widget))
- return;
+ return;
- context = gtk_widget_get_style_context (widget);
+ style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (window)));
- is_opaque = gdk_rgba_is_opaque (gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context,
GTK_CSS_PROPERTY_BACKGROUND_COLOR)));
+ is_opaque = gdk_rgba_is_opaque (gtk_css_color_value_get_rgba (style->background->background_color));
- if (gtk_widget_get_opacity (widget) < 1.0)
+ if (is_opaque && gtk_widget_get_opacity (widget) < 1.0)
is_opaque = FALSE;
if (is_opaque)
{
cairo_rectangle_int_t rect;
+ GtkCssBoxes css_boxes;
+ const graphene_rect_t *border_rect;
+ double native_x, native_y;
+
+ gtk_native_get_surface_transform (GTK_NATIVE (window), &native_x, &native_y);
- rect.x = border->left;
- rect.y = border->top;
- rect.width = allocation->width - border->left - border->right;
- rect.height = allocation->height - border->top - border->bottom;
+ gtk_css_boxes_init (&css_boxes, widget);
+ border_rect = gtk_css_boxes_get_border_rect (&css_boxes);
+
+ rect.x = native_x + border_rect->origin.x;
+ rect.y = native_y + border_rect->origin.y;
+ rect.width = border_rect->size.width;
+ rect.height = border_rect->size.height;
opaque_region = cairo_region_create_rectangle (&rect);
- subtract_decoration_corners_from_region (opaque_region, &rect, context, window);
+ subtract_decoration_corners_from_region (opaque_region, &rect, style, window);
}
else
{
@@ -4381,21 +4271,51 @@ update_opaque_region (GtkWindow *window,
}
static void
-update_realized_window_properties (GtkWindow *window,
- GtkAllocation *child_allocation,
- GtkBorder *window_border)
+update_realized_window_properties (GtkWindow *window)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
+ GtkBorder shadow;
+ GtkBorder resize_handle;
+ GdkRectangle rect;
+ GtkCssBoxes css_boxes;
+ const graphene_rect_t *border_rect;
+ double native_x, native_y;
+
+ get_shadow_width (window, &shadow);
+ update_opaque_region (window, &shadow);
+
+ if (!priv->client_decorated)
+ return;
- if (priv->surface && priv->client_decorated && priv->use_client_shadow)
+ if (priv->surface && priv->use_client_shadow)
gdk_surface_set_shadow_width (priv->surface,
- window_border->left,
- window_border->right,
- window_border->top,
- window_border->bottom);
+ shadow.left, shadow.right, shadow.top, shadow.bottom);
+
+ gtk_native_get_surface_transform (GTK_NATIVE (window), &native_x, &native_y);
- update_opaque_region (window, window_border, child_allocation);
- update_csd_shape (window);
+ /* update the input shape, which makes it so that clicks
+ * outside the border windows go through. */
+ gtk_css_boxes_init (&css_boxes, GTK_WIDGET (window));
+ border_rect = gtk_css_boxes_get_border_rect (&css_boxes);
+
+ /* This logic is duplicated in get_edge_for_coordinates() */
+ resize_handle.left = MIN (shadow.left, RESIZE_HANDLE_SIZE);
+ resize_handle.top = MIN (shadow.top, RESIZE_HANDLE_SIZE);
+ resize_handle.right = MIN (shadow.right, RESIZE_HANDLE_SIZE);
+ resize_handle.bottom = MIN (shadow.bottom, RESIZE_HANDLE_SIZE);
+
+ rect.x = native_x + border_rect->origin.x - resize_handle.left;
+ rect.y = native_y + border_rect->origin.y - resize_handle.top;
+ rect.width = border_rect->size.width + resize_handle.left + resize_handle.right;
+ rect.height = border_rect->size.height + resize_handle.top + resize_handle.bottom;
+
+ if (rect.width > 0 && rect.height > 0)
+ {
+ cairo_region_t *region = cairo_region_create_rectangle (&rect);
+
+ gdk_surface_set_input_region (priv->surface, region);
+ cairo_region_destroy (region);
+ }
}
static void
@@ -4404,7 +4324,6 @@ gtk_window_realize (GtkWidget *widget)
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkAllocation allocation;
- GtkAllocation child_allocation;
GdkSurface *surface;
GtkBorder shadow;
@@ -4424,6 +4343,7 @@ gtk_window_realize (GtkWidget *widget)
allocation.y = shadow.top;
allocation.width = request.width - shadow.left - shadow.right;
allocation.height = request.height - shadow.top - shadow.bottom;
+
gtk_widget_size_allocate (widget, &allocation, -1);
gtk_widget_queue_resize (widget);
@@ -4493,13 +4413,7 @@ gtk_window_realize (GtkWidget *widget)
}
#endif
- child_allocation.x = 0;
- child_allocation.y = 0;
- child_allocation.width = allocation.width;
- child_allocation.height = allocation.height;
-
-
- update_realized_window_properties (window, &child_allocation, &shadow);
+ update_realized_window_properties (window);
if (priv->application)
gtk_application_handle_window_realize (priv->application, window);
@@ -4655,10 +4569,7 @@ _gtk_window_set_allocation (GtkWindow *window,
if (_gtk_widget_get_realized (widget))
{
- GtkBorder shadow;
-
- get_shadow_width (window, &shadow);
- update_realized_window_properties (window, &child_allocation, &shadow);
+ update_realized_window_properties (window);
}
priv->title_height = 0;
@@ -4714,67 +4625,6 @@ gtk_window_size_allocate (GtkWidget *widget,
gtk_tooltip_maybe_allocate (GTK_NATIVE (widget));
}
-gboolean
-gtk_window_configure (GtkWindow *window,
- guint width,
- guint height)
-{
- GtkAllocation allocation;
- GtkWidget *widget = GTK_WIDGET (window);
- GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
-
- check_scale_changed (window);
-
- /* If this is a gratuitous ConfigureNotify that's already
- * the same as our allocation, then we can fizzle it out.
- * This is the case for dragging windows around.
- *
- * We can't do this for a ConfigureRequest, since it might
- * have been a queued resize from child widgets, and so we
- * need to reallocate our children in case *they* changed.
- */
- gtk_widget_get_allocation (widget, &allocation);
- if (priv->configure_request_count == 0 &&
- (allocation.width == width && allocation.height == height))
- {
- return TRUE;
- }
-
- /* priv->configure_request_count incremented for each
- * configure request, and decremented to a min of 0 for
- * each configure notify.
- *
- * All it means is that we know we will get at least
- * priv->configure_request_count more configure notifies.
- * We could get more configure notifies than that; some
- * of the configure notifies we get may be unrelated to
- * the configure requests. But we will get at least
- * priv->configure_request_count notifies.
- */
-
- if (priv->configure_request_count > 0)
- {
- priv->configure_request_count -= 1;
-
- gdk_surface_thaw_toplevel_updates (priv->surface);
- }
-
- /*
- * If we do need to resize, we do that by:
- * - setting configure_notify_received to TRUE
- * for use in gtk_window_move_resize()
- * - queueing a resize, leading to invocation of
- * gtk_window_move_resize() in an idle handler
- *
- */
-
- priv->configure_notify_received = TRUE;
-
- gtk_widget_queue_allocate (widget);
-
- return TRUE;
-}
-
static void
update_edge_constraints (GtkWindow *window,
GdkSurfaceState state)
@@ -4846,7 +4696,40 @@ surface_size_changed (GtkWidget *widget,
int width,
int height)
{
- gtk_window_configure (GTK_WINDOW (widget), width, height);
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (GTK_WINDOW (widget));
+
+ check_scale_changed (GTK_WINDOW (widget));
+
+ /* priv->configure_request_count incremented for each
+ * configure request, and decremented to a min of 0 for
+ * each configure notify.
+ *
+ * All it means is that we know we will get at least
+ * priv->configure_request_count more configure notifies.
+ * We could get more configure notifies than that; some
+ * of the configure notifies we get may be unrelated to
+ * the configure requests. But we will get at least
+ * priv->configure_request_count notifies.
+ */
+
+ if (priv->configure_request_count > 0)
+ {
+ priv->configure_request_count -= 1;
+
+ gdk_surface_thaw_toplevel_updates (priv->surface);
+ }
+
+ /*
+ * If we do need to resize, we do that by:
+ * - setting configure_notify_received to TRUE
+ * for use in gtk_window_move_resize()
+ * - queueing a resize, leading to invocation of
+ * gtk_window_move_resize() in an idle handler
+ *
+ */
+ priv->configure_notify_received = TRUE;
+
+ gtk_widget_queue_allocate (widget);
}
static gboolean
@@ -4868,24 +4751,6 @@ surface_event (GdkSurface *surface,
return TRUE;
}
-static GtkWindowRegion
-get_active_region_type (GtkWindow *window, gint x, gint y)
-{
- GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
- gint i;
-
- if (priv->client_decorated)
- {
- for (i = 0; i < 8; i++)
- {
- if (edge_under_coordinates (window, x, y, i))
- return i;
- }
- }
-
- return GTK_WINDOW_REGION_CONTENT;
-}
-
static void
gtk_window_real_activate_focus (GtkWindow *window)
{
@@ -5303,13 +5168,11 @@ gtk_window_css_changed (GtkWidget *widget,
if (!_gtk_widget_get_alloc_needed (widget) &&
(change == NULL || gtk_css_style_change_changes_property (change, GTK_CSS_PROPERTY_BACKGROUND_COLOR)))
{
- GtkAllocation allocation;
- GtkBorder window_border;
+ GtkBorder shadow;
- gtk_widget_get_allocation (widget, &allocation);
- get_shadow_width (window, &window_border);
+ get_shadow_width (window, &shadow);
- update_opaque_region (window, &window_border, &allocation);
+ update_opaque_region (window, &shadow);
}
}
@@ -5373,7 +5236,6 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
/* This function doesn't constrain to geometry hints */
static void
gtk_window_compute_configure_request_size (GtkWindow *window,
- GdkGeometry *geometry,
guint flags,
gint *width,
gint *height)
@@ -5411,12 +5273,6 @@ gtk_window_compute_configure_request_size (GtkWindow *window,
if (info->default_height > 0)
*height = default_height_csd;
}
-
- GtkBorder shadow = {0, };
- get_shadow_width (window, &shadow);
-
- *width = *width + shadow.left + shadow.right;
- *height = *height + shadow.top + shadow.bottom;
}
else
{
@@ -5430,20 +5286,19 @@ gtk_window_compute_configure_request_size (GtkWindow *window,
/* Unless we are maximized or fullscreen */
gtk_window_get_remembered_size (window, width, height);
}
+ else if (info)
+ {
+ gint resize_width_csd = info->resize_width;
+ gint resize_height_csd = info->resize_height;
+ gtk_window_update_csd_size (window,
+ &resize_width_csd, &resize_height_csd,
+ INCLUDE_CSD_SIZE);
- /*else if (info)*/
- /*{*/
- /*gint resize_width_csd = info->resize_width;*/
- /*gint resize_height_csd = info->resize_height;*/
- /*gtk_window_update_csd_size (window,*/
- /*&resize_width_csd, &resize_height_csd,*/
- /*INCLUDE_CSD_SIZE);*/
-
- /*if (info->resize_width > 0)*/
- /**width = resize_width_csd;*/
- /*if (info->resize_height > 0)*/
- /**height = resize_height_csd;*/
- /*}*/
+ if (info->resize_width > 0)
+ *width = resize_width_csd;
+ if (info->resize_height > 0)
+ *height = resize_height_csd;
+ }
/* Don't ever request zero width or height, it's not supported by
gdk. The size allocation code will round it to 1 anyway but if
@@ -5468,7 +5323,7 @@ gtk_window_compute_configure_request (GtkWindow *window,
gtk_window_compute_hints (window, &new_geometry, &new_flags);
gtk_window_compute_configure_request_size (window,
- &new_geometry, new_flags,
+ new_flags,
&w, &h);
gtk_window_update_fixed_size (window, &new_geometry, w, h);
gtk_window_constrain_size (window,
@@ -5490,14 +5345,10 @@ gtk_window_compute_configure_request (GtkWindow *window,
y = 0;
}
- GtkBorder shadow = {0, };
-
- /*get_shadow_width (window, &shadow);*/
-
request->x = x;
request->y = y;
- request->width = w + shadow.left + shadow.right;
- request->height = h + shadow.top + shadow.bottom;
+ request->width = w;
+ request->height = h;
if (geometry)
*geometry = new_geometry;
@@ -5580,7 +5431,7 @@ gtk_window_move_resize (GtkWindow *window)
configure_request_size_changed = TRUE;
if (!gtk_window_compare_hints (&info->last.geometry, info->last.flags,
- &new_geometry, new_flags))
+ &new_geometry, new_flags))
hints_changed = TRUE;
#if 0
@@ -5675,10 +5526,10 @@ gtk_window_move_resize (GtkWindow *window)
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, -1,
&min, NULL, NULL, NULL);
- allocation.width = MAX (min, current_width);
+ allocation.width = MAX (min, current_width - shadow.left - shadow.right);
gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL, allocation.width,
&min, NULL, NULL, NULL);
- allocation.height = MAX (min, current_height);
+ allocation.height = MAX (min, current_height - shadow.top - shadow.bottom);
gtk_widget_size_allocate (widget, &allocation, -1);
@@ -5716,12 +5567,12 @@ gtk_window_move_resize (GtkWindow *window)
* haven't actually updated to the new info yet - we decided
* to postpone our configure request until later.
*/
- info->last = saved_last_info;
+ info->last = saved_last_info;
g_clear_pointer (&priv->layout, gdk_toplevel_layout_unref);
- gtk_widget_queue_resize (widget); /* might recurse for GTK_RESIZE_IMMEDIATE */
- }
+ gtk_widget_queue_resize (widget); /* might recurse for GTK_RESIZE_IMMEDIATE */
+ }
- return; /* Bail out, we didn't really process the move/resize */
+ return; /* Bail out, we didn't really process the move/resize */
}
else if ((configure_request_size_changed || hints_changed) &&
(current_width != new_request.width || current_height != new_request.height))
@@ -5791,19 +5642,17 @@ gtk_window_move_resize (GtkWindow *window)
if (configure_request_pos_changed)
g_warning ("configure request position changed. This should not happen. Ignoring the position");
- gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, current_height - shadow.top - shadow.bottom,
- &min_width, NULL, NULL, NULL);
- gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL, current_width - shadow.left - shadow.right,
- &min_height, NULL, NULL, NULL);
-
/* Our configure request didn't change size, but maybe some of
* our child widgets have. Run a size allocate with our current
* size to make sure that we re-layout our child widgets. */
- allocation.x = shadow.left;
- allocation.y = shadow.top;
+
+ gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, current_height - shadow.top - shadow.bottom,
+ &min_width, NULL, NULL, NULL);
allocation.width = MAX (current_width - shadow.left - shadow.right, min_width);
- allocation.height = MAX (current_height - shadow.top - shadow.bottom, min_height);
+ gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL, allocation.width,
+ &min_height, NULL, NULL, NULL);
+ allocation.height = MAX (current_height - shadow.top - shadow.bottom, min_height);
gtk_widget_size_allocate (widget, &allocation, -1);
}
@@ -5913,6 +5762,7 @@ gtk_window_update_fixed_size (GtkWindow *window,
if (info->default_width > -1)
{
gint w = MAX (MAX (default_width_csd, new_width), new_geometry->min_width);
+ g_critical ("TODO: Probably need to add the shadow size here as well");
new_geometry->min_width = w;
new_geometry->max_width = w;
}
@@ -5933,12 +5783,13 @@ gtk_window_update_fixed_size (GtkWindow *window,
*/
static void
gtk_window_compute_hints (GtkWindow *window,
- GdkGeometry *new_geometry,
- guint *new_flags)
+ GdkGeometry *new_geometry,
+ guint *new_flags)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *widget;
GtkRequisition requisition;
+ GtkBorder shadow;
widget = GTK_WIDGET (window);
@@ -5962,10 +5813,11 @@ gtk_window_compute_hints (GtkWindow *window,
new_geometry->base_width = 0;
new_geometry->base_height = 0;
+ get_shadow_width (window, &shadow);
*new_flags |= GDK_HINT_MIN_SIZE;
- new_geometry->min_width = requisition.width;
- new_geometry->min_height = requisition.height;
-
+ new_geometry->min_width = requisition.width + shadow.left + shadow.right;
+ new_geometry->min_height = requisition.height + shadow.top + shadow.bottom;
+
if (!priv->resizable)
{
*new_flags |= GDK_HINT_MAX_SIZE;
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index 32141ad77a..4918129d25 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -59,9 +59,6 @@ typedef void (*GtkWindowKeysForeachFunc) (GtkWindow *window,
gpointer data);
gboolean gtk_window_emit_close_request (GtkWindow *window);
-gboolean gtk_window_configure (GtkWindow *window,
- guint width,
- guint height);
/* --- internal (GtkAcceleratable) --- */
void _gtk_window_schedule_mnemonics_visible (GtkWindow *window);
@@ -132,10 +129,6 @@ GtkWidget * gtk_window_pick_popover (GtkWindow *window,
double y,
GtkPickFlags flags);
-void gtk_window_set_extra_input_region (GtkWindow *window,
- cairo_region_t *region);
-
-
G_END_DECLS
#endif /* __GTK_WINDOW_PRIVATE_H__ */
diff --git a/gtk/inspector/layoutoverlay.c b/gtk/inspector/layoutoverlay.c
index 59900c603c..b7082fd8ab 100644
--- a/gtk/inspector/layoutoverlay.c
+++ b/gtk/inspector/layoutoverlay.c
@@ -157,13 +157,7 @@ gtk_layout_overlay_snapshot (GtkInspectorOverlay *overlay,
GskRenderNode *node,
GtkWidget *widget)
{
- double nx, ny;
-
- gtk_native_get_surface_transform (GTK_NATIVE (widget), &nx, &ny);
- gtk_snapshot_save (snapshot);
- gtk_snapshot_translate (snapshot, &(graphene_point_t){ nx, ny });
recurse_child_widgets (widget, snapshot);
- gtk_snapshot_restore (snapshot);
}
static void
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index 8358407477..f7bb188a8e 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -3474,7 +3474,7 @@ calendar {
/***********
* Dialogs *
***********/
-messagedialog { // Message Dialog styling
+window.dialog.message { // Message Dialog styling
.titlebar {
min-height: 20px;
background-image: none;
@@ -4030,7 +4030,6 @@ colorchooser .popover.osd { border-radius: 5px; }
/**********************
* Window Decorations *
*********************/
-decoration,
window {
border-radius: $window_radius $window_radius 0 0;
// lamefun trick to get rounded borders regardless of CSD use
@@ -4041,13 +4040,24 @@ window {
$_wm_border: if($variant=='light', transparentize(black, 0.77), transparentize($borders_color, 0.1));
$_wm_border_backdrop: if($variant=='light', transparentize(black, 0.82), transparentize($borders_color,
0.1));
- box-shadow: 0 3px 9px 1px transparentize(black, 0.5),
- 0 0 0 1px $_wm_border; //doing borders with box-shadow
+ &.csd {
+ box-shadow: 0 3px 9px 1px transparentize(black, 0.5),
+ 0 0 0 1px $_wm_border; //doing borders with box-shadow
+ margin: 0px;
+ border-radius: 12px;
+ }
- // FIXME rationalize shadows
+ &.solid-csd {
+ margin: 0;
+ padding: 0;
+ border: solid 14px $borders_color;
+ border-radius: 0;
+ box-shadow: inset 0 0 0 3px $headerbar_color, inset 0 1px $top_hilight;
- // this is used for the resize cursor area
- //margin: 10px;
+ &:backdrop { box-shadow: inset 0 0 0 3px $backdrop_bg_color, inset 0 1px $top_hilight; }
+ }
+
+ // FIXME rationalize shadows
&:backdrop {
// the transparent shadow here is to enforce that the shadow extents don't
@@ -4060,46 +4070,36 @@ window {
transition: $backdrop_transition;
}
- .maximized > &,
- .fullscreen > &,
- .tiled > &,
- .tiled-top > &,
- .tiled-left > &,
- .tiled-right > &,
- .tiled-bottom > & { border-radius: 0; }
+ &.maximized,
+ &.fullscreen,
+ &.tiled,
+ &.tiled-top,
+ &.tiled-left,
+ &.tiled-right,
+ &.tiled-bottom { border-radius: 0; }
- .popup > & { box-shadow: none; }
+ &.popup { box-shadow: none; }
// server-side decorations as used by mutter
- .ssd > & { box-shadow: 0 0 0 1px $_wm_border; } //just doing borders, wm draws actual shadows
+ &.ssd { box-shadow: 0 0 0 1px $_wm_border; } //just doing borders, wm draws actual shadows
- .csd.popup > & {
+ &.csd.popup {
border-radius: $menu_radius;
box-shadow: 0 1px 2px transparentize(black, 0.8),
0 0 0 1px transparentize($_wm_border, 0.1);
}
- tooltip.csd > & {
- border-radius: 5px;
- box-shadow: none;
- }
-
- messagedialog.csd > & {
+ &.dialog.message.csd {
border-radius: $window_radius;
box-shadow: 0 1px 2px transparentize(black, 0.8),
0 0 0 1px transparentize($_wm_border, 0.1);
}
- .solid-csd > & {
- margin: 0;
- padding: 4px;
- background-color: $borders_color;
- border: solid 1px $borders_color;
- border-radius: 0;
- box-shadow: inset 0 0 0 3px $headerbar_color, inset 0 1px $top_hilight;
+}
- &:backdrop { box-shadow: inset 0 0 0 3px $backdrop_bg_color, inset 0 1px $top_hilight; }
- }
+tooltip.csd {
+ border-radius: 5px;
+ box-shadow: none;
}
// catch all extend :)
diff --git a/tests/testwidgetfocus.c b/tests/testwidgetfocus.c
index 9a9ea5302a..d0c8d58436 100644
--- a/tests/testwidgetfocus.c
+++ b/tests/testwidgetfocus.c
@@ -295,7 +295,7 @@ main(int argc, char **argv)
window = gtk_window_new ();
widget = g_object_new (GTK_TYPE_FOCUS_WIDGET, NULL);
- gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
+ /*gtk_window_set_decorated (GTK_WINDOW (window), FALSE);*/
gtk_window_set_child (GTK_WINDOW (window), widget);
g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]