Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2284
This commit is contained in:
Matthias Clasen 2020-07-25 17:30:11 +00:00
commit d8d8a71a7a
28 changed files with 205 additions and 261 deletions

View File

@ -68,6 +68,7 @@ struct _GdkContentDeserializer
GValue value;
GInputStream *stream;
int priority;
gboolean returned;
GCancellable *cancellable;
gpointer user_data;
GAsyncReadyCallback callback;
@ -77,7 +78,6 @@ struct _GdkContentDeserializer
GDestroyNotify task_notify;
GError *error;
gboolean returned;
};
struct _GdkContentDeserializerClass

View File

@ -70,6 +70,7 @@ struct _GdkContentSerializer
GValue value;
GOutputStream *stream;
int priority;
gboolean returned;
GCancellable *cancellable;
gpointer user_data;
GAsyncReadyCallback callback;
@ -79,7 +80,6 @@ struct _GdkContentSerializer
GDestroyNotify task_notify;
GError *error;
gboolean returned;
};
struct _GdkContentSerializerClass

View File

@ -40,13 +40,13 @@ struct _GdkDevice
GdkInputSource source;
gboolean has_cursor;
GdkAxisFlags axis_flags;
GdkDeviceType type;
GdkDisplay *display;
/* The paired logical device for logical devices,
* or the associated logical device for physical ones
*/
GdkDevice *associated;
GList *physical_devices;
GdkDeviceType type;
GArray *axes;
guint num_touches;

View File

@ -48,8 +48,6 @@ struct _GdkSurface
int x;
int y;
guint8 resize_count;
GdkGLContext *gl_paint_context;
cairo_region_t *update_area;
@ -63,16 +61,17 @@ struct _GdkSurface
GdkSurfaceState old_state;
GdkSurfaceState state;
guint8 resize_count;
guint8 alpha;
guint8 fullscreen_mode;
guint modal_hint : 1;
guint destroyed : 2;
guint in_update : 1;
guint frame_clock_events_paused : 1;
guint autohide : 1;
guint shortcuts_inhibited : 1;
struct {
GdkGravity surface_anchor;
@ -101,7 +100,6 @@ struct _GdkSurface
cairo_region_t *opaque_region;
guint shortcuts_inhibited : 1;
GdkSeat *current_shortcuts_inhibited_seat;
};

View File

@ -55,8 +55,8 @@ typedef struct _DirectionCacheEntry DirectionCacheEntry;
struct _DirectionCacheEntry
{
guint serial;
Atom group_atom;
PangoDirection direction;
Atom group_atom;
};
struct _GdkX11Keymap

View File

@ -65,10 +65,10 @@ struct _GskPangoRenderer
GdkRGBA *error_color;
GskPangoRendererState state;
GskPangoShapeHandler shape_handler;
/* house-keeping options */
guint is_cached_renderer : 1;
GskPangoShapeHandler shape_handler;
};
struct _GskPangoRendererClass

View File

@ -57,9 +57,9 @@ struct _GtkAdjustmentPrivate {
double target;
guint duration;
guint tick_id;
gint64 start_time;
gint64 end_time;
guint tick_id;
GdkFrameClock *clock;
};
typedef struct _GtkAdjustmentPrivate GtkAdjustmentPrivate;

View File

@ -190,10 +190,9 @@ struct _GtkApplicationWindowPrivate
GtkWidget *menubar;
gboolean show_menubar;
guint id;
GMenu *menubar_section;
guint id;
GtkShortcutsWindow *help_overlay;
};

View File

@ -33,8 +33,10 @@
#include "gtkshortcutaction.h"
#include "gtkshortcut.h"
struct _GtkColorPlanePrivate
struct _GtkColorPlane
{
GtkWidget parent_instance;
GtkAdjustment *h_adj;
GtkAdjustment *s_adj;
GtkAdjustment *v_adj;
@ -42,6 +44,11 @@ struct _GtkColorPlanePrivate
GdkTexture *texture;
};
typedef struct
{
GtkWidgetClass parent_class;
} GtkColorPlaneClass;
enum {
PROP_0,
PROP_H_ADJUSTMENT,
@ -49,7 +56,7 @@ enum {
PROP_V_ADJUSTMENT
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkColorPlane, gtk_color_plane, GTK_TYPE_WIDGET)
G_DEFINE_TYPE (GtkColorPlane, gtk_color_plane, GTK_TYPE_WIDGET)
static void
sv_to_xy (GtkColorPlane *plane,
@ -62,8 +69,8 @@ sv_to_xy (GtkColorPlane *plane,
width = gtk_widget_get_width (GTK_WIDGET (plane));
height = gtk_widget_get_height (GTK_WIDGET (plane));
s = gtk_adjustment_get_value (plane->priv->s_adj);
v = gtk_adjustment_get_value (plane->priv->v_adj);
s = gtk_adjustment_get_value (plane->s_adj);
v = gtk_adjustment_get_value (plane->v_adj);
*x = CLAMP (width * v, 0, width - 1);
*y = CLAMP (height * (1 - s), 0, height - 1);
@ -82,7 +89,7 @@ plane_snapshot (GtkWidget *widget,
height = gtk_widget_get_height (widget);
gtk_snapshot_append_texture (snapshot,
plane->priv->texture,
plane->texture,
&GRAPHENE_RECT_INIT (0, 0, width, height));
if (gtk_widget_has_visible_focus (widget))
{
@ -136,7 +143,7 @@ create_texture (GtkColorPlane *plane)
if (width == 0 || height == 0)
return;
g_clear_object (&plane->priv->texture);
g_clear_object (&plane->texture);
stride = width * 4;
@ -144,7 +151,7 @@ create_texture (GtkColorPlane *plane)
if (width > 1 && height > 1)
{
h = gtk_adjustment_get_value (plane->priv->h_adj);
h = gtk_adjustment_get_value (plane->h_adj);
sf = 1.0 / (height - 1);
vf = 1.0 / (width - 1);
for (y = 0; y < height; y++)
@ -168,7 +175,7 @@ create_texture (GtkColorPlane *plane)
}
bytes = g_bytes_new_take (data, height * stride);
plane->priv->texture = gdk_memory_texture_new (width, height,
plane->texture = gdk_memory_texture_new (width, height,
GDK_MEMORY_DEFAULT,
bytes,
stride);
@ -198,9 +205,8 @@ static void
plane_unrealize (GtkWidget *widget)
{
GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
GtkColorPlanePrivate *priv = gtk_color_plane_get_instance_private (plane);
g_clear_object (&priv->texture);
g_clear_object (&plane->texture);
GTK_WIDGET_CLASS (gtk_color_plane_parent_class)->unrealize (widget);
}
@ -238,8 +244,8 @@ update_color (GtkColorPlane *plane,
s = CLAMP (1 - y * (1.0 / gtk_widget_get_height (widget)), 0, 1);
v = CLAMP (x * (1.0 / gtk_widget_get_width (widget)), 0, 1);
gtk_adjustment_set_value (plane->priv->s_adj, s);
gtk_adjustment_set_value (plane->priv->v_adj, v);
gtk_adjustment_set_value (plane->s_adj, s);
gtk_adjustment_set_value (plane->v_adj, v);
gtk_widget_queue_draw (widget);
}
@ -262,8 +268,8 @@ sv_move (GtkColorPlane *plane,
{
double s, v;
s = gtk_adjustment_get_value (plane->priv->s_adj);
v = gtk_adjustment_get_value (plane->priv->v_adj);
s = gtk_adjustment_get_value (plane->s_adj);
v = gtk_adjustment_get_value (plane->v_adj);
if (s + ds > 1)
{
@ -303,8 +309,8 @@ sv_move (GtkColorPlane *plane,
v += dv;
}
gtk_adjustment_set_value (plane->priv->s_adj, s);
gtk_adjustment_set_value (plane->priv->v_adj, v);
gtk_adjustment_set_value (plane->s_adj, s);
gtk_adjustment_set_value (plane->v_adj, v);
return;
error:
@ -405,8 +411,6 @@ gtk_color_plane_init (GtkColorPlane *plane)
GtkShortcutAction *action;
GtkShortcut *shortcut;
plane->priv = gtk_color_plane_get_instance_private (plane);
gtk_widget_set_focusable (GTK_WIDGET (plane), TRUE);
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (plane));
@ -418,11 +422,11 @@ gtk_color_plane_init (GtkColorPlane *plane)
gesture = gtk_gesture_drag_new ();
g_signal_connect (gesture, "drag-begin",
G_CALLBACK (plane_drag_gesture_begin), plane);
G_CALLBACK (plane_drag_gesture_begin), plane);
g_signal_connect (gesture, "drag-update",
G_CALLBACK (plane_drag_gesture_update), plane);
G_CALLBACK (plane_drag_gesture_update), plane);
g_signal_connect (gesture, "drag-end",
G_CALLBACK (plane_drag_gesture_end), plane);
G_CALLBACK (plane_drag_gesture_end), plane);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
@ -452,20 +456,20 @@ plane_finalize (GObject *object)
{
GtkColorPlane *plane = GTK_COLOR_PLANE (object);
g_clear_object (&plane->priv->texture);
g_clear_object (&plane->texture);
g_clear_object (&plane->priv->h_adj);
g_clear_object (&plane->priv->s_adj);
g_clear_object (&plane->priv->v_adj);
g_clear_object (&plane->h_adj);
g_clear_object (&plane->s_adj);
g_clear_object (&plane->v_adj);
G_OBJECT_CLASS (gtk_color_plane_parent_class)->finalize (object);
}
static void
plane_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkColorPlane *plane = GTK_COLOR_PLANE (object);
GtkAdjustment *adjustment;
@ -478,26 +482,26 @@ plane_set_property (GObject *object,
case PROP_H_ADJUSTMENT:
adjustment = g_value_get_object (value);
if (adjustment)
{
plane->priv->h_adj = g_object_ref_sink (adjustment);
g_signal_connect_swapped (adjustment, "value-changed", G_CALLBACK (h_changed), plane);
}
{
plane->h_adj = g_object_ref_sink (adjustment);
g_signal_connect_swapped (adjustment, "value-changed", G_CALLBACK (h_changed), plane);
}
break;
case PROP_S_ADJUSTMENT:
adjustment = g_value_get_object (value);
if (adjustment)
{
plane->priv->s_adj = g_object_ref_sink (adjustment);
g_signal_connect_swapped (adjustment, "value-changed", G_CALLBACK (sv_changed), plane);
}
{
plane->s_adj = g_object_ref_sink (adjustment);
g_signal_connect_swapped (adjustment, "value-changed", G_CALLBACK (sv_changed), plane);
}
break;
case PROP_V_ADJUSTMENT:
adjustment = g_value_get_object (value);
if (adjustment)
{
plane->priv->v_adj = g_object_ref_sink (adjustment);
g_signal_connect_swapped (adjustment, "value-changed", G_CALLBACK (sv_changed), plane);
}
{
plane->v_adj = g_object_ref_sink (adjustment);
g_signal_connect_swapped (adjustment, "value-changed", G_CALLBACK (sv_changed), plane);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -524,27 +528,27 @@ gtk_color_plane_class_init (GtkColorPlaneClass *class)
g_param_spec_object ("h-adjustment",
"Hue Adjustment",
"Hue Adjustment",
GTK_TYPE_ADJUSTMENT,
GTK_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
GTK_TYPE_ADJUSTMENT,
GTK_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_S_ADJUSTMENT,
g_param_spec_object ("s-adjustment",
"Saturation Adjustment",
"Saturation Adjustment",
GTK_TYPE_ADJUSTMENT,
GTK_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
GTK_TYPE_ADJUSTMENT,
GTK_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_V_ADJUSTMENT,
g_param_spec_object ("v-adjustment",
"Value Adjustment",
"Value Adjustment",
GTK_TYPE_ADJUSTMENT,
GTK_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
GTK_TYPE_ADJUSTMENT,
GTK_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
gtk_widget_class_set_css_name (widget_class, "plane");
}

View File

@ -18,40 +18,16 @@
#ifndef __GTK_COLOR_PLANE_H__
#define __GTK_COLOR_PLANE_H__
#include <gtk/gtkdrawingarea.h>
#include <gtk/gtktypes.h>
G_BEGIN_DECLS
#define GTK_TYPE_COLOR_PLANE (gtk_color_plane_get_type ())
#define GTK_COLOR_PLANE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COLOR_PLANE, GtkColorPlane))
#define GTK_COLOR_PLANE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_COLOR_PLANE, GtkColorPlaneClass))
#define GTK_IS_COLOR_PLANE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COLOR_PLANE))
#define GTK_IS_COLOR_PLANE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COLOR_PLANE))
#define GTK_COLOR_PLANE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_COLOR_PLANE, GtkColorPlaneClass))
typedef struct _GtkColorPlane GtkColorPlane;
typedef struct _GtkColorPlaneClass GtkColorPlaneClass;
typedef struct _GtkColorPlanePrivate GtkColorPlanePrivate;
struct _GtkColorPlane
{
GtkWidget parent_instance;
GtkColorPlanePrivate *priv;
};
struct _GtkColorPlaneClass
{
GtkWidgetClass parent_class;
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
GType gtk_color_plane_get_type (void) G_GNUC_CONST;

View File

@ -59,7 +59,6 @@ struct _GtkColorSwatch
GtkWidget parent_instance;
GdkRGBA color;
double radius[4];
char *icon;
guint has_color : 1;
guint use_alpha : 1;

View File

@ -118,21 +118,21 @@ struct _GtkColumnView
GtkAdjustment *hadjustment;
gboolean reorderable;
gboolean show_column_separators;
guint reorderable : 1;
guint show_column_separators : 1;
guint in_column_resize : 1;
guint in_column_reorder : 1;
gboolean in_column_resize;
gboolean in_column_reorder;
int drag_pos;
int drag_x;
int drag_offset;
int drag_column_x;
GtkGesture *drag_gesture;
guint autoscroll_id;
double autoscroll_x;
double autoscroll_delta;
GtkGesture *drag_gesture;
};
struct _GtkColumnViewClass

View File

@ -29,10 +29,10 @@ struct _GtkCssTransition
GtkStyleAnimation parent;
guint property;
guint finished;
GtkCssValue *start;
GtkCssValue *ease;
GtkProgressTracker tracker;
guint finished;
};

View File

@ -49,9 +49,9 @@ struct _GtkEventControllerKey
GdkModifierType state;
GdkEvent *current_event;
gboolean is_focus;
GdkEvent *current_event;
};
struct _GtkEventControllerKeyClass

View File

@ -76,17 +76,19 @@ struct _GtkFontButton
guint show_preview_entry : 1;
guint modal : 1;
GtkFontChooserLevel level;
GtkWidget *button;
GtkWidget *font_dialog;
GtkWidget *font_label;
GtkWidget *size_label;
GtkWidget *font_size_box;
int font_size;
PangoFontDescription *font_desc;
PangoFontFamily *font_family;
PangoFontFace *font_face;
PangoFontMap *font_map;
int font_size;
char *font_features;
PangoLanguage *language;
char *preview_text;
@ -94,8 +96,6 @@ struct _GtkFontButton
gpointer font_filter_data;
GDestroyNotify font_filter_data_destroy;
GtkCssProvider *provider;
GtkFontChooserLevel level;
};
struct _GtkFontButtonClass

View File

@ -91,8 +91,8 @@ struct _GtkGridView
guint max_columns;
/* set in size_allocate */
guint n_columns;
double column_width;
int unknown_row_height;
double column_width;
};
struct _GtkGridViewClass

View File

@ -108,21 +108,10 @@
#define MIN_TITLE_CHARS 5
typedef struct _GtkHeaderBarPrivate GtkHeaderBarPrivate;
typedef struct _GtkHeaderBarClass GtkHeaderBarClass;
struct _GtkHeaderBar
{
GtkWidget container;
};
struct _GtkHeaderBarClass
{
GtkWidgetClass parent_class;
};
struct _GtkHeaderBarPrivate
{
GtkWidget *handle;
GtkWidget *center_box;
GtkWidget *start_box;
@ -131,16 +120,24 @@ struct _GtkHeaderBarPrivate
GtkWidget *title_label;
GtkWidget *title_widget;
gboolean show_title_buttons;
char *decoration_layout;
gboolean track_default_decoration;
GtkWidget *start_window_controls;
GtkWidget *end_window_controls;
char *decoration_layout;
guint show_title_buttons : 1;
guint track_default_decoration : 1;
GdkSurfaceState state;
};
typedef struct _GtkHeaderBarClass GtkHeaderBarClass;
struct _GtkHeaderBarClass
{
GtkWidgetClass parent_class;
};
enum {
PROP_0,
PROP_TITLE_WIDGET,
@ -154,14 +151,12 @@ static GParamSpec *header_bar_props[LAST_PROP] = { NULL, };
static void gtk_header_bar_buildable_init (GtkBuildableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkHeaderBar, gtk_header_bar, GTK_TYPE_WIDGET,
G_ADD_PRIVATE (GtkHeaderBar)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_header_bar_buildable_init));
static void
create_window_controls (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
GtkWidget *controls;
controls = gtk_window_controls_new (GTK_PACK_START);
@ -171,8 +166,8 @@ create_window_controls (GtkHeaderBar *bar)
g_object_bind_property (controls, "empty",
controls, "visible",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
gtk_box_append (GTK_BOX (priv->start_box), controls);
priv->start_window_controls = controls;
gtk_box_append (GTK_BOX (bar->start_box), controls);
bar->start_window_controls = controls;
controls = gtk_window_controls_new (GTK_PACK_END);
g_object_bind_property (bar, "decoration-layout",
@ -181,18 +176,17 @@ create_window_controls (GtkHeaderBar *bar)
g_object_bind_property (controls, "empty",
controls, "visible",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
gtk_box_append (GTK_BOX (priv->end_box), controls);
priv->end_window_controls = controls;
gtk_box_append (GTK_BOX (bar->end_box), controls);
bar->end_window_controls = controls;
}
static void
update_default_decoration (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
gboolean have_children = FALSE;
/* Check whether we have any child widgets that we didn't add ourselves */
if (gtk_center_box_get_center_widget (GTK_CENTER_BOX (priv->center_box)) != NULL)
if (gtk_center_box_get_center_widget (GTK_CENTER_BOX (bar->center_box)) != NULL)
{
have_children = TRUE;
}
@ -200,11 +194,11 @@ update_default_decoration (GtkHeaderBar *bar)
{
GtkWidget *w;
for (w = _gtk_widget_get_first_child (priv->start_box);
for (w = _gtk_widget_get_first_child (bar->start_box);
w != NULL;
w = _gtk_widget_get_next_sibling (w))
{
if (w != priv->start_window_controls)
if (w != bar->start_window_controls)
{
have_children = TRUE;
break;
@ -212,11 +206,11 @@ update_default_decoration (GtkHeaderBar *bar)
}
if (!have_children)
for (w = _gtk_widget_get_first_child (priv->end_box);
for (w = _gtk_widget_get_first_child (bar->end_box);
w != NULL;
w = _gtk_widget_get_next_sibling (w))
{
if (w != priv->end_window_controls)
if (w != bar->end_window_controls)
{
have_children = TRUE;
break;
@ -224,7 +218,7 @@ update_default_decoration (GtkHeaderBar *bar)
}
}
if (have_children || priv->title_widget != NULL)
if (have_children || bar->title_widget != NULL)
gtk_widget_remove_css_class (GTK_WIDGET (bar), "default-decoration");
else
gtk_widget_add_css_class (GTK_WIDGET (bar), "default-decoration");
@ -233,9 +227,7 @@ update_default_decoration (GtkHeaderBar *bar)
void
_gtk_header_bar_track_default_decoration (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
priv->track_default_decoration = TRUE;
bar->track_default_decoration = TRUE;
update_default_decoration (bar);
}
@ -243,11 +235,10 @@ _gtk_header_bar_track_default_decoration (GtkHeaderBar *bar)
static void
update_title (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
GtkRoot *root;
const char *title = NULL;
if (!priv->title_label)
if (!bar->title_label)
return;
root = gtk_widget_get_root (GTK_WIDGET (bar));
@ -261,16 +252,15 @@ update_title (GtkHeaderBar *bar)
if (!title)
title = g_get_prgname ();
gtk_label_set_text (GTK_LABEL (priv->title_label), title);
gtk_label_set_text (GTK_LABEL (bar->title_label), title);
}
static void
construct_title_label (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
GtkWidget *label;
g_assert (priv->title_label == NULL);
g_assert (bar->title_label == NULL);
label = gtk_label_new (NULL);
gtk_widget_add_css_class (label, GTK_STYLE_CLASS_TITLE);
@ -279,9 +269,9 @@ construct_title_label (GtkHeaderBar *bar)
gtk_label_set_single_line_mode (GTK_LABEL (label), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_label_set_width_chars (GTK_LABEL (label), MIN_TITLE_CHARS);
gtk_center_box_set_center_widget (GTK_CENTER_BOX (priv->center_box), label);
gtk_center_box_set_center_widget (GTK_CENTER_BOX (bar->center_box), label);
priv->title_label = label;
bar->title_label = label;
update_title (bar);
}
@ -306,30 +296,28 @@ void
gtk_header_bar_set_title_widget (GtkHeaderBar *bar,
GtkWidget *title_widget)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
g_return_if_fail (GTK_IS_HEADER_BAR (bar));
if (title_widget)
g_return_if_fail (GTK_IS_WIDGET (title_widget));
/* No need to do anything if the title widget stays the same */
if (priv->title_widget == title_widget)
if (bar->title_widget == title_widget)
return;
gtk_center_box_set_center_widget (GTK_CENTER_BOX (priv->center_box), NULL);
priv->title_widget = NULL;
gtk_center_box_set_center_widget (GTK_CENTER_BOX (bar->center_box), NULL);
bar->title_widget = NULL;
if (title_widget != NULL)
{
priv->title_widget = title_widget;
bar->title_widget = title_widget;
gtk_center_box_set_center_widget (GTK_CENTER_BOX (priv->center_box), title_widget);
gtk_center_box_set_center_widget (GTK_CENTER_BOX (bar->center_box), title_widget);
priv->title_label = NULL;
bar->title_label = NULL;
}
else
{
if (priv->title_label == NULL)
if (bar->title_label == NULL)
construct_title_label (bar);
}
@ -349,11 +337,9 @@ gtk_header_bar_set_title_widget (GtkHeaderBar *bar,
GtkWidget *
gtk_header_bar_get_title_widget (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
g_return_val_if_fail (GTK_IS_HEADER_BAR (bar), NULL);
return priv->title_widget;
return bar->title_widget;
}
static void
@ -384,14 +370,14 @@ gtk_header_bar_unroot (GtkWidget *widget)
static void
gtk_header_bar_dispose (GObject *object)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (object));
GtkHeaderBar *bar = GTK_HEADER_BAR (object);
priv->title_widget = NULL;
priv->title_label = NULL;
priv->start_box = NULL;
priv->end_box = NULL;
bar->title_widget = NULL;
bar->title_label = NULL;
bar->start_box = NULL;
bar->end_box = NULL;
g_clear_pointer (&priv->handle, gtk_widget_unparent);
g_clear_pointer (&bar->handle, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_header_bar_parent_class)->dispose (object);
}
@ -399,9 +385,9 @@ gtk_header_bar_dispose (GObject *object)
static void
gtk_header_bar_finalize (GObject *object)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (object));
GtkHeaderBar *bar = GTK_HEADER_BAR (object);
g_free (priv->decoration_layout);
g_free (bar->decoration_layout);
G_OBJECT_CLASS (gtk_header_bar_parent_class)->finalize (object);
}
@ -413,12 +399,11 @@ gtk_header_bar_get_property (GObject *object,
GParamSpec *pspec)
{
GtkHeaderBar *bar = GTK_HEADER_BAR (object);
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
switch (prop_id)
{
case PROP_TITLE_WIDGET:
g_value_set_object (value, priv->title_widget);
g_value_set_object (value, bar->title_widget);
break;
case PROP_SHOW_TITLE_BUTTONS:
@ -468,21 +453,19 @@ gtk_header_bar_pack (GtkHeaderBar *bar,
GtkWidget *widget,
GtkPackType pack_type)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
g_return_if_fail (gtk_widget_get_parent (widget) == NULL);
if (pack_type == GTK_PACK_START)
{
gtk_box_append (GTK_BOX (priv->start_box), widget);
gtk_box_append (GTK_BOX (bar->start_box), widget);
}
else if (pack_type == GTK_PACK_END)
{
gtk_box_append (GTK_BOX (priv->end_box), widget);
gtk_box_reorder_child_after (GTK_BOX (priv->end_box), widget, NULL);
gtk_box_append (GTK_BOX (bar->end_box), widget);
gtk_box_reorder_child_after (GTK_BOX (bar->end_box), widget, NULL);
}
if (priv->track_default_decoration)
if (bar->track_default_decoration)
update_default_decoration (bar);
}
@ -499,29 +482,28 @@ void
gtk_header_bar_remove (GtkHeaderBar *bar,
GtkWidget *child)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
GtkWidget *parent;
gboolean removed = FALSE;
parent = gtk_widget_get_parent (child);
if (parent == priv->start_box)
if (parent == bar->start_box)
{
gtk_box_remove (GTK_BOX (priv->start_box), child);
gtk_box_remove (GTK_BOX (bar->start_box), child);
removed = TRUE;
}
else if (parent == priv->end_box)
else if (parent == bar->end_box)
{
gtk_box_remove (GTK_BOX (priv->end_box), child);
gtk_box_remove (GTK_BOX (bar->end_box), child);
removed = TRUE;
}
else if (parent == priv->center_box)
else if (parent == bar->center_box)
{
gtk_center_box_set_center_widget (GTK_CENTER_BOX (priv->center_box), NULL);
gtk_center_box_set_center_widget (GTK_CENTER_BOX (bar->center_box), NULL);
removed = TRUE;
}
if (removed && priv->track_default_decoration)
if (removed && bar->track_default_decoration)
update_default_decoration (bar);
}
@ -625,26 +607,24 @@ gtk_header_bar_class_init (GtkHeaderBarClass *class)
static void
gtk_header_bar_init (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
bar->title_widget = NULL;
bar->decoration_layout = NULL;
bar->show_title_buttons = TRUE;
bar->state = GDK_SURFACE_STATE_WITHDRAWN;
priv->title_widget = NULL;
priv->decoration_layout = NULL;
priv->show_title_buttons = TRUE;
priv->state = GDK_SURFACE_STATE_WITHDRAWN;
bar->handle = gtk_window_handle_new ();
gtk_widget_set_parent (bar->handle, GTK_WIDGET (bar));
priv->handle = gtk_window_handle_new ();
gtk_widget_set_parent (priv->handle, GTK_WIDGET (bar));
bar->center_box = gtk_center_box_new ();
gtk_window_handle_set_child (GTK_WINDOW_HANDLE (bar->handle), bar->center_box);
priv->center_box = gtk_center_box_new ();
gtk_window_handle_set_child (GTK_WINDOW_HANDLE (priv->handle), priv->center_box);
bar->start_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (bar->start_box, "start");
gtk_center_box_set_start_widget (GTK_CENTER_BOX (bar->center_box), bar->start_box);
priv->start_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (priv->start_box, "start");
gtk_center_box_set_start_widget (GTK_CENTER_BOX (priv->center_box), priv->start_box);
priv->end_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (priv->end_box, "end");
gtk_center_box_set_end_widget (GTK_CENTER_BOX (priv->center_box), priv->end_box);
bar->end_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (bar->end_box, "end");
gtk_center_box_set_end_widget (GTK_CENTER_BOX (bar->center_box), bar->end_box);
construct_title_label (bar);
create_window_controls (bar);
@ -733,13 +713,9 @@ gtk_header_bar_new (void)
gboolean
gtk_header_bar_get_show_title_buttons (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv;
g_return_val_if_fail (GTK_IS_HEADER_BAR (bar), FALSE);
priv = gtk_header_bar_get_instance_private (bar);
return priv->show_title_buttons;
return bar->show_title_buttons;
}
/**
@ -754,25 +730,21 @@ void
gtk_header_bar_set_show_title_buttons (GtkHeaderBar *bar,
gboolean setting)
{
GtkHeaderBarPrivate *priv;
g_return_if_fail (GTK_IS_HEADER_BAR (bar));
priv = gtk_header_bar_get_instance_private (bar);
setting = setting != FALSE;
if (priv->show_title_buttons == setting)
if (bar->show_title_buttons == setting)
return;
priv->show_title_buttons = setting;
bar->show_title_buttons = setting;
if (setting)
create_window_controls (bar);
else
{
g_clear_pointer (&priv->start_window_controls, gtk_widget_unparent);
g_clear_pointer (&priv->end_window_controls, gtk_widget_unparent);
g_clear_pointer (&bar->start_window_controls, gtk_widget_unparent);
g_clear_pointer (&bar->end_window_controls, gtk_widget_unparent);
}
g_object_notify_by_pspec (G_OBJECT (bar), header_bar_props[PROP_SHOW_TITLE_BUTTONS]);
@ -805,14 +777,10 @@ void
gtk_header_bar_set_decoration_layout (GtkHeaderBar *bar,
const char *layout)
{
GtkHeaderBarPrivate *priv;
g_return_if_fail (GTK_IS_HEADER_BAR (bar));
priv = gtk_header_bar_get_instance_private (bar);
g_free (priv->decoration_layout);
priv->decoration_layout = g_strdup (layout);
g_free (bar->decoration_layout);
bar->decoration_layout = g_strdup (layout);
g_object_notify_by_pspec (G_OBJECT (bar), header_bar_props[PROP_DECORATION_LAYOUT]);
}
@ -829,11 +797,7 @@ gtk_header_bar_set_decoration_layout (GtkHeaderBar *bar,
const char *
gtk_header_bar_get_decoration_layout (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv;
g_return_val_if_fail (GTK_IS_HEADER_BAR (bar), NULL);
priv = gtk_header_bar_get_instance_private (bar);
return priv->decoration_layout;
return bar->decoration_layout;
}

View File

@ -23,10 +23,10 @@
void
_gtk_hsla_init (GtkHSLA *hsla,
double hue,
double saturation,
double lightness,
double alpha)
float hue,
float saturation,
float lightness,
float alpha)
{
g_return_if_fail (hsla != NULL);
@ -43,12 +43,12 @@ void
_gtk_hsla_init_from_rgba (GtkHSLA *hsla,
const GdkRGBA *rgba)
{
double min;
double max;
double red;
double green;
double blue;
double delta;
float min;
float max;
float red;
float green;
float blue;
float delta;
g_return_if_fail (hsla != NULL);
g_return_if_fail (rgba != NULL);
@ -112,10 +112,10 @@ void
_gdk_rgba_init_from_hsla (GdkRGBA *rgba,
const GtkHSLA *hsla)
{
double hue;
double lightness;
double saturation;
double m1, m2;
float hue;
float lightness;
float saturation;
float m1, m2;
lightness = hsla->lightness;
saturation = hsla->saturation;
@ -186,7 +186,7 @@ _gdk_rgba_init_from_hsla (GdkRGBA *rgba,
void
_gtk_hsla_shade (GtkHSLA *dest,
const GtkHSLA *src,
double factor)
float factor)
{
g_return_if_fail (dest != NULL);
g_return_if_fail (src != NULL);

View File

@ -25,17 +25,17 @@ G_BEGIN_DECLS
typedef struct _GtkHSLA GtkHSLA;
struct _GtkHSLA {
double hue;
double saturation;
double lightness;
double alpha;
float hue;
float saturation;
float lightness;
float alpha;
};
void _gtk_hsla_init (GtkHSLA *hsla,
double hue,
double saturation,
double lightness,
double alpha);
float hue,
float saturation,
float lightness,
float alpha);
void _gtk_hsla_init_from_rgba (GtkHSLA *hsla,
const GdkRGBA *rgba);
/* Yes, I can name that function like this! */
@ -44,7 +44,7 @@ void _gdk_rgba_init_from_hsla (GdkRGBA *rgba,
void _gtk_hsla_shade (GtkHSLA *dest,
const GtkHSLA *src,
double factor);
float factor);
G_END_DECLS

View File

@ -35,11 +35,11 @@ typedef struct _GtkProgressTracker GtkProgressTracker;
struct _GtkProgressTracker
{
gboolean is_running;
guint64 last_frame_time;
guint64 duration;
double iteration;
double iteration_count;
gboolean is_running;
};
void gtk_progress_tracker_init_copy (GtkProgressTracker *source,

View File

@ -87,7 +87,7 @@ struct _GtkRangePrivate
GtkWidget *highlight_widget;
GtkWidget *slider_widget;
GtkOrientation orientation;
GtkGesture *drag_gesture;
double fill_level;
double *marks;
@ -113,7 +113,7 @@ struct _GtkRangePrivate
/* Whether dragging is ongoing */
guint in_drag : 1;
GtkGesture *drag_gesture;
GtkOrientation orientation;
GtkScrollType autoscroll_mode;
guint autoscroll_id;

View File

@ -149,23 +149,23 @@ struct _GtkScalePrivate
int digits;
guint draw_value : 1;
guint value_pos : 2;
GtkScaleFormatValueFunc format_value_func;
gpointer format_value_func_user_data;
GDestroyNotify format_value_func_destroy_notify;
guint draw_value : 1;
guint value_pos : 2;
};
struct _GtkScaleMark
{
double value;
int stop_position;
GtkPositionType position; /* always GTK_POS_TOP or GTK_POS_BOTTOM */
char *markup;
GtkWidget *label_widget;
GtkWidget *indicator_widget;
GtkWidget *widget;
GtkPositionType position; /* always GTK_POS_TOP or GTK_POS_BOTTOM */
};
enum {

View File

@ -90,11 +90,12 @@ struct _GtkSwitch
double handle_pos;
guint tick_id;
GtkProgressTracker tracker;
guint state : 1;
guint is_active : 1;
GtkProgressTracker tracker;
GtkWidget *on_image;
GtkWidget *off_image;
GtkWidget *slider;

View File

@ -154,14 +154,14 @@ struct _GtkTextLayout
*/
guint keyboard_direction : 2;
guint overwrite_mode : 1;
/* The preedit string and attributes, if any */
char *preedit_string;
PangoAttrList *preedit_attrs;
int preedit_len;
int preedit_cursor;
guint overwrite_mode : 1;
};
struct _GtkTextLayoutClass

View File

@ -39,10 +39,6 @@ struct _GtkTextTagPrivate
* a pointer to the key from the entry in
* tkxt->tagTable, so it needn't be freed
* explicitly. */
int priority; /* Priority of this tag within widget. 0
* means lowest priority. Exactly one tag
* has each integer value between 0 and
* numTags-1. */
/*
* Information for displaying text with this tag. The information
* belows acts as an override on information specified by lower-priority
@ -53,6 +49,10 @@ struct _GtkTextTagPrivate
GtkTextAttributes *values;
int priority; /* Priority of this tag within widget. 0
* means lowest priority. Exactly one tag
* has each integer value between 0 and
* numTags-1. */
/* Flags for whether a given value is set; if a value is unset, then
* this tag does not affect it.
*/

View File

@ -60,9 +60,10 @@ struct _GtkWidgetPaintable
GtkWidget *widget;
guint snapshot_count;
guint pending_update_cb; /* the idle source that updates the valid image to be the new current image */
GdkPaintable *current_image; /* the image that we are presenting */
GdkPaintable *pending_image; /* the image that we should be presenting */
guint pending_update_cb; /* the idle source that updates the valid image to be the new current image */
};
struct _GtkWidgetPaintableClass

View File

@ -51,10 +51,10 @@ typedef struct _GtkWidgetSurfaceTransformData
GtkWidget *tracked_parent;
guint parent_surface_transform_changed_id;
GList *callbacks;
gboolean cached_surface_transform_valid;
graphene_matrix_t cached_surface_transform;
GList *callbacks;
} GtkWidgetSurfaceTransformData;
struct _GtkWidgetPrivate
@ -105,8 +105,9 @@ struct _GtkWidgetPrivate
guint halign : 4;
guint valign : 4;
guint user_alpha : 8;
GtkOverflow overflow;
guint8 user_alpha;
#ifdef G_ENABLE_CONSISTENCY_CHECKS
/* Number of gtk_widget_push_verify_invariants () */
@ -115,13 +116,14 @@ struct _GtkWidgetPrivate
int width_request;
int height_request;
void (* resize_func) (GtkWidget *);
GtkBorder margin;
/* Animations and other things to update on clock ticks */
guint clock_tick_id;
GList *tick_callbacks;
void (* resize_func) (GtkWidget *);
GtkBorder margin;
/* Surface relative transform updates callbacks */
GtkWidgetSurfaceTransformData *surface_transform_data;
@ -152,10 +154,10 @@ struct _GtkWidgetPrivate
int allocated_height;
int allocated_size_baseline;
GskTransform *transform;
int width;
int height;
int baseline;
GskTransform *transform;
/* The widget's requested sizes */
SizeRequestCache requests;

View File

@ -49,7 +49,7 @@ l {
}
m {
color: rgb(255,77,77);
color: rgb(255,76,76);
}
n {