Compare commits

..

2 Commits

Author SHA1 Message Date
Matthias Clasen 1cc3c019e6 Include precompiled versions of .ui files
These are smaller, and a faster to process than .ui files.
2021-12-14 01:51:22 -05:00
Matthias Clasen 319aa558a5 buildertool: Add a precompile command
This writes out the precompiled format of .ui
files that we are using internally.
2021-12-14 01:51:22 -05:00
130 changed files with 7648 additions and 9144 deletions
+1 -2
View File
@@ -31,8 +31,7 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-pango \
mingw-w64-$MSYS2_ARCH-fribidi \
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
mingw-w64-$MSYS2_ARCH-shared-mime-info \
mingw-w64-$MSYS2_ARCH-python-gobject
mingw-w64-$MSYS2_ARCH-shared-mime-info
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
-119
View File
@@ -1,127 +1,8 @@
Overview of Changes
===================
* GtkProgressBar:
- Fix handling of "inverted"
* GtkLabel:
- Add a "natural wrap mode" property to influence how
natural width is determined
* GtkTextView
- Scroll insertion on-screen after undo / redo
* gsk:
- Abort region diffing when changes are too complex
* gdk:
- Avoid compressing discrete scroll events
- Fix problems with hiding windows
- Improve GL and GLES version checks
* Wayland:
- Support new high-contrast setting
* Inspector:
- Add DND inspection support
* build:
- Avoid deprecated meson apis
* Translation updates
Galician
Portuguese
Ukrainian
Overview of Changes in 4.5.1, 16-12-2021
========================================
* GtkWidget sizing has been rewritten to implement
width-for-height more properly. This had some fallout,
and some widgets may still not react kindly to the
new way of doing things.
See https://blog.gtk.org/2021/12/03/sizable-news/
for details, and please file issues if you notice fallout.
* Rename git `master` branch to `main`
* Css:
- Fully support font-variant-caps
- Fix a crash with gradients
* Make various widgets activatable:
- GtkComboBox
- GtkDropDown
* GtkPopover:
- Make focus indicators not disappear
* GtkTextView:
- Don't leave embedded children stranded when scrolling
- Don't insert Emoji into non-editable textviews
- Fix Emoji chooser positioning
- Fix problems with pasting text
- Improve scroll-to-mark behavior
- Support right-aligned, centered and decimal tabs
- Make child anchor replacement character settable
- Provide more context to input methods
* GtkDragIcon:
- Provide default icons for paintables and files
* GtkBuilder:
- Speed up template precompilation
* Actions:
- Reduce allocations during signal emissions
- Avoid duplication and unnecessary recursion
* Inspector:
- Show the selected im-module in the General tab
- Add a clipboard viewer
- Make the recorder record events too
- Add a graph visualizing gtk_widget_measure()
* Gsk:
- Fix hexbox rendering
- Fix transformed linear gradient rendering
* Printing:
- Fix dialog-less printing
* Windows:
- Use the common EGL setup code
- Respect GDK_DEBUG=gl-egl
- Fix AeroSnap indicator and positioning
* X11:
- Improve behavior of windows drags on headerbar controls
- Trap errors for RANDR changes
- Fix problems with drag icons
* Wayland:
- Ensure we prefer the Wayland im-module over others
* Translation updates
Basque
Catalan
Croatian
Friulian
Galician
Hebrew
Icelandic
Italian
Latvian
Lithuanian
Occitan
Persian
Portuguese
Spanish
Swedish
Ukrainian
Overview of Changes in 4.5.0
============================
+1 -1
View File
@@ -17,7 +17,7 @@ executable('gtk4-constraint-editor',
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
win_subsystem: 'windows',
gui_app: true,
link_args: extra_demo_ldflags,
install: false,
)
+1 -1
View File
@@ -21,7 +21,7 @@
<item>
<attribute name="label" translatable="yes">Save _As...</attribute>
<attribute name="action">app.save-as</attribute>
<attribute name="accel">&lt;Control&gt;&lt;Shift&gt;s</attribute>
<attribute name="accel">&lt;Control&gt;s</attribute>
</item>
</section>
<section>
+2 -2
View File
@@ -242,7 +242,7 @@ executable('gtk4-demo',
c_args: gtkdemo_args + demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
win_subsystem: 'windows',
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
@@ -252,7 +252,7 @@ executable('gtk4-demo-application',
c_args: gtkdemo_args + common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
win_subsystem: 'windows',
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
+1 -1
View File
@@ -16,7 +16,7 @@ executable('gtk4-icon-browser',
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
+1 -1
View File
@@ -3,7 +3,7 @@ demo_profile = get_option('profile')
demo_conf_h = declare_dependency(
sources: custom_target('demo-header',
command: [gen_demo_header, meson.project_source_root(), demo_profile],
command: [gen_demo_header, meson.source_root(), demo_profile],
capture: true,
output: 'demo_conf.h',
build_by_default: true,
+1 -1
View File
@@ -17,7 +17,7 @@ executable('gtk4-node-editor',
c_args: [
'-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())
] + common_cflags,
win_subsystem: 'windows',
gui_app: true,
link_args: extra_demo_ldflags,
install: false,
)
+1 -1
View File
@@ -3,7 +3,7 @@ executable('gtk4-print-editor',
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
+1 -1
View File
@@ -74,7 +74,7 @@ executable('gtk4-widget-factory',
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
-6
View File
@@ -1927,12 +1927,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="tooltip-text" translatable="1">Insert something</property>
</object>
</child>
<child>
<object class="GtkColorButton">
<property name="rgba">#9141AC</property>
<property name="tooltip-text" translatable="1">Select a color</property>
</object>
</child>
</object>
</child>
<child>
+8
View File
@@ -16,6 +16,7 @@ SYNOPSIS
| **gtk4-builder-tool** enumerate <FILE>
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
| **gtk4-builder-tool** precompile [OPTIONS...] <FILE>
DESCRIPTION
-----------
@@ -83,3 +84,10 @@ to do manual fixups after the initial conversion.
``--3to4``
Transform a GTK 3 UI definition file to the equivalent GTK 4 definitions.
Precompilation
^^^^^^^^^^^^^^
The ``precompile`` command creates a more compact, and faster to load compiled
form of the ui file that is understood by GtkBuilder. The output is written
to a file with the extension ``.precompiled``.
-9
View File
@@ -1276,15 +1276,6 @@ is provided in the form of a `GtkIconPaintable` (this can be checked with
[method@Gtk.IconPaintable.is_symbolic]), you have to call
[method@Gtk.IconPaintable.get_icon_name] and set the icon name on a `GtkImage`.
### Adapt to GtkImage changes
`GtkPicture`'s behaviour was "split out" of `GtkImage` as the latter was covering
too many use cases; if you're loading an icon, [class@Gtk.Image] in GTK3 and GTK4 are
perfectly equivalent. If you are loading a more complex image asset, like a picture
or a thumbnail, then [class@Gtk.Picture] is the appropriate widget.
One noteworthy distinction is that while `GtkImage` has its size computed by
GTK, `GtkPicture` lets you decide about the size.
### Update to GtkFileChooser API changes
`GtkFileChooser` moved to a GFile-based API. If you need to convert a path
+1 -1
View File
@@ -342,7 +342,7 @@ gdk_content_provider_write_mime_type_finish (GdkContentProvider *provider,
/**
* gdk_content_provider_get_value:
* @provider: a `GdkContentProvider`
* @value: (out caller-allocates): the `GValue` to fill
* @value: the `GValue` to fill
* @error: a `GError` location to store the error occurring
*
* Gets the contents of @provider stored in @value.
+61 -134
View File
@@ -19,7 +19,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
@@ -522,9 +522,7 @@ _gdk_event_queue_find_first (GdkDisplay *display)
if (pending_motion)
return pending_motion;
if ((event->event_type == GDK_MOTION_NOTIFY ||
(event->event_type == GDK_SCROLL && gdk_scroll_event_get_direction (event) == GDK_SCROLL_SMOOTH)) &&
(event->flags & GDK_EVENT_FLUSHED) == 0)
if (event->event_type == GDK_MOTION_NOTIFY && (event->flags & GDK_EVENT_FLUSHED) == 0)
pending_motion = tmp_list;
else
return tmp_list;
@@ -598,9 +596,6 @@ _gdk_event_unqueue (GdkDisplay *display)
/*
* If the last N events in the event queue are smooth scroll events
* for the same surface and device, combine them into one.
*
* We give the remaining event a history with N items, and deltas
* that are the sum over the history entries.
*/
void
gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
@@ -610,6 +605,7 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
GdkDevice *device = NULL;
GdkEvent *last_event = NULL;
GList *scrolls = NULL;
double delta_x, delta_y;
GArray *history = NULL;
GdkTimeCoord hist;
@@ -644,42 +640,35 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
l = l->prev;
}
delta_x = delta_y = 0;
while (scrolls && scrolls->next != NULL)
{
GdkEvent *event = scrolls->data;
GList *next = scrolls->next;
double dx, dy;
gboolean inherited = FALSE;
if (!history && ((GdkScrollEvent *)event)->history)
{
history = ((GdkScrollEvent *)event)->history;
((GdkScrollEvent *)event)->history = NULL;
inherited = TRUE;
}
if (!history)
history = g_array_new (FALSE, TRUE, sizeof (GdkTimeCoord));
if (!inherited)
{
gdk_scroll_event_get_deltas (event, &dx, &dy);
gdk_scroll_event_get_deltas (event, &dx, &dy);
delta_x += dx;
delta_y += dy;
memset (&hist, 0, sizeof (GdkTimeCoord));
hist.time = gdk_event_get_time (event);
hist.flags = GDK_AXIS_FLAG_DELTA_X | GDK_AXIS_FLAG_DELTA_Y;
hist.axes[GDK_AXIS_DELTA_X] = dx;
hist.axes[GDK_AXIS_DELTA_Y] = dy;
memset (&hist, 0, sizeof (GdkTimeCoord));
hist.time = gdk_event_get_time (event);
hist.flags = GDK_AXIS_FLAG_DELTA_X | GDK_AXIS_FLAG_DELTA_Y;
hist.axes[GDK_AXIS_DELTA_X] = dx;
hist.axes[GDK_AXIS_DELTA_Y] = dy;
g_array_append_val (history, hist);
}
g_array_append_val (history, hist);
gdk_event_unref (event);
g_queue_delete_link (&display->queued_events, scrolls);
scrolls = next;
}
if (scrolls && history)
if (scrolls)
{
GdkEvent *old_event, *event;
double dx, dy;
@@ -687,29 +676,13 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
old_event = scrolls->data;
gdk_scroll_event_get_deltas (old_event, &dx, &dy);
memset (&hist, 0, sizeof (GdkTimeCoord));
hist.time = gdk_event_get_time (old_event);
hist.flags = GDK_AXIS_FLAG_DELTA_X | GDK_AXIS_FLAG_DELTA_Y;
hist.axes[GDK_AXIS_DELTA_X] = dx;
hist.axes[GDK_AXIS_DELTA_Y] = dy;
g_array_append_val (history, hist);
dx = dy = 0;
for (int i = 0; i < history->len; i++)
{
GdkTimeCoord *val = &g_array_index (history, GdkTimeCoord, i);
dx += val->axes[GDK_AXIS_DELTA_X];
dy += val->axes[GDK_AXIS_DELTA_Y];
}
event = gdk_scroll_event_new (surface,
device,
gdk_event_get_device_tool (old_event),
gdk_event_get_time (old_event),
gdk_event_get_modifier_state (old_event),
dx,
dy,
delta_x + dx,
delta_y + dy,
gdk_scroll_event_is_stop (old_event));
((GdkScrollEvent *)event)->history = history;
@@ -741,41 +714,24 @@ gdk_motion_event_push_history (GdkEvent *event,
g_assert (GDK_IS_EVENT_TYPE (event, GDK_MOTION_NOTIFY));
g_assert (GDK_IS_EVENT_TYPE (history_event, GDK_MOTION_NOTIFY));
if (G_UNLIKELY (!self->history))
self->history = g_array_new (FALSE, TRUE, sizeof (GdkTimeCoord));
if (((GdkMotionEvent *)history_event)->history)
{
GArray *history = ((GdkMotionEvent *)history_event)->history;
g_array_append_vals (self->history, history->data, history->len);
}
if (!self->tool)
return;
tool = gdk_event_get_device_tool (history_event);
memset (&hist, 0, sizeof (GdkTimeCoord));
hist.time = gdk_event_get_time (history_event);
if (tool)
{
hist.flags = gdk_device_tool_get_axes (tool);
for (i = GDK_AXIS_X; i < GDK_AXIS_LAST; i++)
gdk_event_get_axis (history_event, i, &hist.axes[i]);
}
else
{
hist.flags = GDK_AXIS_FLAG_X | GDK_AXIS_FLAG_Y;
gdk_event_get_position (history_event, &hist.axes[GDK_AXIS_X], &hist.axes[GDK_AXIS_Y]);
}
hist.flags = gdk_device_tool_get_axes (tool);
for (i = GDK_AXIS_X; i < GDK_AXIS_LAST; i++)
gdk_event_get_axis (history_event, i, &hist.axes[i]);
if (G_UNLIKELY (!self->history))
self->history = g_array_new (FALSE, TRUE, sizeof (GdkTimeCoord));
g_array_append_val (self->history, hist);
}
/* If the last N events in the event queue are motion notify
* events for the same surface, drop all but the last.
*
* If a button is held down or the device has a tool, then
* we give the remaining events a history containing the N-1
* dropped events.
*/
void
_gdk_event_queue_handle_motion_compression (GdkDisplay *display)
{
@@ -785,6 +741,9 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
GdkDevice *pending_motion_device = NULL;
GdkEvent *last_motion = NULL;
/* If the last N events in the event queue are motion notify
* events for the same surface, drop all but the last */
tmp_list = g_queue_peek_tail_link (&display->queued_events);
while (tmp_list)
@@ -821,11 +780,12 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
if (last_motion != NULL)
{
if ((gdk_event_get_modifier_state (last_motion) &
(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK |
GDK_BUTTON4_MASK | GDK_BUTTON5_MASK)) ||
gdk_event_get_device_tool (last_motion) != NULL)
gdk_motion_event_push_history (last_motion, pending_motions->data);
GdkModifierType state = gdk_event_get_modifier_state (last_motion);
if (state &
(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK |
GDK_BUTTON4_MASK | GDK_BUTTON5_MASK))
gdk_motion_event_push_history (last_motion, pending_motions->data);
}
gdk_event_unref (pending_motions->data);
@@ -943,9 +903,6 @@ gdk_event_get_pointer_emulated (GdkEvent *event)
* Extract the axis value for a particular axis use from
* an event structure.
*
* To find out which axes are used, use [method@Gdk.DeviceTool.get_axes]
* on the device tool returned by [method@Gdk.Event.get_device_tool].
*
* Returns: %TRUE if the specified axis was found, otherwise %FALSE
*/
gboolean
@@ -1172,9 +1129,6 @@ G_DEFINE_BOXED_TYPE (GdkEventSequence, gdk_event_sequence,
*
* Extracts all axis values from an event.
*
* To find out which axes are used, use [method@Gdk.DeviceTool.get_axes]
* on the device tool returned by [method@Gdk.Event.get_device_tool].
*
* Returns: %TRUE on success, otherwise %FALSE
*/
gboolean
@@ -2477,14 +2431,6 @@ gdk_touchpad_event_get_state (GdkEvent *event)
return self->state;
}
static GdkEventSequence *
gdk_touchpad_event_get_sequence (GdkEvent *event)
{
GdkTouchpadEvent *self = (GdkTouchpadEvent *) event;
return self->sequence;
}
static gboolean
gdk_touchpad_event_get_position (GdkEvent *event,
double *x,
@@ -2504,7 +2450,7 @@ static const GdkEventTypeInfo gdk_touchpad_event_info = {
NULL,
gdk_touchpad_event_get_state,
gdk_touchpad_event_get_position,
gdk_touchpad_event_get_sequence,
NULL,
NULL,
NULL,
};
@@ -2515,28 +2461,19 @@ GDK_DEFINE_EVENT_TYPE (GdkTouchpadEvent, gdk_touchpad_event,
GDK_EVENT_TYPE_SLOT (GDK_TOUCHPAD_PINCH))
GdkEvent *
gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkEventSequence *sequence,
GdkDevice *device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
double x,
double y,
int n_fingers,
double dx,
double dy)
gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkDevice *device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
double x,
double y,
int n_fingers,
double dx,
double dy)
{
GdkTouchpadEvent *self;
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_SWIPE, surface, device, time);
g_return_val_if_fail (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_END ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_CANCEL, NULL);
self = gdk_event_alloc (GDK_TOUCHPAD_SWIPE, surface, device, time);
self->sequence = sequence;
self->state = state;
self->phase = phase;
self->x = x;
@@ -2549,30 +2486,21 @@ gdk_touchpad_event_new_swipe (GdkSurface *surface,
}
GdkEvent *
gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkEventSequence *sequence,
GdkDevice *device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
double x,
double y,
int n_fingers,
double dx,
double dy,
double scale,
double angle_delta)
gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkDevice *device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
double x,
double y,
int n_fingers,
double dx,
double dy,
double scale,
double angle_delta)
{
GdkTouchpadEvent *self;
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_PINCH, surface, device, time);
g_return_val_if_fail (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_END ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE ||
phase == GDK_TOUCHPAD_GESTURE_PHASE_CANCEL, NULL);
self = gdk_event_alloc (GDK_TOUCHPAD_PINCH, surface, device, time);
self->sequence = sequence;
self->state = state;
self->phase = phase;
self->x = x;
@@ -2979,8 +2907,7 @@ gdk_motion_event_new (GdkSurface *surface,
* to the application because they occurred in the same frame as @event.
*
* Note that only motion and scroll events record history, and motion
* events do it only if one of the mouse buttons is down, or the device
* has a tool.
* events do it only if one of the mouse buttons is down.
*
* Returns: (transfer container) (array length=out_n_coords) (nullable): an
* array of time and coordinates
+11 -14
View File
@@ -209,7 +209,7 @@ struct _GdkTouchEvent
* @pointer_emulated: whether the scroll event was the result of
* a pointer emulation
* @tool: a `GdkDeviceTool`
* @history: (element-type GdkTimeCoord): array of times and deltas
* @history: (element-type GdkScrollHistory): array of times and deltas
* for other scroll events that were compressed before delivering the
* current event
*
@@ -233,7 +233,7 @@ struct _GdkScrollEvent
gboolean pointer_emulated;
gboolean is_stop;
GdkDeviceTool *tool;
GArray *history; /* <GdkTimeCoord> */
GArray *history; /* <GdkScrollHistory> */
};
/*
@@ -402,7 +402,6 @@ struct _GdkTouchpadEvent
{
GdkEvent parent_instance;
GdkEventSequence *sequence;
GdkModifierType state;
gint8 phase;
gint8 n_fingers;
@@ -507,20 +506,18 @@ GdkEvent * gdk_touch_event_new (GdkEventType type,
double *axes,
gboolean emulating);
GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkEventSequence *sequence,
GdkDevice *device,
guint32 time,
GdkModifierType state,
GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkDevice *device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
double x,
double y,
int n_fingers,
double dx,
double dy);
double x,
double y,
int n_fingers,
double dx,
double dy);
GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkEventSequence *sequence,
GdkDevice *device,
guint32 time,
GdkModifierType state,
+11 -69
View File
@@ -151,12 +151,6 @@ unmask_context (MaskedContext *mask)
return GDK_GL_CONTEXT (GSIZE_TO_POINTER (GPOINTER_TO_SIZE (mask) & ~(gsize) 1));
}
static inline gboolean
mask_is_surfaceless (MaskedContext *mask)
{
return GPOINTER_TO_SIZE (mask) & (gsize) 1;
}
static void
unref_unmasked (gpointer data)
{
@@ -580,8 +574,8 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
glViewport (0, 0, ww, wh);
#ifdef HAVE_EGL
if (priv->egl_context && gdk_gl_context_check_version (context, 0, 0, 3, 0))
glDrawBuffers (1, (GLenum[1]) { gdk_gl_context_get_use_es (context) ? GL_BACK : GL_BACK_LEFT });
if (priv->egl_context)
glDrawBuffers (1, (GLenum[1]) { GL_BACK_LEFT });
#endif
}
@@ -1003,33 +997,16 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
}
gboolean
gdk_gl_context_check_version (GdkGLContext *self,
int required_gl_major,
int required_gl_minor,
int required_gles_major,
int required_gles_minor)
gdk_gl_context_check_version (GdkGLContext *context,
int required_major,
int required_minor)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_GL_CONTEXT (self), FALSE);
g_return_val_if_fail (required_gl_minor < 10, FALSE);
g_return_val_if_fail (required_gles_minor < 10, FALSE);
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), FALSE);
g_return_val_if_fail (required_minor < 10, FALSE);
if (!gdk_gl_context_is_realized (self))
return FALSE;
switch (priv->api)
{
case GDK_GL_API_GL:
return priv->gl_version >= required_gl_major * 10 + required_gl_minor;
case GDK_GL_API_GLES:
return priv->gl_version >= required_gles_major * 10 + required_gles_minor;
default:
g_return_val_if_reached (FALSE);
}
return priv->gl_version >= required_major * 10 + required_minor;
}
/**
@@ -1346,7 +1323,6 @@ gl_debug_message_callback (GLenum source,
const char *message_source;
const char *message_type;
const char *message_severity;
GLogLevelFlags log_level;
if (severity == GL_DEBUG_SEVERITY_NOTIFICATION)
return;
@@ -1408,31 +1384,22 @@ gl_debug_message_callback (GLenum source,
{
case GL_DEBUG_SEVERITY_HIGH:
message_severity = "High";
log_level = G_LOG_LEVEL_CRITICAL;
break;
case GL_DEBUG_SEVERITY_MEDIUM:
message_severity = "Medium";
log_level = G_LOG_LEVEL_WARNING;
break;
case GL_DEBUG_SEVERITY_LOW:
message_severity = "Low";
log_level = G_LOG_LEVEL_MESSAGE;
break;
case GL_DEBUG_SEVERITY_NOTIFICATION:
message_severity = "Notification";
log_level = G_LOG_LEVEL_INFO;
break;
default:
message_severity = "Unknown";
log_level = G_LOG_LEVEL_MESSAGE;
}
/* There's no higher level function taking a log level argument... */
g_log_structured_standard (G_LOG_DOMAIN, log_level,
__FILE__, G_STRINGIFY (__LINE__),
G_STRFUNC,
"OPENGL:\n Source: %s\n Type: %s\n Severity: %s\n Message: %s",
message_source, message_type, message_severity, message);
g_warning ("OPENGL:\n Source: %s\n Type: %s\n Severity: %s\n Message: %s",
message_source, message_type, message_severity, message);
}
/**
@@ -1688,31 +1655,6 @@ gdk_gl_context_clear_current (void)
}
}
/*<private>
* gdk_gl_context_clear_current_if_surface:
* @surface: surface to clear for
*
* Does a gdk_gl_context_clear_current() if the current context is attached
* to @surface, leaves the current context alone otherwise.
**/
void
gdk_gl_context_clear_current_if_surface (GdkSurface *surface)
{
MaskedContext *current;
current = g_private_get (&thread_current_context);
if (current != NULL && !mask_is_surfaceless (current))
{
GdkGLContext *context = unmask_context (current);
if (gdk_gl_context_get_surface (context) != surface)
return;
if (GDK_GL_CONTEXT_GET_CLASS (context)->clear_current (context))
g_private_replace (&thread_current_context, NULL);
}
}
/**
* gdk_gl_context_get_current:
*
+2 -6
View File
@@ -99,8 +99,6 @@ gboolean gdk_gl_backend_can_be_used (GdkGLBackend
GError **error);
void gdk_gl_backend_use (GdkGLBackend backend_type);
void gdk_gl_context_clear_current_if_surface (GdkSurface *surface);
GdkGLContext * gdk_gl_context_new (GdkDisplay *display,
GdkSurface *surface);
@@ -111,10 +109,8 @@ void gdk_gl_context_set_is_legacy (GdkGLContext
gboolean is_legacy);
gboolean gdk_gl_context_check_version (GdkGLContext *context,
int required_gl_major,
int required_gl_minor,
int required_gles_major,
int required_gles_minor);
int required_major,
int required_minor);
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
void gdk_gl_context_push_debug_group (GdkGLContext *context,
+2 -5
View File
@@ -21,7 +21,6 @@
#include "gdkgltextureprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkglcontextprivate.h"
#include "gdkmemoryformatprivate.h"
#include "gdkmemorytextureprivate.h"
#include "gdktextureprivate.h"
@@ -306,11 +305,9 @@ gdk_gl_texture_determine_format (GdkGLTexture *self)
GLint active_texture;
GLint internal_format;
/* Abort if somebody else is GL-ing here... */
if (self->context != gdk_gl_context_get_current () ||
/* ... or glGetTexLevelParameter() isn't supported */
!gdk_gl_context_check_version (self->context, 0, 0, 3, 1))
if (self->context != gdk_gl_context_get_current ())
{
/* Somebody else is GL-ing here, abort! */
texture->format = GDK_MEMORY_DEFAULT;
return;
}
-2
View File
@@ -1095,7 +1095,6 @@ gdk_surface_set_egl_native_window (GdkSurface *self,
if (priv->egl_surface != NULL)
{
gdk_gl_context_clear_current_if_surface (self);
eglDestroySurface (gdk_surface_get_display (self), priv->egl_surface);
priv->egl_surface = NULL;
}
@@ -1124,7 +1123,6 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
priv->egl_surface != NULL &&
gdk_display_get_egl_config_high_depth (display) != gdk_display_get_egl_config (display))
{
gdk_gl_context_clear_current_if_surface (self);
eglDestroySurface (gdk_surface_get_display (self), priv->egl_surface);
priv->egl_surface = NULL;
}
-1
View File
@@ -537,7 +537,6 @@ fill_pinch_event (GdkMacosDisplay *display,
seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
return gdk_touchpad_event_new_pinch (GDK_SURFACE (surface),
NULL, /* FIXME make up sequences */
gdk_seat_get_pointer (seat),
get_time_from_ns_event (nsevent),
get_keyboard_modifiers_from_ns_event (nsevent),
+4 -13
View File
@@ -137,7 +137,6 @@ struct _GdkWaylandPointerData {
guint cursor_timeout_id;
guint cursor_image_index;
guint cursor_image_delay;
guint touchpad_event_sequence;
guint current_output_scale;
GSList *pointer_surface_outputs;
@@ -1128,7 +1127,7 @@ data_offer_source_actions (void *data,
seat->pending_source_actions = gdk_wayland_actions_to_gdk_actions (source_actions);
return;
}
if (seat->drop == NULL)
return;
@@ -1153,7 +1152,7 @@ data_offer_action (void *data,
seat->pending_action = gdk_wayland_actions_to_gdk_actions (action);
return;
}
if (seat->drop == NULL)
return;
@@ -2165,7 +2164,7 @@ deliver_key_event (GdkWaylandSeat *seat,
key,
device_get_modifiers (seat->logical_pointer),
_gdk_wayland_keymap_key_is_modifier (keymap, key),
&translated,
&translated,
&no_lock);
_gdk_wayland_display_deliver_event (seat->display, event);
@@ -2668,11 +2667,7 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time;
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
seat->pointer_info.touchpad_event_sequence++;
event = gdk_touchpad_event_new_swipe (seat->pointer_info.focus,
GDK_SLOT_TO_EVENT_SEQUENCE (seat->pointer_info.touchpad_event_sequence),
seat->logical_pointer,
_time,
device_get_modifiers (seat->logical_pointer),
@@ -2768,11 +2763,7 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time;
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
seat->pointer_info.touchpad_event_sequence++;
event = gdk_touchpad_event_new_pinch (seat->pointer_info.focus,
GDK_SLOT_TO_EVENT_SEQUENCE (seat->pointer_info.touchpad_event_sequence),
seat->logical_pointer,
_time,
device_get_modifiers (seat->logical_pointer),
@@ -4097,7 +4088,7 @@ tablet_pad_strip_handle_frame (void *data,
event = gdk_pad_event_new_strip (seat->keyboard_focus,
pad->device,
time,
g_list_index (pad->mode_groups, group),
g_list_index (pad->mode_groups, group),
g_list_index (pad->strips, wp_tablet_pad_strip),
group->current_mode,
group->axis_tmp_info.value);
-39
View File
@@ -1662,7 +1662,6 @@ static TranslationEntry translations[] = {
{ FALSE, "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } },
{ FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
{ FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } },
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contast", G_TYPE_NONE, { .b = FALSE } },
/* Note, this setting doesn't exist, the portal and gsd fake it */
{ FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } },
};
@@ -1712,13 +1711,6 @@ find_translation_entry_by_setting (const char *setting)
return NULL;
}
static void
high_contrast_changed (GdkDisplay *display)
{
gdk_display_setting_changed (display, "gtk-theme-name");
gdk_display_setting_changed (display, "gtk-icon-theme-name");
}
static void
settings_changed (GSettings *settings,
const char *key,
@@ -1732,8 +1724,6 @@ settings_changed (GSettings *settings,
{
if (entry->type != G_TYPE_NONE)
gdk_display_setting_changed (display, entry->setting);
else if (strcmp (key, "high-contrast") == 0)
high_contrast_changed (display);
else
update_xft_settings (display);
}
@@ -2100,32 +2090,6 @@ set_decoration_layout_from_entry (GdkDisplay *display,
}
}
static void
set_theme_from_entry (GdkDisplay *display,
TranslationEntry *entry,
GValue *value)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
GSettings *settings = NULL;
GSettingsSchema *schema = NULL;
gboolean hc = FALSE;
settings = (GSettings *)g_hash_table_lookup (display_wayland->settings, "org.gnome.desktop.a11y.interface");
if (settings)
g_object_get (settings, "settings-schema", &schema, NULL);
if (schema && g_settings_schema_has_key (schema, "high-contrast"))
hc = g_settings_get_boolean (settings, "high-contrast");
g_clear_pointer (&schema, g_settings_schema_unref);
if (hc)
g_value_set_static_string (value, "HighContrast");
else
set_value_from_entry (display, entry, value);
}
static gboolean
set_capability_setting (GdkDisplay *display,
GValue *value,
@@ -2157,9 +2121,6 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
{
if (strcmp (name, "gtk-decoration-layout") == 0)
set_decoration_layout_from_entry (display, entry, value);
else if (strcmp (name, "gtk-theme-name") == 0 ||
strcmp (name, "gtk-icon-theme-name") == 0)
set_theme_from_entry (display, entry, value);
else
set_value_from_entry (display, entry, value);
return TRUE;
+84 -128
View File
@@ -653,7 +653,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
g_object_unref (frame_clock);
impl->hdc = GetDC (impl->handle);
impl->inhibit_configure = TRUE;
return surface;
}
@@ -1043,15 +1042,14 @@ gdk_win32_surface_do_move (GdkSurface *window,
}
void
gdk_win32_surface_resize (GdkSurface *surface,
int width,
int height)
gdk_win32_surface_resize (GdkSurface *window,
int width, int height)
{
RECT outer_rect;
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (GDK_IS_SURFACE (window));
if (GDK_SURFACE_DESTROYED (surface))
if (GDK_SURFACE_DESTROYED (window))
return;
if (width < 1)
@@ -1060,29 +1058,28 @@ gdk_win32_surface_resize (GdkSurface *surface,
height = 1;
GDK_NOTE (MISC, g_print ("gdk_win32_surface_resize: %p: %dx%d\n",
GDK_SURFACE_HWND (surface), width, height));
GDK_SURFACE_HWND (window), width, height));
if (surface->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
if (window->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
return;
get_outer_rect (surface, width, height, &outer_rect);
get_outer_rect (window, width, height, &outer_rect);
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,0,0,%ld,%ld,"
"NOACTIVATE|NOMOVE|NOZORDER)\n",
GDK_SURFACE_HWND (surface),
GDK_SURFACE_HWND (window),
outer_rect.right - outer_rect.left,
outer_rect.bottom - outer_rect.top));
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (surface),
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window),
SWP_NOZORDER_SPECIFIED,
0, 0,
outer_rect.right - outer_rect.left,
outer_rect.bottom - outer_rect.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER));
surface->resize_count += 1;
window->resize_count += 1;
if (!GDK_WIN32_SURFACE (surface)->force_recompute_size)
gdk_surface_request_layout (surface);
gdk_surface_request_layout (window);
}
static void
@@ -2498,41 +2495,35 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
}
static void
apply_snap (GdkSurface *surface,
GdkWin32AeroSnapState snap)
apply_snap (GdkSurface *window,
GdkWin32AeroSnapState snap)
{
GdkMonitor *monitor;
GdkDisplay *display;
display = gdk_surface_get_display (surface);
monitor = gdk_display_get_monitor_at_surface (display, surface);
display = gdk_surface_get_display (window);
monitor = gdk_display_get_monitor_at_surface (display, window);
switch (snap)
{
case GDK_WIN32_AEROSNAP_STATE_UNDETERMINED:
break;
case GDK_WIN32_AEROSNAP_STATE_MAXIMIZE:
unsnap (surface, monitor);
gdk_win32_surface_maximize (surface);
unsnap (window, monitor);
gdk_win32_surface_maximize (window);
break;
case GDK_WIN32_AEROSNAP_STATE_HALFLEFT:
unsnap (surface, monitor);
snap_left (surface, monitor, monitor);
unsnap (window, monitor);
snap_left (window, monitor, monitor);
break;
case GDK_WIN32_AEROSNAP_STATE_HALFRIGHT:
unsnap (surface, monitor);
snap_right (surface, monitor, monitor);
unsnap (window, monitor);
snap_right (window, monitor, monitor);
break;
case GDK_WIN32_AEROSNAP_STATE_FULLUP:
snap_up (surface);
snap_up (window);
break;
}
if (snap != GDK_WIN32_AEROSNAP_STATE_UNDETERMINED)
{
GDK_WIN32_SURFACE (surface)->inhibit_configure = TRUE;
GDK_WIN32_SURFACE (surface)->force_recompute_size = FALSE;
}
}
/* Registers a dumb window class. This window
@@ -3412,10 +3403,10 @@ get_cursor_name_from_op (GdkW32WindowDragOp op,
}
static void
setup_drag_move_resize_context (GdkSurface *surface,
setup_drag_move_resize_context (GdkSurface *window,
GdkW32DragMoveResizeContext *context,
GdkW32WindowDragOp op,
GdkSurfaceEdge edge,
GdkSurfaceEdge edge,
GdkDevice *device,
int button,
double x,
@@ -3424,13 +3415,12 @@ setup_drag_move_resize_context (GdkSurface *surface,
{
RECT rect;
const char *cursor_name;
GdkSurface *pointer_surface;
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
gboolean maximized = gdk_toplevel_get_state (GDK_TOPLEVEL (surface)) & GDK_TOPLEVEL_STATE_MAXIMIZED;
GdkSurface *pointer_window;
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
gboolean maximized = gdk_toplevel_get_state (GDK_TOPLEVEL (window)) & GDK_TOPLEVEL_STATE_MAXIMIZED;
int root_x, root_y;
gboolean restore_configure = FALSE;
gdk_win32_surface_get_root_coords (surface, x, y, &root_x, &root_y);
gdk_win32_surface_get_root_coords (window, x, y, &root_x, &root_y);
/* Before we drag, we need to undo any maximization or snapping.
* AeroSnap behaviour:
@@ -3453,7 +3443,7 @@ setup_drag_move_resize_context (GdkSurface *surface,
* resize
* don't unsnap
* apply new width and x position to unsnapped cache,
* so that unsnapped surface only regains its height
* so that unsnapped window only regains its height
* and y position, but inherits x and width from
* the fullup snapped state
* vertical resize:
@@ -3468,7 +3458,7 @@ setup_drag_move_resize_context (GdkSurface *surface,
*
* TODO: make this implementation behave as AeroSnap on resizes?
* There's also the case where
* a halfleft/halfright surface isn't unsnapped when it's
* a halfleft/halfright window isn't unsnapped when it's
* being moved horizontally, but it's more difficult to implement.
*/
if (op == GDK_WIN32_DRAGOP_RESIZE &&
@@ -3476,8 +3466,7 @@ setup_drag_move_resize_context (GdkSurface *surface,
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFLEFT ||
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_FULLUP))
{
discard_snapinfo (surface);
restore_configure = TRUE;
discard_snapinfo (window);
}
else if (maximized ||
(impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT ||
@@ -3487,25 +3476,24 @@ setup_drag_move_resize_context (GdkSurface *surface,
GdkMonitor *monitor;
int wx, wy, wwidth, wheight;
int swx, swy, swwidth, swheight;
gboolean pointer_outside_of_surface;
gboolean pointer_outside_of_window;
int offsetx, offsety;
gboolean left_half;
GdkDisplay *display;
restore_configure = TRUE;
display = gdk_surface_get_display (surface);
monitor = gdk_display_get_monitor_at_surface (display, surface);
gdk_surface_get_geometry (surface, &wx, &wy, &wwidth, &wheight);
display = gdk_surface_get_display (window);
monitor = gdk_display_get_monitor_at_surface (display, window);
gdk_surface_get_geometry (window, &wx, &wy, &wwidth, &wheight);
swx = wx;
swy = wy;
swwidth = wwidth;
swheight = wheight;
/* Subtract surface shadow. We don't want pointer to go outside of
* the visible surface during drag-move. For drag-resize it's OK.
* Don't take shadow into account if the surface is maximized -
* maximized surfaces don't have shadows.
/* Subtract window shadow. We don't want pointer to go outside of
* the visible window during drag-move. For drag-resize it's OK.
* Don't take shadow into account if the window is maximized -
* maximized windows don't have shadows.
*/
if (op == GDK_WIN32_DRAGOP_MOVE && !maximized)
{
@@ -3515,16 +3503,16 @@ setup_drag_move_resize_context (GdkSurface *surface,
swheight -= impl->shadow_y;
}
pointer_outside_of_surface = root_x < swx || root_x > swx + swwidth ||
pointer_outside_of_window = root_x < swx || root_x > swx + swwidth ||
root_y < swy || root_y > swy + swheight;
/* Calculate the offset of the pointer relative to the surface */
/* Calculate the offset of the pointer relative to the window */
offsetx = root_x - swx;
offsety = root_y - swy;
/* Figure out in which half of the surface the pointer is.
/* Figure out in which half of the window the pointer is.
* The code currently only concerns itself with horizontal
* dimension (left/right halves).
* There's no upper/lower half, because usually surface
* There's no upper/lower half, because usually window
* is dragged by its upper half anyway. If that changes, adjust
* accordingly.
*/
@@ -3534,26 +3522,26 @@ setup_drag_move_resize_context (GdkSurface *surface,
if (!left_half)
offsetx = swwidth - offsetx;
GDK_NOTE (MISC, g_print ("Pointer at %d : %d, this is %d : %d relative to the surface's %s\n",
GDK_NOTE (MISC, g_print ("Pointer at %d : %d, this is %d : %d relative to the window's %s\n",
root_x, root_y, offsetx, offsety,
left_half ? "left half" : "right half"));
/* Move surface in such a way that on unmaximization/unsnapping the pointer
* is still pointing at the appropriate half of the surface,
/* Move window in such a way that on unmaximization/unsnapping the pointer
* is still pointing at the appropriate half of the window,
* with the same offset from the left or right edge. If the new
* surface size is too small, and adding that offset puts the pointer
* window size is too small, and adding that offset puts the pointer
* into the other half or even beyond, move the pointer to the middle.
*/
if (!pointer_outside_of_surface && maximized)
if (!pointer_outside_of_window && maximized)
{
WINDOWPLACEMENT placement;
int unmax_width, unmax_height;
int shadow_unmax_width, shadow_unmax_height;
placement.length = sizeof (placement);
API_CALL (GetWindowPlacement, (GDK_SURFACE_HWND (surface), &placement));
API_CALL (GetWindowPlacement, (GDK_SURFACE_HWND (window), &placement));
GDK_NOTE (MISC, g_print ("W32 WM unmaximized surface placement is %ld x %ld @ %ld : %ld\n",
GDK_NOTE (MISC, g_print ("W32 WM unmaximized window placement is %ld x %ld @ %ld : %ld\n",
placement.rcNormalPosition.right - placement.rcNormalPosition.left,
placement.rcNormalPosition.bottom - placement.rcNormalPosition.top,
placement.rcNormalPosition.left,
@@ -3599,9 +3587,9 @@ setup_drag_move_resize_context (GdkSurface *surface,
placement.rcNormalPosition.left,
placement.rcNormalPosition.top));
API_CALL (SetWindowPlacement, (GDK_SURFACE_HWND (surface), &placement));
API_CALL (SetWindowPlacement, (GDK_SURFACE_HWND (window), &placement));
}
else if (!pointer_outside_of_surface && impl->snap_stash_int)
else if (!pointer_outside_of_window && impl->snap_stash_int)
{
GdkRectangle new_pos;
GdkRectangle snew_pos;
@@ -3631,22 +3619,22 @@ setup_drag_move_resize_context (GdkSurface *surface,
new_pos.y = root_y - new_pos.height / 2;
}
GDK_NOTE (MISC, g_print ("Unsnapped surface to %d : %d\n",
GDK_NOTE (MISC, g_print ("Unsnapped window to %d : %d\n",
new_pos.x, new_pos.y));
discard_snapinfo (surface);
gdk_win32_surface_move_resize (surface, new_pos.x, new_pos.y,
discard_snapinfo (window);
gdk_win32_surface_move_resize (window, new_pos.x, new_pos.y,
new_pos.width, new_pos.height);
}
if (maximized)
gdk_win32_surface_unmaximize (surface);
gdk_win32_surface_unmaximize (window);
else
unsnap (surface, monitor);
unsnap (window, monitor);
if (pointer_outside_of_surface)
if (pointer_outside_of_window)
{
/* Pointer outside of the surface, move pointer into surface */
/* Pointer outside of the window, move pointer into window */
GDK_NOTE (MISC, g_print ("Pointer at %d : %d is outside of %d x %d @ %d : %d, move it to %d : %d\n",
root_x, root_y, wwidth, wheight, wx, wy, wx + wwidth / 2, wy + wheight / 2));
root_x = wx + wwidth / 2;
@@ -3659,29 +3647,26 @@ setup_drag_move_resize_context (GdkSurface *surface,
}
}
if (restore_configure)
impl->inhibit_configure = FALSE;
_gdk_win32_get_window_rect (surface, &rect);
_gdk_win32_get_window_rect (window, &rect);
cursor_name = get_cursor_name_from_op (op, edge);
context->cursor = gdk_cursor_new_from_name (cursor_name, NULL);
pointer_surface = surface;
pointer_window = window;
/* Note: This triggers a WM_CAPTURECHANGED, which will trigger
* gdk_win32_surface_end_move_resize_drag(), which will end
* our op before it even begins, but only if context->op is not NONE.
* This is why we first do the grab, *then* set the op.
*/
gdk_device_grab (device, pointer_surface,
gdk_device_grab (device, pointer_window,
FALSE,
GDK_ALL_EVENTS_MASK,
context->cursor,
timestamp);
context->window = g_object_ref (surface);
context->window = g_object_ref (window);
context->op = op;
context->edge = edge;
context->device = device;
@@ -3701,10 +3686,10 @@ setup_drag_move_resize_context (GdkSurface *surface,
calculate_aerosnap_regions (context);
GDK_NOTE (EVENTS,
g_print ("begin drag moveresize: surface %p, toplevel %p, "
g_print ("begin drag moveresize: window %p, toplevel %p, "
"op %u, edge %d, device %p, "
"button %d, coord %d:%d, time %u\n",
pointer_surface, surface,
pointer_window, window,
context->op, context->edge, context->device,
context->button, context->start_root_x,
context->start_root_y, context->timestamp));
@@ -4099,61 +4084,45 @@ gdk_win32_surface_minimize (GdkSurface *window)
}
static void
gdk_win32_surface_maximize (GdkSurface *surface)
gdk_win32_surface_maximize (GdkSurface *window)
{
GdkWin32Surface *impl;
g_return_if_fail (GDK_IS_SURFACE (window));
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface))
if (GDK_SURFACE_DESTROYED (window))
return;
GDK_NOTE (MISC, g_print ("gdk_surface_maximize: %p: %s\n",
GDK_SURFACE_HWND (surface),
_gdk_win32_surface_state_to_string (surface->state)));
GDK_SURFACE_HWND (window),
_gdk_win32_surface_state_to_string (window->state)));
impl = GDK_WIN32_SURFACE (surface);
impl->inhibit_configure = TRUE;
impl->force_recompute_size = FALSE;
if (GDK_SURFACE_IS_MAPPED (surface))
GtkShowWindow (surface, SW_MAXIMIZE);
if (GDK_SURFACE_IS_MAPPED (window))
GtkShowWindow (window, SW_MAXIMIZE);
else
gdk_synthesize_surface_state (surface,
gdk_synthesize_surface_state (window,
0,
GDK_TOPLEVEL_STATE_MAXIMIZED);
}
static void
gdk_win32_surface_unmaximize (GdkSurface *surface)
gdk_win32_surface_unmaximize (GdkSurface *window)
{
GdkWin32Surface *impl;
g_return_if_fail (GDK_IS_SURFACE (window));
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface))
if (GDK_SURFACE_DESTROYED (window))
return;
GDK_NOTE (MISC, g_print ("gdk_surface_unmaximize: %p: %s\n",
GDK_SURFACE_HWND (surface),
_gdk_win32_surface_state_to_string (surface->state)));
GDK_SURFACE_HWND (window),
_gdk_win32_surface_state_to_string (window->state)));
_gdk_win32_surface_invalidate_egl_framebuffer (surface);
_gdk_win32_surface_invalidate_egl_framebuffer (window);
if (GDK_SURFACE_IS_MAPPED (surface))
GtkShowWindow (surface, SW_RESTORE);
if (GDK_SURFACE_IS_MAPPED (window))
GtkShowWindow (window, SW_RESTORE);
else
gdk_synthesize_surface_state (surface,
gdk_synthesize_surface_state (window,
GDK_TOPLEVEL_STATE_MAXIMIZED,
0);
impl = GDK_WIN32_SURFACE (surface);
if (impl->inhibit_configure)
{
impl->inhibit_configure = FALSE;
impl->force_recompute_size = TRUE;
}
}
static void
@@ -4578,9 +4547,6 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
&surface->x, &surface->y,
NULL, NULL);
}
if (!impl->inhibit_configure)
impl->force_recompute_size = TRUE;
}
}
@@ -4595,18 +4561,8 @@ _gdk_win32_surface_compute_size (GdkSurface *surface)
if (!impl->drag_move_resize_context.native_move_resize_pending)
{
if (GDK_IS_TOPLEVEL (surface) && impl->force_recompute_size)
{
surface->width = width;
surface->height = height;
gdk_win32_surface_resize (surface, width, height);
impl->force_recompute_size = FALSE;
}
else
{
surface->width = impl->next_layout.configured_width;
surface->height = impl->next_layout.configured_height;
}
surface->width = impl->next_layout.configured_width;
surface->height = impl->next_layout.configured_height;
_gdk_surface_update_size (surface);
}
-1
View File
@@ -337,7 +337,6 @@ struct _GdkWin32Surface
int configured_height;
RECT configured_rect;
} next_layout;
gboolean force_recompute_size;
#ifdef HAVE_EGL
guint egl_force_redraw_all : 1;
+3 -5
View File
@@ -1665,7 +1665,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
direction,
FALSE);
}
else
{
@@ -1799,7 +1799,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
x, y,
axes);
}
break;
@@ -1838,7 +1838,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
event = gdk_touch_event_new (ev->evtype == XI_TouchBegin
? GDK_TOUCH_BEGIN
: GDK_TOUCH_END,
@@ -1946,7 +1946,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
y = (double) xev->event_y / scale;
event = gdk_touchpad_event_new_pinch (surface,
NULL, /* FIXME make up sequences */
device,
xev->time,
state,
@@ -2007,7 +2006,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
y = (double) xev->event_y / scale;
event = gdk_touchpad_event_new_swipe (surface,
NULL, /* FIXME make up sequences */
device,
xev->time,
state,
-2
View File
@@ -71,8 +71,6 @@ gdk_x11_surface_destroy_glx_drawable (GdkX11Surface *self)
if (self->glx_drawable == None)
return;
gdk_gl_context_clear_current_if_surface (GDK_SURFACE (self));
glXDestroyWindow (gdk_x11_display_get_xdisplay (gdk_surface_get_display (GDK_SURFACE (self))),
self->glx_drawable);
+3 -3
View File
@@ -952,9 +952,9 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
guint program = 0;
guint width = 0;
guint height = 0;
G_GNUC_UNUSED guint n_binds = 0;
guint n_binds = 0;
guint n_fbos = 0;
G_GNUC_UNUSED guint n_uniforms = 0;
guint n_uniforms = 0;
guint n_programs = 0;
guint vao_id;
guint vbo_id;
@@ -1396,7 +1396,7 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self,
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, data);
}
else if (stride % bpp == 0 &&
(gdk_gl_context_check_version (context, 0, 0, 3, 0) || gdk_gl_context_has_unpack_subimage (context)))
(!use_es || gdk_gl_context_check_version (context, 3, 0) || gdk_gl_context_has_unpack_subimage (context)))
{
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / bpp);
+3 -8
View File
@@ -4117,19 +4117,14 @@ gsk_gl_render_job_set_debug_fallback (GskGLRenderJob *job,
}
static int
get_framebuffer_format (GdkGLContext *context,
guint framebuffer)
get_framebuffer_format (guint framebuffer)
{
int size;
if (!gdk_gl_context_check_version (context, 0, 0, 3, 0))
return GL_RGBA8;
glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER,
framebuffer ? GL_COLOR_ATTACHMENT0
: gdk_gl_context_get_use_es (context) ? GL_BACK
: GL_BACK_LEFT,
: GL_BACK_LEFT,
GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &size);
if (size > 16)
@@ -4166,7 +4161,7 @@ gsk_gl_render_job_new (GskGLDriver *driver,
job->scale_x = scale_factor;
job->scale_y = scale_factor;
job->viewport = *viewport;
job->target_format = get_framebuffer_format (job->command_queue->context, framebuffer);
job->target_format = get_framebuffer_format (framebuffer);
gsk_gl_render_job_set_alpha (job, 1.0f);
gsk_gl_render_job_set_projection_from_rect (job, viewport, NULL);
+5 -14
View File
@@ -356,8 +356,6 @@ compare (gconstpointer *elem1,
const GskDiffSettings *settings,
gpointer data)
{
GskDiffResult res;
/*
* Shrink the box by walking through each diagonal snake (SW and NE).
*/
@@ -366,9 +364,7 @@ compare (gconstpointer *elem1,
if (settings->compare_func (elem1[off1], elem2[off2], data) != 0)
break;
res = settings->keep_func (elem1[off1], elem2[off2], data);
if (res != GSK_DIFF_OK)
return res;
settings->keep_func (elem1[off1], elem2[off2], data);
}
for (; off1 < lim1 && off2 < lim2; lim1--, lim2--)
@@ -376,9 +372,7 @@ compare (gconstpointer *elem1,
if (settings->compare_func (elem1[lim1 - 1], elem2[lim2 - 1], data) != 0)
break;
res = settings->keep_func (elem1[lim1 - 1], elem2[lim2 - 1], data);
if (res != GSK_DIFF_OK)
return res;
settings->keep_func (elem1[lim1 - 1], elem2[lim2 - 1], data);
}
/*
@@ -389,23 +383,20 @@ compare (gconstpointer *elem1,
{
for (; off2 < lim2; off2++)
{
res = settings->insert_func (elem2[off2], off2, data);
if (res != GSK_DIFF_OK)
return res;
settings->insert_func (elem2[off2], off2, data);
}
}
else if (off2 == lim2)
{
for (; off1 < lim1; off1++)
{
res = settings->delete_func (elem1[off1], off1, data);
if (res != GSK_DIFF_OK)
return res;
settings->delete_func (elem1[off1], off1, data);
}
}
else
{
SplitResult spl = { 0, };
GskDiffResult res;
/*
* Divide ...
+3 -3
View File
@@ -29,9 +29,9 @@ typedef enum {
GSK_DIFF_ABORTED,
} GskDiffResult;
typedef GskDiffResult (* GskKeepFunc) (gconstpointer elem1, gconstpointer elem2, gpointer data);
typedef GskDiffResult (* GskDeleteFunc) (gconstpointer elem, gsize idx, gpointer data);
typedef GskDiffResult (* GskInsertFunc) (gconstpointer elem, gsize idx, gpointer data);
typedef void (* GskKeepFunc) (gconstpointer elem1, gconstpointer elem2, gpointer data);
typedef void (* GskDeleteFunc) (gconstpointer elem, gsize idx, gpointer data);
typedef void (* GskInsertFunc) (gconstpointer elem, gsize idx, gpointer data);
typedef struct _GskDiffSettings GskDiffSettings;
+13 -22
View File
@@ -33,12 +33,6 @@
#include <hb-ot.h>
/* maximal number of rectangles we keep in a diff region before we throw
* the towel and just use the bounding box of the parent node.
* Meant to avoid performance corner cases.
*/
#define MAX_RECTS_IN_DIFF 30
static inline void
gsk_cairo_rectangle (cairo_t *cr,
const graphene_rect_t *rect)
@@ -2607,35 +2601,32 @@ gsk_container_node_draw (GskRenderNode *node,
}
}
static void
gsk_render_node_add_to_region (GskRenderNode *node,
cairo_region_t *region)
{
cairo_rectangle_int_t rect;
rectangle_init_from_graphene (&rect, &node->bounds);
cairo_region_union_rectangle (region, &rect);
}
static int
gsk_container_node_compare_func (gconstpointer elem1, gconstpointer elem2, gpointer data)
{
return gsk_render_node_can_diff ((const GskRenderNode *) elem1, (const GskRenderNode *) elem2) ? 0 : 1;
}
static GskDiffResult
static void
gsk_container_node_keep_func (gconstpointer elem1, gconstpointer elem2, gpointer data)
{
gsk_render_node_diff ((GskRenderNode *) elem1, (GskRenderNode *) elem2, data);
if (cairo_region_num_rectangles (data) > MAX_RECTS_IN_DIFF)
return GSK_DIFF_ABORTED;
return GSK_DIFF_OK;
}
static GskDiffResult
static void
gsk_container_node_change_func (gconstpointer elem, gsize idx, gpointer data)
{
const GskRenderNode *node = elem;
cairo_region_t *region = data;
cairo_rectangle_int_t rect;
rectangle_init_from_graphene (&rect, &node->bounds);
cairo_region_union_rectangle (region, &rect);
if (cairo_region_num_rectangles (region) > MAX_RECTS_IN_DIFF)
return GSK_DIFF_ABORTED;
return GSK_DIFF_OK;
gsk_render_node_add_to_region ((GskRenderNode *) elem, data);
}
static GskDiffSettings *
-3
View File
@@ -334,9 +334,6 @@ get_index_in_parent (GtkWidget *widget)
GtkWidget *child;
int idx;
if (parent == NULL)
return -1;
idx = 0;
for (child = gtk_widget_get_first_child (parent);
child;
+1 -1
View File
@@ -66,7 +66,7 @@ for f in get_files('theme/Default/assets-hc', '.svg'):
xml += ' <file preprocess=\'xml-stripblanks\'>theme/Default/assets-hc/{0}</file>\n'.format(f)
for f in get_files('ui', '.ui'):
xml += ' <file>ui/{0}</file>\n'.format(f)
xml += ' <file alias="ui/{0}">ui/{0}.precompiled</file>\n'.format(f)
xml += '\n'
+1 -3
View File
@@ -435,11 +435,9 @@ gtk_application_window_measure (GtkWidget *widget,
gtk_widget_measure (priv->menubar, GTK_ORIENTATION_VERTICAL,
for_size, &menubar_height, NULL, NULL, NULL);
GTK_WIDGET_CLASS (gtk_application_window_parent_class)->measure (widget,
orientation,
for_size > -1 ?
for_size - menubar_height : -1,
for_size - menubar_height,
minimum, natural,
minimum_baseline, natural_baseline);
+4 -22
View File
@@ -546,7 +546,7 @@ gtk_bitset_union (GtkBitset *self,
{
g_return_if_fail (self != NULL);
g_return_if_fail (other != NULL);
if (self == other)
return;
@@ -571,7 +571,7 @@ gtk_bitset_intersect (GtkBitset *self,
{
g_return_if_fail (self != NULL);
g_return_if_fail (other != NULL);
if (self == other)
return;
@@ -596,7 +596,7 @@ gtk_bitset_subtract (GtkBitset *self,
{
g_return_if_fail (self != NULL);
g_return_if_fail (other != NULL);
if (self == other)
{
roaring_bitmap_clear (&self->roaring);
@@ -626,7 +626,7 @@ gtk_bitset_difference (GtkBitset *self,
{
g_return_if_fail (self != NULL);
g_return_if_fail (other != NULL);
if (self == other)
{
roaring_bitmap_clear (&self->roaring);
@@ -756,24 +756,6 @@ gtk_bitset_splice (GtkBitset *self,
G_STATIC_ASSERT (sizeof (GtkBitsetIter) >= sizeof (roaring_uint32_iterator_t));
static GtkBitsetIter *
gtk_bitset_iter_copy (GtkBitsetIter *iter)
{
roaring_uint32_iterator_t *riter = (roaring_uint32_iterator_t *) iter;
return (GtkBitsetIter *) roaring_copy_uint32_iterator (riter);
}
static void
gtk_bitset_iter_free (GtkBitsetIter *iter)
{
roaring_uint32_iterator_t *riter = (roaring_uint32_iterator_t *) iter;
roaring_free_uint32_iterator (riter);
}
G_DEFINE_BOXED_TYPE (GtkBitsetIter, gtk_bitset_iter, gtk_bitset_iter_copy, gtk_bitset_iter_free)
/**
* gtk_bitset_iter_init_first:
* @iter: (out): a pointer to an uninitialized `GtkBitsetIter`
+2 -3
View File
@@ -148,9 +148,6 @@ struct _GtkBitsetIter
gpointer private_data[10];
};
GDK_AVAILABLE_IN_4_6
GType gtk_bitset_iter_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
gboolean gtk_bitset_iter_init_first (GtkBitsetIter *iter,
const GtkBitset *set,
@@ -174,6 +171,8 @@ GDK_AVAILABLE_IN_ALL
guint gtk_bitset_iter_get_value (const GtkBitsetIter *iter);
GDK_AVAILABLE_IN_ALL
gboolean gtk_bitset_iter_is_valid (const GtkBitsetIter *iter);
G_END_DECLS
+1 -1
View File
@@ -942,7 +942,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
while (TRUE)
{
GtkCssTransform transform = { 0, };
GtkCssTransform transform;
if (gtk_css_parser_has_function (parser, "matrix"))
{
-25
View File
@@ -285,31 +285,6 @@ typedef enum
GTK_MOVEMENT_HORIZONTAL_PAGES
} GtkMovementStep;
/**
* GtkNaturalWrapMode:
* @GTK_NATURAL_WRAP_INHERIT: Inherit the minimum size request.
* In particular, this should be used with %PANGO_WRAP_CHAR.
* @GTK_NATURAL_WRAP_NONE: Try not to wrap the text. This mode is the
* closest to GTK3's behavior but can lead to a wide label leaving
* lots of empty space below the text.
* @GTK_NATURAL_WRAP_WORD: Attempt to wrap at word boundaries. This
* is useful in particular when using %PANGO_WRAP_WORD_CHAR as the
* wrap mode.
*
* Options for selecting a different wrap mode for natural size
* requests.
*
* See for example the [property@Gtk.Label:natural-wrap-mode] property.
*
* Since: 4.6
*/
typedef enum
{
GTK_NATURAL_WRAP_INHERIT,
GTK_NATURAL_WRAP_NONE,
GTK_NATURAL_WRAP_WORD
} GtkNaturalWrapMode;
/**
* GtkScrollStep:
* @GTK_SCROLL_STEPS: Scroll in steps.
+19 -130
View File
@@ -272,7 +272,6 @@ struct _GtkLabel
guint ellipsize : 3;
guint use_markup : 1;
guint wrap_mode : 3;
guint natural_wrap_mode : 3;
guint single_line_mode : 1;
guint in_click : 1;
guint track_links : 1;
@@ -381,7 +380,6 @@ enum {
PROP_JUSTIFY,
PROP_WRAP,
PROP_WRAP_MODE,
PROP_NATURAL_WRAP_MODE,
PROP_SELECTABLE,
PROP_MNEMONIC_KEYVAL,
PROP_MNEMONIC_WIDGET,
@@ -486,9 +484,6 @@ gtk_label_set_property (GObject *object,
case PROP_WRAP_MODE:
gtk_label_set_wrap_mode (self, g_value_get_enum (value));
break;
case PROP_NATURAL_WRAP_MODE:
gtk_label_set_natural_wrap_mode (self, g_value_get_enum (value));
break;
case PROP_SELECTABLE:
gtk_label_set_selectable (self, g_value_get_boolean (value));
break;
@@ -556,9 +551,6 @@ gtk_label_get_property (GObject *object,
case PROP_WRAP_MODE:
g_value_set_enum (value, self->wrap_mode);
break;
case PROP_NATURAL_WRAP_MODE:
g_value_set_enum (value, self->natural_wrap_mode);
break;
case PROP_SELECTABLE:
g_value_set_boolean (value, gtk_label_get_selectable (self));
break;
@@ -612,7 +604,6 @@ gtk_label_init (GtkLabel *self)
self->jtype = GTK_JUSTIFY_LEFT;
self->wrap = FALSE;
self->wrap_mode = PANGO_WRAP_WORD;
self->natural_wrap_mode = GTK_NATURAL_WRAP_INHERIT;
self->ellipsize = PANGO_ELLIPSIZE_NONE;
self->use_underline = FALSE;
@@ -1167,34 +1158,6 @@ get_height_for_width (GtkLabel *self,
g_object_unref (layout);
}
static int
my_pango_layout_get_width_for_height (PangoLayout *layout,
int for_height,
int min,
int max)
{
int mid, text_width, text_height;
min = PANGO_PIXELS_CEIL (min);
max = PANGO_PIXELS_CEIL (max);
while (min < max)
{
mid = (min + max) / 2;
pango_layout_set_width (layout, mid * PANGO_SCALE);
pango_layout_get_size (layout, &text_width, &text_height);
text_width = PANGO_PIXELS_CEIL (text_width);
if (text_width > mid)
min = mid = text_width;
else if (text_height > for_height)
min = mid + 1;
else
max = mid;
}
return min * PANGO_SCALE;
}
static void
get_width_for_height (GtkLabel *self,
int height,
@@ -1220,7 +1183,7 @@ get_width_for_height (GtkLabel *self,
}
else
{
int min, max;
int min, max, mid, text_width, text_height;
/* Can't use a measuring layout here, because we need to force
* ellipsizing mode */
@@ -1235,19 +1198,24 @@ get_width_for_height (GtkLabel *self,
pango_layout_set_width (layout, -1);
pango_layout_get_size (layout, &max, NULL);
/* first, do natural width */
if (self->natural_wrap_mode == GTK_NATURAL_WRAP_NONE)
min = PANGO_PIXELS_CEIL (min);
max = PANGO_PIXELS_CEIL (max);
while (min < max)
{
*natural_width = max;
}
else
{
if (self->natural_wrap_mode == GTK_NATURAL_WRAP_WORD)
pango_layout_set_wrap (layout, PANGO_WRAP_WORD);
*natural_width = my_pango_layout_get_width_for_height (layout, height, min, max);
mid = (min + max) / 2;
pango_layout_set_width (layout, mid * PANGO_SCALE);
pango_layout_get_size (layout, &text_width, &text_height);
text_width = PANGO_PIXELS_CEIL (text_width);
if (text_width > mid)
min = mid = text_width;
else if (text_height > height)
min = mid + 1;
else
max = mid;
}
/* then, do minimum width */
*natural_width = min * PANGO_SCALE;
if (self->ellipsize != PANGO_ELLIPSIZE_NONE)
{
g_object_unref (layout);
@@ -1255,14 +1223,9 @@ get_width_for_height (GtkLabel *self,
pango_layout_get_size (layout, minimum_width, NULL);
*minimum_width = MAX (*minimum_width, minimum_default);
}
else if (self->natural_wrap_mode == GTK_NATURAL_WRAP_INHERIT)
{
*minimum_width = *natural_width;
}
else
{
pango_layout_set_wrap (layout, self->wrap_mode);
*minimum_width = my_pango_layout_get_width_for_height (layout, height, min, *natural_width);
*minimum_width = *natural_width;
}
}
@@ -2393,9 +2356,6 @@ gtk_label_class_init (GtkLabelClass *class)
* This only affects the formatting if line wrapping is on (see the
* [property@Gtk.Label:wrap] property). The default is %PANGO_WRAP_WORD,
* which means wrap on word boundaries.
*
* For sizing behavior, also consider the [property@Gtk.Label:natural-wrap-mode]
* property.
*/
label_props[PROP_WRAP_MODE] =
g_param_spec_enum ("wrap-mode",
@@ -2405,27 +2365,6 @@ gtk_label_class_init (GtkLabelClass *class)
PANGO_WRAP_WORD,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkLabel:natural-wrap-mode: (attributes org.gtk.Property.get=gtk_label_get_natural_wrap_mode org.gtk.Property.set=gtk_label_set_natural_wrap_mode)
*
* Select the line wrapping for the natural size request.
*
* This only affects the natural size requested. For the actual wrapping used,
* see the [property@Gtk.Label:wrap-mode] property.
*
* The default is %GTK_NATURAL_WRAP_INHERIT, which inherits the behavior of the
* [property@Gtk.Label:wrap-mode] property.
*
* Since: 4.6
*/
label_props[PROP_NATURAL_WRAP_MODE] =
g_param_spec_enum ("natural-wrap-mode",
P_("Natural wrap mode"),
P_("If wrap is set, controls linewrapping for natural size requests"),
GTK_TYPE_NATURAL_WRAP_MODE,
GTK_NATURAL_WRAP_INHERIT,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkLabel:selectable: (attributes org.gtk.Property.get=gtk_label_get_selectable og.gtk.Property.set=gtk_label_set_selectable)
*
@@ -4040,9 +3979,6 @@ gtk_label_get_wrap (GtkLabel *self)
* This only affects the label if line wrapping is on. (See
* [method@Gtk.Label.set_wrap]) The default is %PANGO_WRAP_WORD
* which means wrap on word boundaries.
*
* For sizing behavior, also consider the [property@Gtk.Label:natural-wrap-mode]
* property.
*/
void
gtk_label_set_wrap_mode (GtkLabel *self,
@@ -4067,63 +4003,16 @@ gtk_label_set_wrap_mode (GtkLabel *self,
*
* See [method@Gtk.Label.set_wrap_mode].
*
* Returns: the line wrap mode
* Returns: %TRUE if the lines of the label are automatically wrapped.
*/
PangoWrapMode
gtk_label_get_wrap_mode (GtkLabel *self)
{
g_return_val_if_fail (GTK_IS_LABEL (self), PANGO_WRAP_WORD);
g_return_val_if_fail (GTK_IS_LABEL (self), FALSE);
return self->wrap_mode;
}
/**
* gtk_label_set_natural_wrap_mode: (attributes org.gtk.Method.set_property=natural-wrap-mode)
* @self: a `GtkLabel`
* @wrap_mode: the line wrapping mode
*
* Select the line wrapping for the natural size request.
*
* This only affects the natural size requested, for the actual wrapping used,
* see the [property@Gtk.Label:wrap-mode] property.
*
* Since: 4.6
*/
void
gtk_label_set_natural_wrap_mode (GtkLabel *self,
GtkNaturalWrapMode wrap_mode)
{
g_return_if_fail (GTK_IS_LABEL (self));
if (self->natural_wrap_mode != wrap_mode)
{
self->natural_wrap_mode = wrap_mode;
g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_NATURAL_WRAP_MODE]);
gtk_widget_queue_resize (GTK_WIDGET (self));
}
}
/**
* gtk_label_get_natural_wrap_mode: (attributes org.gtk.Method.get_property=natural-wrap-mode)
* @self: a `GtkLabel`
*
* Returns line wrap mode used by the label.
*
* See [method@Gtk.Label.set_natural_wrap_mode].
*
* Returns: the natural line wrap mode
*
* Since: 4.6
*/
GtkNaturalWrapMode
gtk_label_get_natural_wrap_mode (GtkLabel *self)
{
g_return_val_if_fail (GTK_IS_LABEL (self), GTK_NATURAL_WRAP_INHERIT);
return self->natural_wrap_mode;
}
static void
gtk_label_clear_layout (GtkLabel *self)
{
-5
View File
@@ -122,11 +122,6 @@ void gtk_label_set_wrap_mode (GtkLabel *self,
PangoWrapMode wrap_mode);
GDK_AVAILABLE_IN_ALL
PangoWrapMode gtk_label_get_wrap_mode (GtkLabel *self);
GDK_AVAILABLE_IN_4_6
void gtk_label_set_natural_wrap_mode (GtkLabel *self,
GtkNaturalWrapMode wrap_mode);
GDK_AVAILABLE_IN_4_6
GtkNaturalWrapMode gtk_label_get_natural_wrap_mode(GtkLabel *self);
GDK_AVAILABLE_IN_ALL
void gtk_label_set_selectable (GtkLabel *self,
gboolean setting);
-5
View File
@@ -68,7 +68,6 @@
#include "gtknative.h"
#include "gtkpopcountprivate.h"
#include "inspector/init.h"
#include "inspector/window.h"
#include "gdk/gdkeventsprivate.h"
@@ -567,8 +566,6 @@ do_post_parse_initialization (void)
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (default_display_notify_cb),
NULL);
gtk_inspector_register_extension ();
}
#ifdef G_PLATFORM_WIN32
@@ -954,7 +951,6 @@ rewrite_event_for_surface (GdkEvent *event,
case GDK_TOUCHPAD_SWIPE:
gdk_touchpad_event_get_deltas (event, &dx, &dy);
return gdk_touchpad_event_new_swipe (new_surface,
gdk_event_get_event_sequence (event),
gdk_event_get_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
@@ -965,7 +961,6 @@ rewrite_event_for_surface (GdkEvent *event,
case GDK_TOUCHPAD_PINCH:
gdk_touchpad_event_get_deltas (event, &dx, &dy);
return gdk_touchpad_event_new_pinch (new_surface,
gdk_event_get_event_sequence (event),
gdk_event_get_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
+1 -1
View File
@@ -2103,7 +2103,7 @@ gtk_popover_buildable_init (GtkBuildableIface *iface)
/**
* gtk_popover_set_pointing_to: (attributes org.gtk.Method.set_property=pointing-to)
* @popover: a `GtkPopover`
* @rect: (nullable): rectangle to point to
* @rect: rectangle to point to
*
* Sets the rectangle that @popover points to.
*
-1
View File
@@ -1025,7 +1025,6 @@ gtk_progress_bar_set_inverted (GtkProgressBar *pbar,
pbar->inverted = inverted;
gtk_widget_queue_allocate (pbar->trough_widget);
update_node_classes (pbar);
g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_INVERTED]);
+1 -1
View File
@@ -663,7 +663,7 @@ gtk_search_bar_set_key_capture_widget (GtkSearchBar *bar,
*
* Gets the widget that @bar is capturing key events from.
*
* Returns: (nullable) (transfer none): The key capture widget.
* Returns: (transfer none): The key capture widget.
**/
GtkWidget *
gtk_search_bar_get_key_capture_widget (GtkSearchBar *bar)
+1 -1
View File
@@ -763,7 +763,7 @@ gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
*
* Gets the widget that @entry is capturing key events from.
*
* Returns: (nullable) (transfer none): The key capture widget.
* Returns: (transfer none): The key capture widget.
*/
GtkWidget *
gtk_search_entry_get_key_capture_widget (GtkSearchEntry *entry)
+5 -1
View File
@@ -493,7 +493,11 @@ gtk_widget_measure (GtkWidget *widget,
int min_opposite_size;
gtk_widget_measure (widget, OPPOSITE_ORIENTATION (orientation), -1, &min_opposite_size, NULL, NULL, NULL);
if (for_size < min_opposite_size)
for_size = min_opposite_size;
{
g_critical ("gtk_widget_measure: assertion 'for_size >= minimum opposite size' failed: %u >= %u",
for_size, min_opposite_size);
for_size = min_opposite_size;
}
}
/* This is the main function that checks for a cached size and
+5 -2
View File
@@ -981,8 +981,11 @@ gtk_text_history_selection_changed (GtkTextHistory *self,
return_if_applying (self);
return_if_irreversible (self);
self->selection.insert = CLAMP (selection_insert, -1, G_MAXINT);
self->selection.bound = CLAMP (selection_bound, -1, G_MAXINT);
if (self->in_user == 0 && self->irreversible == 0)
{
self->selection.insert = CLAMP (selection_insert, -1, G_MAXINT);
self->selection.bound = CLAMP (selection_bound, -1, G_MAXINT);
}
}
void
+23 -3
View File
@@ -1157,6 +1157,7 @@ totally_invisible_line (GtkTextLayout *layout,
GtkTextIter *iter)
{
GtkTextLineSegment *seg;
int bytes = 0;
/* Check if the first char is visible, if so we are partially visible.
* Note that we have to check this since we don't know the current
@@ -1167,12 +1168,22 @@ totally_invisible_line (GtkTextLayout *layout,
if (!_gtk_text_btree_char_is_invisible (iter))
return FALSE;
bytes = 0;
seg = line->segments;
while (seg != NULL)
{
if (seg->byte_count <= 0 &&
seg->type == &gtk_text_toggle_on_type)
if (seg->byte_count > 0)
bytes += seg->byte_count;
/* Note that these two tests can cause us to bail out
* when we shouldn't, because a higher-priority tag
* may override these settings. However the important
* thing is to only invisible really-invisible lines, rather
* than to invisible all really-invisible lines.
*/
else if (seg->type == &gtk_text_toggle_on_type)
{
invalidate_cached_style (layout);
@@ -2286,7 +2297,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
char *text;
int text_pixel_width;
PangoAttrList *attrs;
int text_allocated, layout_byte_offset;
int text_allocated, layout_byte_offset, buffer_byte_offset;
PangoRectangle extents;
gboolean para_values_set = FALSE;
GSList *cursor_byte_offsets = NULL;
@@ -2345,6 +2356,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
/* Iterate over segments, creating display chunks for them, and updating the tags array. */
layout_byte_offset = 0; /* current length of layout text (includes preedit, does not include invisible text) */
buffer_byte_offset = 0; /* position in the buffer line */
seg = _gtk_text_iter_get_any_segment (&iter);
tags = _gtk_text_btree_get_tags (&iter);
initial_toggle_segments = TRUE;
@@ -2394,6 +2406,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
{
memcpy (text + layout_byte_offset, seg->body.chars, seg->byte_count);
layout_byte_offset += seg->byte_count;
buffer_byte_offset += seg->byte_count;
bytes += seg->byte_count;
}
else if (seg->type == &gtk_text_right_mark_type ||
@@ -2445,6 +2458,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
memcpy (text + layout_byte_offset, _gtk_text_unknown_char_utf8,
seg->byte_count);
layout_byte_offset += seg->byte_count;
buffer_byte_offset += seg->byte_count;
}
else if (seg->type == &gtk_text_child_type)
{
@@ -2459,6 +2473,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
memcpy (text + layout_byte_offset, gtk_text_child_anchor_get_replacement (seg->body.child.obj),
seg->byte_count);
layout_byte_offset += seg->byte_count;
buffer_byte_offset += seg->byte_count;
}
else
{
@@ -2467,6 +2482,11 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
}
} /* if (segment was visible) */
else
{
/* Invisible segment */
buffer_byte_offset += seg->byte_count;
}
release_style (layout, style);
}
+2 -10
View File
@@ -10101,11 +10101,7 @@ gtk_text_view_real_undo (GtkWidget *widget,
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
if (gtk_text_view_get_editable (text_view))
{
gtk_text_buffer_undo (text_view->priv->buffer);
gtk_text_view_scroll_mark_onscreen (text_view,
gtk_text_buffer_get_insert (text_view->priv->buffer));
}
gtk_text_buffer_undo (text_view->priv->buffer);
}
static void
@@ -10116,11 +10112,7 @@ gtk_text_view_real_redo (GtkWidget *widget,
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
if (gtk_text_view_get_editable (text_view))
{
gtk_text_buffer_redo (text_view->priv->buffer);
gtk_text_view_scroll_mark_onscreen (text_view,
gtk_text_buffer_get_insert (text_view->priv->buffer));
}
gtk_text_buffer_redo (text_view->priv->buffer);
}
static void
+1 -2
View File
@@ -4971,8 +4971,7 @@ gtk_widget_real_css_changed (GtkWidget *widget,
{
gtk_widget_queue_resize (widget);
}
else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TRANSFORM) &&
priv->parent)
else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TRANSFORM))
{
gtk_widget_queue_allocate (priv->parent);
}
+1 -9
View File
@@ -148,14 +148,6 @@
* # Accessibility
*
* `GtkWindow` uses the %GTK_ACCESSIBLE_ROLE_WINDOW role.
*
* # Actions
*
* `GtkWindow` defines a set of built-in actions:
* - `default.activate`: Activate the default widget.
* - `window.minimize`: Minimize the window.
* - `window.toggle-maximized`: Maximize or restore the window.
* - `window.close`: Close the window.
*/
#define MENU_BAR_ACCEL GDK_KEY_F10
@@ -1208,7 +1200,7 @@ gtk_window_class_init (GtkWindowClass *klass)
/**
* GtkWindow|window.minimize:
*
* Minimize the window.
* Close the window.
*/
gtk_widget_class_install_action (widget_class, "window.minimize", NULL,
gtk_window_activate_minimize);
@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="16px" viewBox="0 0 16 16" width="16px"><filter id="a" height="100%" width="100%" x="0%" y="0%"><feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/></filter><mask id="b"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.3"/></g></mask><clipPath id="c"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="d"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="e"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="f"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="g"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="h"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="i"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="j"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="k"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="l"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="m"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="n"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.05"/></g></mask><clipPath id="o"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="p"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.3"/></g></mask><clipPath id="q"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><mask id="r"><g filter="url(#a)"><path d="m 0 0 h 16 v 16 h -16 z" fill-opacity="0.5"/></g></mask><clipPath id="s"><path d="m 0 0 h 1600 v 1200 h -1600 z"/></clipPath><g clip-path="url(#c)" mask="url(#b)" transform="matrix(1 0 0 1 -16 -816)"><path d="m 562.460938 212.058594 h 10.449218 c -1.183594 0.492187 -1.296875 2.460937 0 3 h -10.449218 z m 0 0" fill="#2e3436"/></g><g clip-path="url(#e)" mask="url(#d)" transform="matrix(1 0 0 1 -16 -816)"><path d="m 16 748 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#g)" mask="url(#f)" transform="matrix(1 0 0 1 -16 -816)"><path d="m 17 747 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#i)" mask="url(#h)" transform="matrix(1 0 0 1 -16 -816)"><path d="m 18 750 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#k)" mask="url(#j)" transform="matrix(1 0 0 1 -16 -816)"><path d="m 16 750 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#m)" mask="url(#l)" transform="matrix(1 0 0 1 -16 -816)"><path d="m 17 751 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#o)" mask="url(#n)" transform="matrix(1 0 0 1 -16 -816)"><path d="m 19 751 h 1 v 1 h -1 z m 0 0" fill="#2e3436" fill-rule="evenodd"/></g><g clip-path="url(#q)" mask="url(#p)" transform="matrix(1 0 0 1 -16 -816)"><path d="m 136 776 v 7 h 7 v -7 z m 0 0" fill="#2e3436"/></g><g clip-path="url(#s)" mask="url(#r)" transform="matrix(1 0 0 1 -16 -816)"><path d="m 219 758 h 3 v 12 h -3 z m 0 0" fill="#2e3436"/></g><g fill="#2e3436"><path d="m 11.507812 3.078125 l -8.429687 8.429687 c 0.765625 0.039063 1.375 0.648438 1.414063 1.414063 l 8.429687 -8.429687 c -0.765625 -0.039063 -1.375 -0.648438 -1.414063 -1.414063 z m 0 0"/><path d="m 3 11 c -1.097656 0 -2 0.902344 -2 2 s 0.902344 2 2 2 s 2 -0.902344 2 -2 s -0.902344 -2 -2 -2 z m 0 1 c 0.558594 0 1 0.441406 1 1 s -0.441406 1 -1 1 s -1 -0.441406 -1 -1 s 0.441406 -1 1 -1 z m 0 0"/><path d="m 13 1 c -1.097656 0 -2 0.902344 -2 2 s 0.902344 2 2 2 s 2 -0.902344 2 -2 s -0.902344 -2 -2 -2 z m 0 1 c 0.558594 0 1 0.441406 1 1 s -0.441406 1 -1 1 s -1 -0.441406 -1 -1 s 0.441406 -1 1 -1 z m 0 0"/></g></svg>

Before

Width:  |  Height:  |  Size: 3.8 KiB

+39 -131
View File
@@ -25,7 +25,6 @@
#include "gtkbinlayout.h"
#include "gtkbox.h"
#include "gtkdebug.h"
#include "gtkdropcontrollermotion.h"
#include "gtklabel.h"
#include "gtklistbox.h"
#include "gtktogglebutton.h"
@@ -38,9 +37,6 @@ struct _GtkInspectorClipboard
GtkWidget *swin;
GtkWidget *dnd_formats;
GtkWidget *dnd_info;
GtkWidget *clipboard_formats;
GtkWidget *clipboard_info;
@@ -60,17 +56,12 @@ load_gtype_value (GObject *source,
GAsyncResult *res,
gpointer data)
{
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
GtkDataViewer *viewer = data;
const GValue *value;
GError *error = NULL;
if (GDK_IS_CLIPBOARD (source))
value = gdk_clipboard_read_value_finish (GDK_CLIPBOARD (source), res, &error);
else if (GDK_IS_DROP (source))
value = gdk_drop_read_value_finish (GDK_DROP (source), res, &error);
else
g_assert_not_reached ();
value = gdk_clipboard_read_value_finish (clipboard, res, &error);
if (value == NULL)
gtk_data_viewer_load_error (viewer, error);
else
@@ -84,30 +75,14 @@ load_gtype (GtkDataViewer *viewer,
GCancellable *cancellable,
gpointer gtype)
{
GObject *data_source = g_object_get_data (G_OBJECT (viewer), "data-source");
GdkClipboard *clipboard = g_object_get_data (G_OBJECT (viewer), "clipboard");
if (GDK_IS_CLIPBOARD (data_source))
{
gdk_clipboard_read_value_async (GDK_CLIPBOARD (data_source),
GPOINTER_TO_SIZE (gtype),
G_PRIORITY_DEFAULT,
cancellable,
load_gtype_value,
g_object_ref (viewer));
}
else if (GDK_IS_DROP (data_source))
{
gdk_drop_read_value_async (GDK_DROP (data_source),
GPOINTER_TO_SIZE (gtype),
G_PRIORITY_DEFAULT,
cancellable,
load_gtype_value,
g_object_ref (viewer));
}
else
{
g_assert_not_reached ();
}
gdk_clipboard_read_value_async (clipboard,
GPOINTER_TO_SIZE (gtype),
G_PRIORITY_DEFAULT,
cancellable,
load_gtype_value,
g_object_ref (viewer));
return TRUE;
}
@@ -117,18 +92,13 @@ load_mime_type_stream (GObject *source,
GAsyncResult *res,
gpointer data)
{
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
GtkDataViewer *viewer = data;
GInputStream *stream;
GError *error = NULL;
const char *mime_type;
if (GDK_IS_CLIPBOARD (source))
stream = gdk_clipboard_read_finish (GDK_CLIPBOARD (source), res, &mime_type, &error);
else if (GDK_IS_DROP (source))
stream = gdk_drop_read_finish (GDK_DROP (source), res, &mime_type, &error);
else
g_assert_not_reached ();
stream = gdk_clipboard_read_finish (clipboard, res, &mime_type, &error);
if (stream == NULL)
gtk_data_viewer_load_error (viewer, error);
else
@@ -142,48 +112,23 @@ load_mime_type (GtkDataViewer *viewer,
GCancellable *cancellable,
gpointer mime_type)
{
GObject *data_source = g_object_get_data (G_OBJECT (viewer), "data-source");
GdkClipboard *clipboard = g_object_get_data (G_OBJECT (viewer), "clipboard");
if (GDK_IS_CLIPBOARD (data_source))
{
gdk_clipboard_read_async (GDK_CLIPBOARD (data_source),
(const char *[2]) { mime_type, NULL },
G_PRIORITY_DEFAULT,
cancellable,
load_mime_type_stream,
g_object_ref (viewer));
}
else if (GDK_IS_DROP (data_source))
{
gdk_drop_read_async (GDK_DROP (data_source),
(const char *[2]) { mime_type, NULL },
G_PRIORITY_DEFAULT,
cancellable,
load_mime_type_stream,
g_object_ref (viewer));
}
else
{
g_assert_not_reached ();
}
gdk_clipboard_read_async (clipboard,
(const char *[2]) { mime_type, NULL },
G_PRIORITY_DEFAULT,
cancellable,
load_mime_type_stream,
g_object_ref (viewer));
return TRUE;
}
static void
on_drop_row_enter (GtkDropControllerMotion *motion,
double x,
double y,
GtkWidget *viewer)
{
gtk_widget_set_visible (viewer, TRUE);
}
static void
add_content_type_row (GtkInspectorClipboard *self,
GtkListBox *list,
const char *type_name,
GObject *data_source,
GdkClipboard *clipboard,
GCallback load_func,
gpointer load_func_data)
{
@@ -201,39 +146,19 @@ add_content_type_row (GtkInspectorClipboard *self,
gtk_widget_set_hexpand (label, TRUE);
gtk_box_append (GTK_BOX (hbox), label);
button = gtk_toggle_button_new_with_label (_("Show"));
gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
gtk_box_append (GTK_BOX (hbox), button);
viewer = gtk_data_viewer_new ();
g_signal_connect (viewer, "load", load_func, load_func_data);
g_object_set_data (G_OBJECT (viewer), "data-source", data_source);
g_object_set_data (G_OBJECT (viewer), "clipboard", clipboard);
g_object_bind_property (G_OBJECT (button), "active",
G_OBJECT (viewer), "visible",
G_BINDING_SYNC_CREATE);
gtk_box_append (GTK_BOX (vbox), viewer);
if (GDK_IS_CLIPBOARD (data_source))
{
button = gtk_toggle_button_new_with_label (_("Show"));
gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
gtk_box_append (GTK_BOX (hbox), button);
g_object_bind_property (G_OBJECT (button), "active",
G_OBJECT (viewer), "visible",
G_BINDING_SYNC_CREATE);
}
else
{
GtkEventController *controller = gtk_drop_controller_motion_new ();
g_signal_connect (controller, "enter", G_CALLBACK (on_drop_row_enter), viewer);
gtk_widget_add_controller (vbox, controller);
gtk_widget_set_visible (viewer, FALSE);
label = gtk_label_new (_("Hover to load"));
g_object_bind_property (G_OBJECT (viewer), "visible",
G_OBJECT (label), "visible",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
gtk_widget_set_halign (label, GTK_ALIGN_END);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_box_append (GTK_BOX (hbox), label);
}
row = gtk_list_box_row_new ();
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), vbox);
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
@@ -244,10 +169,10 @@ add_content_type_row (GtkInspectorClipboard *self,
static void
init_formats (GtkInspectorClipboard *self,
GtkListBox *list,
GdkContentFormats *formats,
GObject *data_source)
GdkClipboard *clipboard)
{
GtkListBoxRow *row;
GdkContentFormats *formats;
const char * const *mime_types;
const GType *gtypes;
gsize i, n;
@@ -255,13 +180,15 @@ init_formats (GtkInspectorClipboard *self,
while ((row = gtk_list_box_get_row_at_index (list, 1)))
gtk_list_box_remove (list, GTK_WIDGET (row));
formats = gdk_clipboard_get_formats (clipboard);
gtypes = gdk_content_formats_get_gtypes (formats, &n);
for (i = 0; i < n; i++)
add_content_type_row (self, list, g_type_name (gtypes[i]), data_source, G_CALLBACK (load_gtype), GSIZE_TO_POINTER (gtypes[i]));
add_content_type_row (self, list, g_type_name (gtypes[i]), clipboard, G_CALLBACK (load_gtype), GSIZE_TO_POINTER (gtypes[i]));
mime_types = gdk_content_formats_get_mime_types (formats, &n);
for (i = 0; i < n; i++)
add_content_type_row (self, list, mime_types[i], data_source, G_CALLBACK (load_mime_type), (gpointer) mime_types[i]);
add_content_type_row (self, list, mime_types[i], clipboard, G_CALLBACK (load_mime_type), (gpointer) mime_types[i]);
}
static void
@@ -292,7 +219,7 @@ clipboard_notify (GdkClipboard *clipboard,
{
if (g_str_equal (pspec->name, "formats"))
{
init_formats (self, GTK_LIST_BOX (self->clipboard_formats), gdk_clipboard_get_formats (clipboard), G_OBJECT (clipboard));
init_formats (self, GTK_LIST_BOX (self->clipboard_formats), clipboard);
}
init_info (self, GTK_LABEL (self->clipboard_info), clipboard);
@@ -305,28 +232,13 @@ primary_notify (GdkClipboard *clipboard,
{
if (g_str_equal (pspec->name, "formats"))
{
init_formats (self, GTK_LIST_BOX (self->primary_formats), gdk_clipboard_get_formats (clipboard), G_OBJECT (clipboard));
init_formats (self, GTK_LIST_BOX (self->primary_formats), clipboard);
}
g_print ("%s: %s\n", pspec->name, gdk_content_formats_to_string (gdk_clipboard_get_formats (clipboard)));
init_info (self, GTK_LABEL (self->primary_info), clipboard);
}
static void
on_drop_enter (GtkDropControllerMotion *motion,
double x,
double y,
GtkInspectorClipboard *self)
{
GdkDrop *drop = gtk_drop_controller_motion_get_drop (motion);
init_formats (self, GTK_LIST_BOX (self->dnd_formats), gdk_drop_get_formats (drop), G_OBJECT (drop));
if (gdk_drop_get_drag (drop))
gtk_label_set_text (GTK_LABEL (self->dnd_info), C_("clipboard", "local"));
else
gtk_label_set_text (GTK_LABEL (self->dnd_info), C_("clipboard", "remote"));
}
static void
gtk_inspector_clipboard_unset_display (GtkInspectorClipboard *self)
{
@@ -370,15 +282,11 @@ gtk_inspector_clipboard_class_init (GtkInspectorClipboardClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/clipboard.ui");
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, swin);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, dnd_formats);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, dnd_info);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, clipboard_formats);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, clipboard_info);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, primary_formats);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorClipboard, primary_info);
gtk_widget_class_bind_template_callback (widget_class, on_drop_enter);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
}
@@ -397,12 +305,12 @@ gtk_inspector_clipboard_set_display (GtkInspectorClipboard *self,
clipboard = gdk_display_get_clipboard (display);
g_signal_connect (clipboard, "notify", G_CALLBACK (clipboard_notify), self);
init_formats (self, GTK_LIST_BOX (self->clipboard_formats), gdk_clipboard_get_formats (clipboard), G_OBJECT (clipboard));
init_formats (self, GTK_LIST_BOX (self->clipboard_formats), clipboard);
init_info (self, GTK_LABEL (self->clipboard_info), clipboard);
clipboard = gdk_display_get_primary_clipboard (display);
g_signal_connect (clipboard, "notify", G_CALLBACK (primary_notify), self);
init_formats (self, GTK_LIST_BOX (self->primary_formats), gdk_clipboard_get_formats (clipboard), G_OBJECT (clipboard));
init_formats (self, GTK_LIST_BOX (self->primary_formats), clipboard);
init_info (self, GTK_LABEL (self->primary_info), clipboard);
}
-44
View File
@@ -12,50 +12,6 @@
<property name="margin-top">60</property>
<property name="margin-bottom">60</property>
<property name="spacing">10</property>
<child>
<object class="GtkFrame">
<child>
<object class="GtkListBox" id="dnd_formats">
<property name="selection-mode">none</property>
<style>
<class name="rich-list"/>
</style>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<property name="spacing">40</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Drag and hold here</property>
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="xalign">0.0</property>
</object>
</child>
<child>
<object class="GtkLabel" id="dnd_info">
<property name="selectable">1</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="ellipsize">end</property>
<property name="hexpand">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkDropControllerMotion">
<signal name="enter" handler="on_drop_enter" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame">
<child>
-69
View File
@@ -1,69 +0,0 @@
/*
* Copyright (c) 2021 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <glib/gi18n-lib.h>
#include "eventrecording.h"
G_DEFINE_TYPE (GtkInspectorEventRecording, gtk_inspector_event_recording, GTK_TYPE_INSPECTOR_RECORDING)
static void
gtk_inspector_event_recording_finalize (GObject *object)
{
GtkInspectorEventRecording *recording = GTK_INSPECTOR_EVENT_RECORDING (object);
g_clear_pointer (&recording->event, gdk_event_unref);
G_OBJECT_CLASS (gtk_inspector_event_recording_parent_class)->finalize (object);
}
static void
gtk_inspector_event_recording_class_init (GtkInspectorEventRecordingClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gtk_inspector_event_recording_finalize;
}
static void
gtk_inspector_event_recording_init (GtkInspectorEventRecording *vis)
{
}
GtkInspectorRecording *
gtk_inspector_event_recording_new (gint64 timestamp,
GdkEvent *event)
{
GtkInspectorEventRecording *recording;
recording = g_object_new (GTK_TYPE_INSPECTOR_EVENT_RECORDING,
"timestamp", timestamp,
NULL);
recording->event = gdk_event_ref (event);
return GTK_INSPECTOR_RECORDING (recording);
}
GdkEvent *
gtk_inspector_event_recording_get_event (GtkInspectorEventRecording *recording)
{
return recording->event;
}
// vim: set et sw=2 ts=2:
-64
View File
@@ -1,64 +0,0 @@
/*
* Copyright (c) 2021 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _GTK_INSPECTOR_EVENT_RECORDING_H_
#define _GTK_INSPECTOR_EVENT_RECORDING_H_
#include <gdk/gdk.h>
#include <gsk/gsk.h>
#include "gsk/gskprofilerprivate.h"
#include "inspector/recording.h"
G_BEGIN_DECLS
#define GTK_TYPE_INSPECTOR_EVENT_RECORDING (gtk_inspector_event_recording_get_type())
#define GTK_INSPECTOR_EVENT_RECORDING(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_EVENT_RECORDING, GtkInspectorEventRecording))
#define GTK_INSPECTOR_EVENT_RECORDING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_EVENT_RECORDING, GtkInspectorEventRecordingClass))
#define GTK_INSPECTOR_IS_EVENT_RECORDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_EVENT_RECORDING))
#define GTK_INSPECTOR_IS_EVENT_RECORDING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_EVENT_RECORDING))
#define GTK_INSPECTOR_EVENT_RECORDING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_EVENT_RECORDING, GtkInspectorEventRecordingClass))
typedef struct _GtkInspectorEventRecordingPrivate GtkInspectorEventRecordingPrivate;
typedef struct _GtkInspectorEventRecording
{
GtkInspectorRecording parent;
GdkEvent *event;
} GtkInspectorEventRecording;
typedef struct _GtkInspectorEventRecordingClass
{
GtkInspectorRecordingClass parent;
} GtkInspectorEventRecordingClass;
GType gtk_inspector_event_recording_get_type (void);
GtkInspectorRecording *
gtk_inspector_event_recording_new (gint64 timestamp,
GdkEvent *event);
GdkEvent * gtk_inspector_event_recording_get_event (GtkInspectorEventRecording *recording);
G_END_DECLS
#endif // _GTK_INSPECTOR_EVENT_RECORDING_H_
// vim: set et sw=2 ts=2:
+17 -22
View File
@@ -36,7 +36,6 @@
#include "list-data.h"
#include "logs.h"
#include "magnifier.h"
#include "measuregraph.h"
#include "menu.h"
#include "misc-info.h"
#include "object-tree.h"
@@ -55,14 +54,10 @@
#include "gtkmodulesprivate.h"
static GIOExtensionPoint *extension_point = NULL;
void
gtk_inspector_init (void)
{
GIOModuleScope *scope;
char **paths;
int i;
static GIOExtensionPoint *extension_point = NULL;
g_type_ensure (G_TYPE_LIST_STORE);
@@ -79,7 +74,6 @@ gtk_inspector_init (void)
g_type_ensure (GTK_TYPE_INSPECTOR_LOGS);
g_type_ensure (GTK_TYPE_MAGNIFIER);
g_type_ensure (GTK_TYPE_INSPECTOR_MAGNIFIER);
g_type_ensure (GTK_TYPE_INSPECTOR_MEASURE_GRAPH);
g_type_ensure (GTK_TYPE_INSPECTOR_MENU);
g_type_ensure (GTK_TYPE_INSPECTOR_MISC_INFO);
g_type_ensure (GTK_TYPE_INSPECTOR_OBJECT_TREE);
@@ -93,25 +87,26 @@ gtk_inspector_init (void)
g_type_ensure (GTK_TYPE_INSPECTOR_VISUAL);
g_type_ensure (GTK_TYPE_INSPECTOR_WINDOW);
paths = _gtk_get_module_path ("inspector");
scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES);
if (extension_point == NULL)
{
GIOModuleScope *scope;
char **paths;
int i;
for (i = 0; paths[i] != NULL; i++)
g_io_modules_load_all_in_directory_with_scope (paths[i], scope);
extension_point = g_io_extension_point_register ("gtk-inspector-page");
g_io_extension_point_set_required_type (extension_point, GTK_TYPE_WIDGET);
g_strfreev (paths);
g_io_module_scope_free (scope);
paths = _gtk_get_module_path ("inspector");
scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES);
for (i = 0; paths[i] != NULL; i++)
g_io_modules_load_all_in_directory_with_scope (paths[i], scope);
g_strfreev (paths);
g_io_module_scope_free (scope);
}
gtk_css_provider_set_keep_css_sections ();
}
void
gtk_inspector_register_extension (void)
{
if (extension_point == NULL) {
extension_point = g_io_extension_point_register ("gtk-inspector-page");
g_io_extension_point_set_required_type (extension_point, GTK_TYPE_WIDGET);
}
}
// vim: set et sw=2 ts=2:
+4 -2
View File
@@ -18,10 +18,12 @@
#ifndef _GTK_INSPECTOR_INIT_H_
#define _GTK_INSPECTOR_INIT_H_
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS
void gtk_inspector_init (void);
void gtk_inspector_register_extension (void);
GDK_AVAILABLE_IN_ALL
void gtk_inspector_init (void);
G_END_DECLS
-4
View File
@@ -55,7 +55,3 @@ picture.light {
min-width: 10px;
min-height: 10px;
}
row:not(:selected) > .highlight {
background-color: rgba(135, 206, 250, 0.4);
}
-250
View File
@@ -1,250 +0,0 @@
/*
* Copyright © 2021 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#include "config.h"
#include "measuregraph.h"
/* gdk_texture_new_for_surface() */
#include "gdk/gdktextureprivate.h"
#define MAX_SIZES 2048
typedef struct _Size Size;
struct _Size
{
int min;
int nat;
};
struct _GtkInspectorMeasureGraph
{
GObject parent_instance;
GdkPaintable *texture;
Size width;
Size height;
Size width_for_height[MAX_SIZES];
Size height_for_width[MAX_SIZES];
};
struct _GtkInspectorMeasureGraphClass
{
GObjectClass parent_class;
};
static void
gtk_inspector_measure_graph_ensure_texture (GtkInspectorMeasureGraph *self)
{
int i, width, height;
cairo_surface_t *surface;
cairo_t *cr;
if (self->texture)
return;
if (self->width.nat == 0 || self->height.nat == 0)
{
self->texture = gdk_paintable_new_empty (0, 0);
return;
}
width = self->width.nat;
for (i = 0; i < MAX_SIZES; i++)
width = MAX (width, self->width_for_height[i].nat);
width = MIN (width, MAX_SIZES);
height = self->height.nat;
for (i = 0; i < MAX_SIZES; i++)
height = MAX (height, self->height_for_width[i].nat);
height = MIN (height, MAX_SIZES);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
cr = cairo_create (surface);
cairo_set_operator (cr, CAIRO_OPERATOR_ADD);
cairo_set_source_rgba (cr, 0.5, 0, 0, 1);
cairo_rectangle (cr, 0, 0, self->width.min, height);
cairo_fill (cr);
cairo_set_source_rgba (cr, 1, 0, 0, 1);
for (i = self->width.min; i < width; i++)
cairo_rectangle (cr, i, 0, 1, self->height_for_width[i].min);
cairo_fill (cr);
cairo_set_source_rgba (cr, 1, 0, 0, 0.3);
for (i = self->width.min; i < width; i++)
cairo_rectangle (cr, i, self->height_for_width[i].min, 1, self->height_for_width[i].nat - self->height_for_width[i].min);
cairo_fill (cr);
cairo_set_source_rgba (cr, 0, 0, 0.5, 1);
cairo_rectangle (cr, 0, 0, width, self->height.min);
cairo_fill (cr);
cairo_set_source_rgba (cr, 0, 0, 1, 1);
for (i = self->height.min; i < height; i++)
cairo_rectangle (cr, 0, i, self->width_for_height[i].min, 1);
cairo_fill (cr);
cairo_set_source_rgba (cr, 0, 0, 1, 0.3);
for (i = self->height.min; i < height; i++)
cairo_rectangle (cr, self->width_for_height[i].min, i, self->width_for_height[i].nat - self->width_for_height[i].min, 1);
cairo_fill (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_rectangle (cr, self->width.nat, 0, 1, height);
cairo_rectangle (cr, 0, self->height.nat, width, 1);
cairo_fill (cr);
cairo_destroy (cr);
self->texture = GDK_PAINTABLE (gdk_texture_new_for_surface (surface));
cairo_surface_destroy (surface);
}
static void
gtk_inspector_measure_graph_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
GtkInspectorMeasureGraph *self = GTK_INSPECTOR_MEASURE_GRAPH (paintable);
gtk_inspector_measure_graph_ensure_texture (self);
if (self->texture == NULL)
return;
gdk_paintable_snapshot (self->texture, snapshot, width, height);
}
static int
gtk_inspector_measure_graph_paintable_get_intrinsic_width (GdkPaintable *paintable)
{
GtkInspectorMeasureGraph *self = GTK_INSPECTOR_MEASURE_GRAPH (paintable);
gtk_inspector_measure_graph_ensure_texture (self);
return gdk_paintable_get_intrinsic_width (self->texture);
}
static int
gtk_inspector_measure_graph_paintable_get_intrinsic_height (GdkPaintable *paintable)
{
GtkInspectorMeasureGraph *self = GTK_INSPECTOR_MEASURE_GRAPH (paintable);
gtk_inspector_measure_graph_ensure_texture (self);
return gdk_paintable_get_intrinsic_height (self->texture);
}
static double
gtk_inspector_measure_graph_paintable_get_intrinsic_aspect_ratio (GdkPaintable *paintable)
{
GtkInspectorMeasureGraph *self = GTK_INSPECTOR_MEASURE_GRAPH (paintable);
gtk_inspector_measure_graph_ensure_texture (self);
return gdk_paintable_get_intrinsic_aspect_ratio (self->texture);
}
static void
gtk_inspector_measure_graph_paintable_init (GdkPaintableInterface *iface)
{
iface->snapshot = gtk_inspector_measure_graph_paintable_snapshot;
iface->get_intrinsic_width = gtk_inspector_measure_graph_paintable_get_intrinsic_width;
iface->get_intrinsic_height = gtk_inspector_measure_graph_paintable_get_intrinsic_height;
iface->get_intrinsic_aspect_ratio = gtk_inspector_measure_graph_paintable_get_intrinsic_aspect_ratio;
}
G_DEFINE_TYPE_EXTENDED (GtkInspectorMeasureGraph, gtk_inspector_measure_graph, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_inspector_measure_graph_paintable_init))
static void
gtk_inspector_measure_graph_dispose (GObject *object)
{
GtkInspectorMeasureGraph *self = GTK_INSPECTOR_MEASURE_GRAPH (object);
g_clear_object (&self->texture);
G_OBJECT_CLASS (gtk_inspector_measure_graph_parent_class)->dispose (object);
}
static void
gtk_inspector_measure_graph_class_init (GtkInspectorMeasureGraphClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = gtk_inspector_measure_graph_dispose;
}
static void
gtk_inspector_measure_graph_init (GtkInspectorMeasureGraph *self)
{
}
GtkInspectorMeasureGraph *
gtk_inspector_measure_graph_new (void)
{
return g_object_new (GTK_TYPE_INSPECTOR_MEASURE_GRAPH, NULL);
}
void
gtk_inspector_measure_graph_clear (GtkInspectorMeasureGraph *self)
{
g_clear_object (&self->texture);
memset (&self->width, 0, sizeof (self->width));
memset (&self->height, 0, sizeof (self->height));
memset (&self->width_for_height, 0, sizeof (self->width_for_height));
memset (&self->height_for_width, 0, sizeof (self->height_for_width));
gdk_paintable_invalidate_size (GDK_PAINTABLE (self));
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
}
void
gtk_inspector_measure_graph_measure (GtkInspectorMeasureGraph *self,
GtkWidget *widget)
{
int i;
g_clear_object (&self->texture);
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, -1, &self->width.min, &self->width.nat, NULL, NULL);
gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL, -1 ,&self->height.min, &self->height.nat, NULL, NULL);
memset (&self->width_for_height, 0, sizeof (Size) * MIN (self->height.min, MAX_SIZES));
for (i = self->height.min; i < MAX_SIZES; i++)
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, i, &self->width_for_height[i].min, &self->width_for_height[i].nat, NULL, NULL);
memset (&self->height_for_width, 0, sizeof (Size) * MIN (self->width.min, MAX_SIZES));
for (i = self->width.min; i < MAX_SIZES; i++)
gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL, i, &self->height_for_width[i].min, &self->height_for_width[i].nat, NULL, NULL);
gdk_paintable_invalidate_size (GDK_PAINTABLE (self));
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
}
GdkTexture *
gtk_inspector_measure_graph_get_texture (GtkInspectorMeasureGraph *self)
{
gtk_inspector_measure_graph_ensure_texture (self);
if (!GDK_IS_TEXTURE (self->texture))
return NULL;
return GDK_TEXTURE (self->texture);
}
-40
View File
@@ -1,40 +0,0 @@
/*
* Copyright © 2021 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#ifndef __GTK_INSPECTOR_MEASURE_GRAPH_H__
#define __GTK_INSPECTOR_MEASURE_GRAPH_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GTK_TYPE_INSPECTOR_MEASURE_GRAPH (gtk_inspector_measure_graph_get_type ())
G_DECLARE_FINAL_TYPE (GtkInspectorMeasureGraph, gtk_inspector_measure_graph, GTK, INSPECTOR_MEASURE_GRAPH, GObject)
GtkInspectorMeasureGraph * gtk_inspector_measure_graph_new (void);
void gtk_inspector_measure_graph_clear (GtkInspectorMeasureGraph *self);
void gtk_inspector_measure_graph_measure (GtkInspectorMeasureGraph *self,
GtkWidget *widget);
GdkTexture * gtk_inspector_measure_graph_get_texture (GtkInspectorMeasureGraph *self);
G_END_DECLS
#endif /* __GTK_INSPECTOR_MEASURE_GRAPH_H__ */
-3
View File
@@ -9,7 +9,6 @@ inspector_sources = files(
'controllers.c',
'css-editor.c',
'css-node-tree.c',
'eventrecording.c',
'focusoverlay.c',
'fpsoverlay.c',
'general.c',
@@ -24,7 +23,6 @@ inspector_sources = files(
'layoutoverlay.c',
'logs.c',
'magnifier.c',
'measuregraph.c',
'menu.c',
'misc-info.c',
'object-tree.c',
@@ -32,7 +30,6 @@ inspector_sources = files(
'prop-holder.c',
'prop-list.c',
'recorder.c',
'recorderrow.c',
'recording.c',
'renderrecording.c',
'resource-holder.c',
-62
View File
@@ -19,8 +19,6 @@
#include <glib/gi18n-lib.h>
#include "misc-info.h"
#include "measuregraph.h"
#include "window.h"
#include "type-info.h"
@@ -57,10 +55,6 @@ struct _GtkInspectorMiscInfo
GtkWidget *mnemonic_label;
GtkWidget *request_mode_row;
GtkWidget *request_mode;
GtkWidget *measure_row;
GtkWidget *measure_expand_toggle;
GtkWidget *measure_picture;
GdkPaintable *measure_graph;
GtkWidget *allocated_size_row;
GtkWidget *allocated_size;
GtkWidget *baseline_row;
@@ -164,8 +158,6 @@ update_allocation (GtkWidget *w,
value = g_enum_get_value (class, gtk_widget_get_request_mode (w));
gtk_label_set_label (GTK_LABEL (sl->request_mode), value->value_nick);
g_type_class_unref (class);
gtk_inspector_measure_graph_measure (GTK_INSPECTOR_MEASURE_GRAPH (sl->measure_graph), w);
}
static void
@@ -432,50 +424,6 @@ update_info (gpointer data)
return G_SOURCE_CONTINUE;
}
static GdkContentProvider *
measure_picture_drag_prepare (GtkDragSource *source,
double x,
double y,
gpointer unused)
{
GtkWidget *picture;
GdkPaintable *measure_graph;
GdkTexture *texture;
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
measure_graph = gtk_picture_get_paintable (GTK_PICTURE (picture));
if (!GTK_IS_INSPECTOR_MEASURE_GRAPH (measure_graph))
return NULL;
texture = gtk_inspector_measure_graph_get_texture (GTK_INSPECTOR_MEASURE_GRAPH (measure_graph));
if (texture == NULL)
return NULL;
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, texture);
}
static void
update_measure_picture (GtkPicture *picture,
GtkToggleButton *toggle)
{
GdkPaintable *paintable = gtk_picture_get_paintable (picture);
if (gtk_toggle_button_get_active (toggle) ||
(gdk_paintable_get_intrinsic_width (paintable) <= 200 &&
gdk_paintable_get_intrinsic_height (paintable) <= 100))
{
gtk_picture_set_can_shrink (picture, FALSE);
gtk_widget_set_size_request (GTK_WIDGET (picture), -1, -1);
}
else
{
gtk_picture_set_can_shrink (picture, TRUE);
gtk_widget_set_size_request (GTK_WIDGET (picture),
-1,
MIN (100, 200 / gdk_paintable_get_intrinsic_aspect_ratio (paintable)));
}
}
void
gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
GObject *object)
@@ -500,7 +448,6 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
gtk_widget_show (sl->state_row);
gtk_widget_show (sl->direction_row);
gtk_widget_show (sl->request_mode_row);
gtk_widget_show (sl->measure_row);
gtk_widget_show (sl->allocated_size_row);
gtk_widget_show (sl->baseline_row);
gtk_widget_show (sl->mnemonic_label_row);
@@ -515,15 +462,12 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
state_flags_changed (GTK_WIDGET (sl->object), 0, sl);
update_allocation (GTK_WIDGET (sl->object), sl);
update_measure_picture (GTK_PICTURE (sl->measure_picture), GTK_TOGGLE_BUTTON (sl->measure_expand_toggle));
}
else
{
gtk_widget_hide (sl->state_row);
gtk_widget_hide (sl->direction_row);
gtk_widget_hide (sl->request_mode_row);
gtk_widget_hide (sl->measure_row);
gtk_inspector_measure_graph_clear (GTK_INSPECTOR_MEASURE_GRAPH (sl->measure_graph));
gtk_widget_hide (sl->mnemonic_label_row);
gtk_widget_hide (sl->allocated_size_row);
gtk_widget_hide (sl->baseline_row);
@@ -628,10 +572,6 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, mnemonic_label);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, request_mode_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, request_mode);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, measure_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, measure_expand_toggle);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, measure_picture);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, measure_graph);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, allocated_size_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, allocated_size);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, baseline_row);
@@ -660,8 +600,6 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, child_visible_row);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, child_visible);
gtk_widget_class_bind_template_callback (widget_class, update_measure_picture);
gtk_widget_class_bind_template_callback (widget_class, measure_picture_drag_prepare);
gtk_widget_class_bind_template_callback (widget_class, show_surface);
gtk_widget_class_bind_template_callback (widget_class, show_renderer);
gtk_widget_class_bind_template_callback (widget_class, show_frame_clock);
-59
View File
@@ -254,65 +254,6 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="measure_info_row">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="spacing">40</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Measure map</property>
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="xalign">0</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="measure_expand_toggle">
<property name="label" translatable="yes">Expand</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
<signal name="clicked" handler="update_measure_picture" swapped="yes" after="1" object="measure_picture"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="measure_row">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="spacing">40</property>
<child>
<object class="GtkPicture" id="measure_picture">
<property name="paintable">
<object class="GtkInspectorMeasureGraph" id="measure_graph" />
</property>
<property name="can-shrink">0</property>
<property name="hexpand">1</property>
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="measure_picture_drag_prepare" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="allocated_size_row">
<property name="activatable">0</property>
+71 -714
View File
@@ -39,7 +39,6 @@
#include <gtk/gtktreelistmodel.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtktreeview.h>
#include <gtk/gtkstack.h>
#include <gsk/gskrendererprivate.h>
#include <gsk/gskrendernodeprivate.h>
#include <gsk/gskroundedrectprivate.h>
@@ -54,8 +53,6 @@
#include "recording.h"
#include "renderrecording.h"
#include "startrecording.h"
#include "eventrecording.h"
#include "recorderrow.h"
struct _GtkInspectorRecorder
{
@@ -73,19 +70,11 @@ struct _GtkInspectorRecorder
GtkWidget *render_node_save_button;
GtkWidget *render_node_clip_button;
GtkWidget *node_property_tree;
GtkWidget *recording_data_stack;
GtkTreeModel *render_node_properties;
GtkTreeModel *event_properties;
GtkWidget *event_property_tree;
GtkWidget *event_view;
GtkInspectorRecording *recording; /* start recording if recording or NULL if not */
gint64 start_time;
gboolean debug_nodes;
gboolean highlight_sequences;
GdkEventSequence *selected_sequence;
};
typedef struct _GtkInspectorRecorderClass
@@ -99,8 +88,6 @@ enum
PROP_0,
PROP_RECORDING,
PROP_DEBUG_NODES,
PROP_HIGHLIGHT_SEQUENCES,
PROP_SELECTED_SEQUENCE,
LAST_PROP
};
@@ -181,7 +168,7 @@ create_list_model_for_render_node (GskRenderNode *node)
return create_render_node_list_model ((GskRenderNode *[1]) { gsk_shadow_node_get_child (node) }, 1);
case GSK_BLEND_NODE:
return create_render_node_list_model ((GskRenderNode *[2]) { gsk_blend_node_get_bottom_child (node),
return create_render_node_list_model ((GskRenderNode *[2]) { gsk_blend_node_get_bottom_child (node),
gsk_blend_node_get_top_child (node) }, 2);
case GSK_CROSS_FADE_NODE:
@@ -438,136 +425,45 @@ bind_widget_for_render_node (GtkSignalListItemFactory *factory,
}
static void
show_render_node (GtkInspectorRecorder *recorder,
GskRenderNode *node)
recordings_list_row_selected (GtkListBox *box,
GtkListBoxRow *row,
GtkInspectorRecorder *recorder)
{
graphene_rect_t bounds;
GdkPaintable *paintable;
GtkInspectorRecording *recording;
gsk_render_node_get_bounds (node, &bounds);
paintable = gtk_render_node_paintable_new (node, &bounds);
if (recorder->recordings == NULL)
return;
if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (recorder->recording_data_stack)), "frame_data") == 0)
if (row)
recording = g_list_model_get_item (recorder->recordings, gtk_list_box_row_get_index (row));
else
recording = NULL;
if (GTK_INSPECTOR_IS_RENDER_RECORDING (recording))
{
graphene_rect_t bounds;
GskRenderNode *node;
GdkPaintable *paintable;
node = gtk_inspector_render_recording_get_node (GTK_INSPECTOR_RENDER_RECORDING (recording));
gsk_render_node_get_bounds (node, &bounds);
paintable = gtk_render_node_paintable_new (node, &bounds);
gtk_picture_set_paintable (GTK_PICTURE (recorder->render_node_view), paintable);
g_list_store_splice (recorder->render_node_root_model,
0, g_list_model_get_n_items (G_LIST_MODEL (recorder->render_node_root_model)),
(gpointer[1]) { paintable },
1);
g_object_unref (paintable);
}
else
{
gtk_picture_set_paintable (GTK_PICTURE (recorder->event_view), paintable);
}
g_object_unref (paintable);
}
static GskRenderNode *
make_dot (double x, double y)
{
GskRenderNode *fill, *dot;
GdkRGBA red = (GdkRGBA){ 1, 0, 0, 1 };
graphene_rect_t rect = GRAPHENE_RECT_INIT (x - 3, y - 3, 6, 6);
graphene_size_t corner = GRAPHENE_SIZE_INIT (3, 3);
GskRoundedRect clip;
fill = gsk_color_node_new (&red, &rect);
dot = gsk_rounded_clip_node_new (fill, gsk_rounded_rect_init (&clip, &rect,
&corner, &corner, &corner, &corner));
gsk_render_node_unref (fill);
return dot;
}
static void
show_event (GtkInspectorRecorder *recorder,
GskRenderNode *node,
GdkEvent *event)
{
GskRenderNode *temp;
double x, y;
if (gdk_event_get_position (event, &x, &y))
{
GskRenderNode *dot = make_dot (x, y);
temp = gsk_container_node_new ((GskRenderNode *[]) { node, dot }, 2);
gsk_render_node_unref (dot);
}
else
temp = gsk_render_node_ref (node);
show_render_node (recorder, temp);
gsk_render_node_unref (temp);
}
static void populate_event_properties (GtkListStore *store,
GdkEvent *event);
static void
recording_selected (GtkSingleSelection *selection,
GParamSpec *pspec,
GtkInspectorRecorder *recorder)
{
GtkInspectorRecording *recording;
GdkEventSequence *selected_sequence = NULL;
if (recorder->recordings == NULL)
{
gtk_stack_set_visible_child_name (GTK_STACK (recorder->recording_data_stack), "no_data");
return;
}
recording = gtk_single_selection_get_selected_item (selection);
if (GTK_INSPECTOR_IS_RENDER_RECORDING (recording))
{
GskRenderNode *node;
gtk_stack_set_visible_child_name (GTK_STACK (recorder->recording_data_stack), "frame_data");
node = gtk_inspector_render_recording_get_node (GTK_INSPECTOR_RENDER_RECORDING (recording));
show_render_node (recorder, node);
}
else if (GTK_INSPECTOR_IS_EVENT_RECORDING (recording))
{
GdkEvent *event;
gtk_stack_set_visible_child_name (GTK_STACK (recorder->recording_data_stack), "event_data");
event = gtk_inspector_event_recording_get_event (GTK_INSPECTOR_EVENT_RECORDING (recording));
for (guint pos = gtk_single_selection_get_selected (selection) - 1; pos > 0; pos--)
{
GtkInspectorRecording *item = g_list_model_get_item (G_LIST_MODEL (selection), pos);
g_object_unref (item);
if (GTK_INSPECTOR_IS_RENDER_RECORDING (item))
{
GskRenderNode *node;
node = gtk_inspector_render_recording_get_node (GTK_INSPECTOR_RENDER_RECORDING (item));
show_event (recorder, node, event);
break;
}
}
populate_event_properties (GTK_LIST_STORE (recorder->event_properties), event);
if (recorder->highlight_sequences)
selected_sequence = gdk_event_get_event_sequence (event);
}
else
{
gtk_stack_set_visible_child_name (GTK_STACK (recorder->recording_data_stack), "no_data");
gtk_picture_set_paintable (GTK_PICTURE (recorder->render_node_view), NULL);
g_list_store_remove_all (recorder->render_node_root_model);
}
gtk_inspector_recorder_set_selected_sequence (recorder, selected_sequence);
if (recording)
g_object_unref (recording);
}
static GdkTexture *
@@ -1271,337 +1167,6 @@ populate_render_node_properties (GtkListStore *store,
}
}
static const char *
event_type_name (GdkEventType type)
{
const char *event_name[] = {
"Delete",
"Motion",
"Button Press",
"Button Release",
"Key Press",
"Key Release",
"Enter",
"Leave",
"Focus",
"Proximity In",
"Proximity Out",
"Drag Enter",
"Drag Leave",
"Drag Motion",
"Drop Start",
"Scroll",
"Grab Broken",
"Touch Begin",
"Touch Update",
"Touch End",
"Touch Cancel",
"Touchpad Swipe",
"Touchpad Pinch",
"Pad Button Press",
"Pad Button Release",
"Pad Rind",
"Pad Strip",
"Pad Group Mode"
};
return event_name[type];
}
static const char *
scroll_direction_name (GdkScrollDirection dir)
{
const char *scroll_dir[] = {
"Up", "Down", "Left", "Right", "Smooth"
};
return scroll_dir[dir];
}
static char *
modifier_names (GdkModifierType state)
{
struct {
const char *name;
int mask;
} mods[] = {
{ "Shift", GDK_SHIFT_MASK },
{ "Lock", GDK_LOCK_MASK },
{ "Control", GDK_CONTROL_MASK },
{ "Alt", GDK_ALT_MASK },
{ "Button1", GDK_BUTTON1_MASK },
{ "Button2", GDK_BUTTON2_MASK },
{ "Button3", GDK_BUTTON3_MASK },
{ "Button4", GDK_BUTTON4_MASK },
{ "Button5", GDK_BUTTON5_MASK },
{ "Super", GDK_SUPER_MASK },
{ "Hyper", GDK_HYPER_MASK },
{ "Meta", GDK_META_MASK },
};
GString *s;
s = g_string_new ("");
for (int i = 0; i < G_N_ELEMENTS (mods); i++)
{
if (state & mods[i].mask)
{
if (s->len > 0)
g_string_append (s, " ");
g_string_append (s, mods[i].name);
}
}
return g_string_free (s, FALSE);
}
static char *
key_event_string (GdkEvent *event)
{
guint keyval;
gunichar c;
char buf[5] = { 0, };
keyval = gdk_key_event_get_keyval (event);
c = gdk_keyval_to_unicode (keyval);
if (c)
{
g_unichar_to_utf8 (c, buf);
return g_strdup (buf);
}
return g_strdup (gdk_keyval_name (keyval));
}
static const char *
device_tool_name (GdkDeviceTool *tool)
{
const char *name[] = {
"Unknown",
"Pen",
"Eraser",
"Brush",
"Pencil",
"Airbrush",
"Mouse",
"Lens"
};
return name[gdk_device_tool_get_tool_type (tool)];
}
static const char *
axis_name (GdkAxisUse axis)
{
const char *name[] = {
"",
"X",
"Y",
"Delta X",
"Delta Y",
"Pressure",
"X Tilt",
"Y Tilt",
"Wheel",
"Distance",
"Rotation",
"Slider"
};
return name[axis];
}
static const char *
gesture_phase_name (GdkTouchpadGesturePhase phase)
{
const char *name[] = {
"Begin",
"Update",
"End",
"Cancel"
};
return name[phase];
}
static void
populate_event_properties (GtkListStore *store,
GdkEvent *event)
{
GdkEventType type;
GdkDevice *device;
GdkDeviceTool *tool;
double x, y;
double dx, dy;
char *tmp;
GdkModifierType state;
gtk_list_store_clear (store);
type = gdk_event_get_event_type (event);
add_text_row (store, "Type", event_type_name (type));
if (gdk_event_get_event_sequence (event) != NULL)
{
tmp = g_strdup_printf ("%p", gdk_event_get_event_sequence (event));
add_text_row (store, "Sequence", tmp);
g_free (tmp);
}
add_int_row (store, "Timestamp", gdk_event_get_time (event));
device = gdk_event_get_device (event);
if (device)
add_text_row (store, "Device", gdk_device_get_name (device));
tool = gdk_event_get_device_tool (event);
if (tool)
add_text_row (store, "Device Tool", device_tool_name (tool));
if (gdk_event_get_position (event, &x, &y))
{
tmp = g_strdup_printf ("%.2f %.2f", x, y);
add_text_row (store, "Position", tmp);
g_free (tmp);
}
if (tool)
{
GdkAxisFlags axes = gdk_device_tool_get_axes (tool);
/* We report position and scroll delta separately, so skip them here */
axes &= ~(GDK_AXIS_FLAG_X|GDK_AXIS_FLAG_Y|GDK_AXIS_FLAG_DELTA_X|GDK_AXIS_FLAG_DELTA_Y);
for (int i = 1; i < GDK_AXIS_LAST; i++)
{
if (axes & (1 << i))
{
double val;
gdk_event_get_axis (event, i, &val);
tmp = g_strdup_printf ("%.2f", val);
add_text_row (store, axis_name (i), tmp);
g_free (tmp);
}
}
}
state = gdk_event_get_modifier_state (event);
if (state != 0)
{
tmp = modifier_names (state);
add_text_row (store, "State", tmp);
g_free (tmp);
}
switch ((int)type)
{
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
add_int_row (store, "Button", gdk_button_event_get_button (event));
break;
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
add_int_row (store, "Keycode", gdk_key_event_get_keycode (event));
add_int_row (store, "Keyval", gdk_key_event_get_keyval (event));
tmp = key_event_string (event);
add_text_row (store, "Key", tmp);
g_free (tmp);
add_int_row (store, "Layout", gdk_key_event_get_layout (event));
add_int_row (store, "Level", gdk_key_event_get_level (event));
add_boolean_row (store, "Is Modifier", gdk_key_event_is_modifier (event));
break;
case GDK_SCROLL:
if (gdk_scroll_event_get_direction (event) == GDK_SCROLL_SMOOTH)
{
gdk_scroll_event_get_deltas (event, &x, &y);
tmp = g_strdup_printf ("%.2f %.2f", x, y);
add_text_row (store, "Delta", tmp);
g_free (tmp);
}
else
{
add_text_row (store, "Direction", scroll_direction_name (gdk_scroll_event_get_direction (event)));
}
add_boolean_row (store, "Is Stop", gdk_scroll_event_is_stop (event));
break;
case GDK_FOCUS_CHANGE:
add_text_row (store, "Direction", gdk_focus_event_get_in (event) ? "In" : "Out");
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
add_int_row (store, "Mode", gdk_crossing_event_get_mode (event));
add_int_row (store, "Detail", gdk_crossing_event_get_detail (event));
add_boolean_row (store, "Is Focus", gdk_crossing_event_get_focus (event));
break;
case GDK_GRAB_BROKEN:
add_boolean_row (store, "Implicit", gdk_grab_broken_event_get_implicit (event));
break;
case GDK_TOUCHPAD_SWIPE:
case GDK_TOUCHPAD_PINCH:
add_text_row (store, "Phase", gesture_phase_name (gdk_touchpad_event_get_gesture_phase (event)));
add_int_row (store, "Fingers", gdk_touchpad_event_get_n_fingers (event));
gdk_touchpad_event_get_deltas (event, &dx, &dy);
tmp = g_strdup_printf ("%.2f %.f2", dx, dy);
add_text_row (store, "Delta", tmp);
g_free (tmp);
if (type == GDK_TOUCHPAD_PINCH)
{
tmp = g_strdup_printf ("%.2f", gdk_touchpad_event_get_pinch_angle_delta (event));
add_text_row (store, "Angle Delta", tmp);
g_free (tmp);
tmp = g_strdup_printf ("%.2f", gdk_touchpad_event_get_pinch_scale (event));
add_text_row (store, "Scale", tmp);
g_free (tmp);
}
break;
default:
/* FIXME */
;
}
if (type == GDK_MOTION_NOTIFY || type == GDK_SCROLL)
{
GdkTimeCoord *history;
guint n_coords;
history = gdk_event_get_history (event, &n_coords);
if (history)
{
GString *s = g_string_new ("");
for (int i = 0; i < n_coords; i++)
{
if (i > 0)
g_string_append (s, "\n");
g_string_append_printf (s, "%d", history[i].time);
if (history[i].flags & (GDK_AXIS_FLAG_X|GDK_AXIS_FLAG_Y))
g_string_append_printf (s, " Position %.2f %.2f", history[i].axes[GDK_AXIS_X], history[i].axes[GDK_AXIS_Y]);
if (history[i].flags & (GDK_AXIS_FLAG_DELTA_X|GDK_AXIS_FLAG_DELTA_Y))
g_string_append_printf (s, " Delta %.2f %.2f", history[i].axes[GDK_AXIS_DELTA_X], history[i].axes[GDK_AXIS_DELTA_Y]);
for (int j = GDK_AXIS_PRESSURE; j < GDK_AXIS_LAST; j++)
{
if (history[i].flags & (1 << j))
g_string_append_printf (s, " %s %.2f", axis_name (j), history[i].axes[j]);
}
}
add_text_row (store, "History", s->str);
g_string_free (s, TRUE);
g_free (history);
}
}
}
static GskRenderNode *
get_selected_node (GtkInspectorRecorder *recorder)
{
@@ -1760,153 +1325,58 @@ toggle_dark_mode (GtkToggleButton *button,
}
}
static void
setup_widget_for_recording (GtkListItemFactory *factory,
GtkListItem *item,
gpointer data)
static GtkWidget *
gtk_inspector_recorder_recordings_list_create_widget (gpointer item,
gpointer user_data)
{
GtkWidget *row, *box, *label;
row = g_object_new (GTK_TYPE_INSPECTOR_RECORDER_ROW, NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
gtk_widget_set_hexpand (label, TRUE);
gtk_box_append (GTK_BOX (box), label);
label = gtk_label_new ("");
gtk_box_append (GTK_BOX (box), label);
gtk_widget_set_margin_start (box, 6);
gtk_widget_set_margin_end (box, 6);
gtk_widget_set_margin_top (box, 6);
gtk_widget_set_margin_bottom (box, 6);
gtk_widget_set_parent (box, row);
gtk_list_item_set_child (item, row);
}
static char *
get_event_summary (GdkEvent *event)
{
double x, y;
int type;
const char *name;
gdk_event_get_position (event, &x, &y);
type = gdk_event_get_event_type (event);
name = event_type_name (type);
switch (type)
{
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
case GDK_MOTION_NOTIFY:
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
case GDK_DROP_START:
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
case GDK_TOUCHPAD_SWIPE:
case GDK_TOUCHPAD_PINCH:
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
return g_strdup_printf ("%s (%.2f %.2f)", name, x, y);
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
{
char *tmp, *ret;
tmp = key_event_string (event);
ret = g_strdup_printf ("%s %s\n", name, tmp);
g_free (tmp);
return ret;
}
case GDK_FOCUS_CHANGE:
return g_strdup_printf ("%s %s", name, gdk_focus_event_get_in (event) ? "In" : "Out");
case GDK_GRAB_BROKEN:
case GDK_PROXIMITY_IN:
case GDK_PROXIMITY_OUT:
case GDK_PAD_BUTTON_PRESS:
case GDK_PAD_BUTTON_RELEASE:
case GDK_PAD_RING:
case GDK_PAD_STRIP:
case GDK_PAD_GROUP_MODE:
return g_strdup_printf ("%s", name);
case GDK_SCROLL:
if (gdk_scroll_event_get_direction (event) == GDK_SCROLL_SMOOTH)
{
gdk_scroll_event_get_deltas (event, &x, &y);
return g_strdup_printf ("%s %.2f %.2f", name, x, y);
}
else
{
return g_strdup_printf ("%s %s", name, scroll_direction_name (gdk_scroll_event_get_direction (event)));
}
break;
default:
g_assert_not_reached ();
}
}
static void
bind_widget_for_recording (GtkListItemFactory *factory,
GtkListItem *item,
gpointer data)
{
GtkInspectorRecorder *recorder = GTK_INSPECTOR_RECORDER (data);
GtkInspectorRecording *recording = gtk_list_item_get_item (item);
GtkWidget *row, *box, *label, *label2;
char *text;
row = gtk_list_item_get_child (item);
box = gtk_widget_get_first_child (row);
label = gtk_widget_get_first_child (box);
label2 = gtk_widget_get_next_sibling (label);
g_object_set (row, "sequence", NULL, NULL);
g_object_bind_property (recorder, "selected-sequence", row, "match-sequence", G_BINDING_SYNC_CREATE);
gtk_label_set_use_markup (GTK_LABEL (label), FALSE);
GtkInspectorRecording *recording = GTK_INSPECTOR_RECORDING (item);
GtkWidget *widget;
if (GTK_INSPECTOR_IS_RENDER_RECORDING (recording))
{
gtk_label_set_label (GTK_LABEL (label), "Frame");
gtk_label_set_use_markup (GTK_LABEL (label), FALSE);
cairo_region_t *region;
GtkWidget *hbox, *label, *button;
text = g_strdup_printf ("%.3f", gtk_inspector_recording_get_timestamp (recording) / 1000.0);
gtk_label_set_label (GTK_LABEL (label2), text);
g_free (text);
}
else if (GTK_INSPECTOR_IS_EVENT_RECORDING (recording))
{
GdkEvent *event = gtk_inspector_event_recording_get_event (GTK_INSPECTOR_EVENT_RECORDING (recording));
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
g_object_set (row, "sequence", gdk_event_get_event_sequence (event), NULL);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_append (GTK_BOX (widget), hbox);
text = get_event_summary (event);
gtk_label_set_label (GTK_LABEL (label), text);
g_free (text);
region = cairo_region_create_rectangle (
gtk_inspector_render_recording_get_area (GTK_INSPECTOR_RENDER_RECORDING (recording)));
cairo_region_subtract (region,
gtk_inspector_render_recording_get_clip_region (GTK_INSPECTOR_RENDER_RECORDING (recording)));
cairo_region_destroy (region);
text = g_strdup_printf ("%.3f", gtk_inspector_recording_get_timestamp (recording) / 1000.0);
gtk_label_set_label (GTK_LABEL (label2), text);
g_free (text);
label = gtk_label_new ("<b>Frame</b>");
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
gtk_widget_set_hexpand (label, TRUE);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_box_append (GTK_BOX (hbox), label);
button = gtk_toggle_button_new ();
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
gtk_button_set_icon_name (GTK_BUTTON (button), "view-more-symbolic");
gtk_box_append (GTK_BOX (hbox), button);
label = gtk_label_new (gtk_inspector_render_recording_get_profiler_info (GTK_INSPECTOR_RENDER_RECORDING (recording)));
gtk_widget_hide (label);
gtk_box_append (GTK_BOX (widget), label);
g_object_bind_property (button, "active", label, "visible", 0);
}
else
{
gtk_label_set_label (GTK_LABEL (label), "<b>Start of Recording</b>");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_label_set_label (GTK_LABEL (label2), "");
widget = gtk_label_new ("<b>Start of Recording</b>");
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
}
gtk_widget_set_margin_start (widget, 6);
gtk_widget_set_margin_end (widget, 6);
gtk_widget_set_margin_top (widget, 6);
gtk_widget_set_margin_bottom (widget, 6);
return widget;
}
static void
@@ -1968,14 +1438,6 @@ gtk_inspector_recorder_get_property (GObject *object,
g_value_set_boolean (value, recorder->debug_nodes);
break;
case PROP_HIGHLIGHT_SEQUENCES:
g_value_set_boolean (value, recorder->highlight_sequences);
break;
case PROP_SELECTED_SEQUENCE:
g_value_set_pointer (value, recorder->selected_sequence);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -2000,14 +1462,6 @@ gtk_inspector_recorder_set_property (GObject *object,
gtk_inspector_recorder_set_debug_nodes (recorder, g_value_get_boolean (value));
break;
case PROP_HIGHLIGHT_SEQUENCES:
gtk_inspector_recorder_set_highlight_sequences (recorder, g_value_get_boolean (value));
break;
case PROP_SELECTED_SEQUENCE:
recorder->selected_sequence = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -2050,9 +1504,6 @@ gtk_inspector_recorder_class_init (GtkInspectorRecorderClass *klass)
FALSE,
G_PARAM_READWRITE);
props[PROP_HIGHLIGHT_SEQUENCES] = g_param_spec_boolean ("highlight-sequences", "", "", FALSE, G_PARAM_READWRITE);
props[PROP_SELECTED_SEQUENCE] = g_param_spec_pointer ("selected-sequence", "", "", G_PARAM_READWRITE);
g_object_class_install_properties (object_class, LAST_PROP, props);
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/recorder.ui");
@@ -2065,12 +1516,9 @@ gtk_inspector_recorder_class_init (GtkInspectorRecorderClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, render_node_save_button);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, render_node_clip_button);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, node_property_tree);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, recording_data_stack);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, event_view);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, event_property_tree);
gtk_widget_class_bind_template_callback (widget_class, recordings_clear_all);
gtk_widget_class_bind_template_callback (widget_class, recording_selected);
gtk_widget_class_bind_template_callback (widget_class, recordings_list_row_selected);
gtk_widget_class_bind_template_callback (widget_class, render_node_save);
gtk_widget_class_bind_template_callback (widget_class, render_node_clip);
gtk_widget_class_bind_template_callback (widget_class, node_property_activated);
@@ -2086,11 +1534,11 @@ gtk_inspector_recorder_init (GtkInspectorRecorder *recorder)
gtk_widget_init_template (GTK_WIDGET (recorder));
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_widget_for_recording), recorder);
g_signal_connect (factory, "bind", G_CALLBACK (bind_widget_for_recording), recorder);
gtk_list_view_set_factory (GTK_LIST_VIEW (recorder->recordings_list), factory);
g_object_unref (factory);
gtk_list_box_bind_model (GTK_LIST_BOX (recorder->recordings_list),
recorder->recordings,
gtk_inspector_recorder_recordings_list_create_widget,
recorder,
NULL);
recorder->render_node_root_model = g_list_store_new (GDK_TYPE_PAINTABLE);
recorder->render_node_model = gtk_tree_list_model_new (g_object_ref (G_LIST_MODEL (recorder->render_node_root_model)),
@@ -2113,10 +1561,6 @@ gtk_inspector_recorder_init (GtkInspectorRecorder *recorder)
recorder->render_node_properties = GTK_TREE_MODEL (gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, GDK_TYPE_TEXTURE));
gtk_tree_view_set_model (GTK_TREE_VIEW (recorder->node_property_tree), recorder->render_node_properties);
g_object_unref (recorder->render_node_properties);
recorder->event_properties = GTK_TREE_MODEL (gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, GDK_TYPE_TEXTURE));
gtk_tree_view_set_model (GTK_TREE_VIEW (recorder->event_property_tree), recorder->event_properties);
g_object_unref (recorder->event_properties);
}
static void
@@ -2136,7 +1580,6 @@ gtk_inspector_recorder_set_recording (GtkInspectorRecorder *recorder,
if (recording)
{
recorder->recording = gtk_inspector_start_recording_new ();
recorder->start_time = 0;
gtk_inspector_recorder_add_recording (recorder, recorder->recording);
}
else
@@ -2163,25 +1606,13 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
{
GtkInspectorRecording *recording;
GdkFrameClock *frame_clock;
gint64 frame_time;
if (!gtk_inspector_recorder_is_recording (recorder))
return;
frame_clock = gtk_widget_get_frame_clock (widget);
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
if (recorder->start_time == 0)
{
recorder->start_time = frame_time;
frame_time = 0;
}
else
{
frame_time = frame_time - recorder->start_time;
}
recording = gtk_inspector_render_recording_new (frame_time,
recording = gtk_inspector_render_recording_new (gdk_frame_clock_get_frame_time (frame_clock),
gsk_renderer_get_profiler (renderer),
&(GdkRectangle) { 0, 0,
gdk_surface_get_width (surface),
@@ -2192,36 +1623,6 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
g_object_unref (recording);
}
void
gtk_inspector_recorder_record_event (GtkInspectorRecorder *recorder,
GtkWidget *widget,
GdkEvent *event)
{
GtkInspectorRecording *recording;
GdkFrameClock *frame_clock;
gint64 frame_time;
if (!gtk_inspector_recorder_is_recording (recorder))
return;
frame_clock = gtk_widget_get_frame_clock (widget);
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
if (recorder->start_time == 0)
{
recorder->start_time = frame_time;
frame_time = 0;
}
else
{
frame_time = frame_time - recorder->start_time;
}
recording = gtk_inspector_event_recording_new (frame_time, event);
gtk_inspector_recorder_add_recording (recorder, recording);
g_object_unref (recording);
}
void
gtk_inspector_recorder_set_debug_nodes (GtkInspectorRecorder *recorder,
gboolean debug_nodes)
@@ -2245,48 +1646,4 @@ gtk_inspector_recorder_set_debug_nodes (GtkInspectorRecorder *recorder,
g_object_notify_by_pspec (G_OBJECT (recorder), props[PROP_DEBUG_NODES]);
}
void
gtk_inspector_recorder_set_highlight_sequences (GtkInspectorRecorder *recorder,
gboolean highlight_sequences)
{
GdkEventSequence *sequence = NULL;
if (recorder->highlight_sequences == highlight_sequences)
return;
recorder->highlight_sequences = highlight_sequences;
if (highlight_sequences)
{
GtkSingleSelection *selection;
GtkInspectorRecording *recording;
GdkEvent *event;
selection = GTK_SINGLE_SELECTION (gtk_list_view_get_model (GTK_LIST_VIEW (recorder->recordings_list)));
recording = gtk_single_selection_get_selected_item (selection);
if (GTK_INSPECTOR_IS_EVENT_RECORDING (recording))
{
event = gtk_inspector_event_recording_get_event (GTK_INSPECTOR_EVENT_RECORDING (recording));
sequence = gdk_event_get_event_sequence (event);
}
}
gtk_inspector_recorder_set_selected_sequence (recorder, sequence);
g_object_notify_by_pspec (G_OBJECT (recorder), props[PROP_HIGHLIGHT_SEQUENCES]);
}
void
gtk_inspector_recorder_set_selected_sequence (GtkInspectorRecorder *recorder,
GdkEventSequence *sequence)
{
if (recorder->selected_sequence == sequence)
return;
recorder->selected_sequence = sequence;
g_object_notify_by_pspec (G_OBJECT (recorder), props[PROP_SELECTED_SEQUENCE]);
}
// vim: set et sw=2 ts=2:
-10
View File
@@ -37,12 +37,6 @@ gboolean gtk_inspector_recorder_is_recording (GtkInspectorRec
void gtk_inspector_recorder_set_debug_nodes (GtkInspectorRecorder *recorder,
gboolean debug_nodes);
void gtk_inspector_recorder_set_highlight_sequences (GtkInspectorRecorder *recorder,
gboolean highlight_sequences);
void gtk_inspector_recorder_set_selected_sequence (GtkInspectorRecorder *recorder,
GdkEventSequence *sequence);
void gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
GtkWidget *widget,
GskRenderer *renderer,
@@ -50,10 +44,6 @@ void gtk_inspector_recorder_record_render (GtkInspectorRec
const cairo_region_t *region,
GskRenderNode *node);
void gtk_inspector_recorder_record_event (GtkInspectorRecorder *recorder,
GtkWidget *widget,
GdkEvent *event);
G_END_DECLS
#endif // _GTK_INSPECTOR_RECORDER_H_
+68 -161
View File
@@ -1,10 +1,5 @@
<interface domain="gtk40">
<object class="GtkSingleSelection" id="selection">
<signal name="notify::selected" handler="recording_selected"/>
<property name="model">
<object class="GListStore" id="recordings"/>
</property>
</object>
<object class="GListStore" id="recordings"/>
<template class="GtkInspectorRecorder" parent="GtkWidget">
<child>
<object class="GtkBox" id="box">
@@ -34,14 +29,6 @@
<property name="tooltip-text" translatable="yes">Add debug nodes</property>
<property name="active" bind-source="GtkInspectorRecorder" bind-property="debug-nodes" bind-flags="bidirectional|sync-create"/>
<property name="halign">start</property>
</object>
</child>
<child>
<object class="GtkToggleButton">
<property name="icon-name">function-linear-symbolic</property>
<property name="tooltip-text" translatable="yes">Highlight event sequences</property>
<property name="active" bind-source="GtkInspectorRecorder" bind-property="highlight-sequences" bind-flags="bidirectional|sync-create"/>
<property name="halign">start</property>
<property name="hexpand">1</property>
</object>
</child>
@@ -83,9 +70,9 @@
<property name="hscrollbar-policy">never</property>
<property name="propagate-natural-width">1</property>
<child>
<object class="GtkListView" id="recordings_list">
<object class="GtkListBox" id="recordings_list">
<property name="vexpand">1</property>
<property name="model">selection</property>
<signal name="row-selected" handler="recordings_list_row_selected"/>
</object>
</child>
</object>
@@ -94,155 +81,76 @@
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkStack" id="recording_data_stack">
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="propagate-natural-width">1</property>
<child>
<object class="GtkStackPage">
<property name="name">no_data</property>
<property name="child">
<object class="GtkLabel">
<property name="label">No data.</property>
<property name="halign">center</property>
<property name="valign">center</property>
<object class="GtkListView" id="render_node_list">
<property name="vexpand">1</property>
<property name="hexpand">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkPaned" id="render_paned">
<property name="orientation">vertical</property>
<property name="position">300</property>
<property name="wide-handle">1</property>
<child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkTreeView" id="node_property_tree">
<property name="activate-on-single-click">1</property>
<signal name="row-activated" handler="node_property_activated"/>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Property</property>
<child>
<object class="GtkCellRendererText">
<property name="yalign">0</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Value</property>
<child>
<object class="GtkCellRendererText">
<property name="yalign">0</property>
<property name="wrap-mode">word</property>
<property name="max-width-chars">50</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf">
<property name="xalign">0</property>
</object>
<attributes>
<attribute name="visible">2</attribute>
<attribute name="texture">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</property>
</child>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">frame_data</property>
<property name="child">
<object class="GtkPaned">
<property name="position">400</property>
<property name="wide-handle">1</property>
<child>
<object class="GtkScrolledWindow">
<property name="propagate-natural-width">1</property>
<child>
<object class="GtkListView" id="render_node_list">
<property name="vexpand">1</property>
<property name="hexpand">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkPaned" id="render_paned">
<property name="orientation">vertical</property>
<property name="position">200</property>
<property name="wide-handle">1</property>
<child>
<object class="GtkScrolledWindow">
<property name="propagate-natural-width">1</property>
<child>
<object class="GtkTreeView" id="node_property_tree">
<property name="activate-on-single-click">1</property>
<signal name="row-activated" handler="node_property_activated"/>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Property</property>
<child>
<object class="GtkCellRendererText">
<property name="yalign">0</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Value</property>
<child>
<object class="GtkCellRendererText">
<property name="yalign">0</property>
<property name="wrap-mode">word</property>
<property name="max-width-chars">50</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf">
<property name="xalign">0</property>
</object>
<attributes>
<attribute name="visible">2</attribute>
<attribute name="texture">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkPicture" id="render_node_view">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">event_data</property>
<property name="child">
<object class="GtkPaned">
<property name="position">400</property>
<property name="wide-handle">1</property>
<child>
<object class="GtkScrolledWindow">
<property name="propagate-natural-width">1</property>
<child>
<object class="GtkTreeView" id="event_property_tree">
<property name="activate-on-single-click">1</property>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Property</property>
<child>
<object class="GtkCellRendererText">
<property name="yalign">0</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Value</property>
<child>
<object class="GtkCellRendererText">
<property name="yalign">0</property>
<property name="wrap-mode">word</property>
<property name="max-width-chars">50</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkPicture" id="event_view">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
</object>
</child>
</object>
</property>
<object class="GtkPicture" id="render_node_view">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
</object>
</child>
</object>
@@ -253,4 +161,3 @@
</child>
</template>
</interface>
-138
View File
@@ -1,138 +0,0 @@
/*
* Copyright (c) 2021 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <glib/gi18n-lib.h>
#include "recorderrow.h"
#include <gtk/gtkbinlayout.h>
/* This is a minimal widget whose purpose it is to compare the event sequence
* of its row in the recordings list with the event sequence of the selected
* row, and highlight itself if they match.
*/
struct _GtkInspectorRecorderRow
{
GtkWidget parent;
gpointer sequence;
gpointer match_sequence;
};
enum {
PROP_SEQUENCE = 1,
PROP_MATCH_SEQUENCE,
LAST_PROP
};
static GParamSpec *props[LAST_PROP] = { NULL, };
G_DEFINE_TYPE (GtkInspectorRecorderRow, gtk_inspector_recorder_row, GTK_TYPE_WIDGET)
static void
gtk_inspector_recorder_row_init (GtkInspectorRecorderRow *self)
{
}
static void
dispose (GObject *object)
{
GtkInspectorRecorderRow *self = GTK_INSPECTOR_RECORDER_ROW (object);
gtk_widget_unparent (gtk_widget_get_first_child (GTK_WIDGET (self)));
G_OBJECT_CLASS (gtk_inspector_recorder_row_parent_class)->dispose (object);
}
static void
update_style (GtkInspectorRecorderRow *self)
{
if (self->sequence == self->match_sequence && self->sequence != NULL)
gtk_widget_add_css_class (GTK_WIDGET (self), "highlight");
else
gtk_widget_remove_css_class (GTK_WIDGET (self), "highlight");
}
static void
gtk_inspector_recorder_row_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec)
{
GtkInspectorRecorderRow *self = GTK_INSPECTOR_RECORDER_ROW (object);
switch (param_id)
{
case PROP_SEQUENCE:
g_value_set_pointer (value, self->sequence);
break;
case PROP_MATCH_SEQUENCE:
g_value_set_pointer (value, self->match_sequence);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
gtk_inspector_recorder_row_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec)
{
GtkInspectorRecorderRow *self = GTK_INSPECTOR_RECORDER_ROW (object);
switch (param_id)
{
case PROP_SEQUENCE:
self->sequence = g_value_get_pointer (value);
update_style (self);
break;
case PROP_MATCH_SEQUENCE:
self->match_sequence = g_value_get_pointer (value);
update_style (self);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
gtk_inspector_recorder_row_class_init (GtkInspectorRecorderRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->dispose = dispose;
object_class->set_property = gtk_inspector_recorder_row_set_property;
object_class->get_property = gtk_inspector_recorder_row_get_property;
props[PROP_SEQUENCE] = g_param_spec_pointer ("sequence", "", "", G_PARAM_READWRITE);
props[PROP_MATCH_SEQUENCE] = g_param_spec_pointer ("match-sequence", "", "", G_PARAM_READWRITE);
g_object_class_install_properties (object_class, LAST_PROP, props);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
}
-24
View File
@@ -1,24 +0,0 @@
/*
* Copyright (c) 2021 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <gtk/gtkwidget.h>
#define GTK_TYPE_INSPECTOR_RECORDER_ROW (gtk_inspector_recorder_row_get_type ())
G_DECLARE_FINAL_TYPE (GtkInspectorRecorderRow, gtk_inspector_recorder_row, GTK, INSPECTOR_RECORDER_ROW, GtkWidget)
+2 -6
View File
@@ -184,7 +184,7 @@ open_object_details (GtkWidget *button, GtkInspectorWindow *iw)
GObject *selected;
selected = gtk_inspector_object_tree_get_selected (GTK_INSPECTOR_OBJECT_TREE (iw->object_tree));
gtk_inspector_window_set_object (iw, selected, CHILD_KIND_WIDGET, 0);
gtk_stack_set_visible_child_name (GTK_STACK (iw->object_stack), "object-details");
@@ -752,7 +752,7 @@ gtk_inspector_window_get (GdkDisplay *display)
iw = GTK_WIDGET (g_object_get_data (G_OBJECT (display), "-gtk-inspector"));
if (!iw)
iw = GTK_WIDGET (gtk_inspector_window_new (display));
iw = GTK_WIDGET (gtk_inspector_window_new (display));
return iw;
}
@@ -873,10 +873,6 @@ gtk_inspector_handle_event (GdkEvent *event)
if (iw == NULL)
return FALSE;
gtk_inspector_recorder_record_event (GTK_INSPECTOR_RECORDER (iw->widget_recorder),
gtk_get_event_widget (event),
event);
g_signal_emit (iw, signals[EVENT], 0, event, &handled);
return handled;
+19 -2
View File
@@ -1101,7 +1101,7 @@ if harfbuzz_dep.found() and pangoft_dep.found()
endif
if x11_enabled
x11_data_prefix = dependency('x11').get_variable(pkgconfig: 'prefix')
x11_data_prefix = dependency('x11').get_pkgconfig_variable('prefix')
gtk_cargs += [ '-DX11_DATA_PREFIX="@0@"'.format(x11_data_prefix), ]
gtk_sources += gtk_x11_sources
@@ -1205,11 +1205,28 @@ libgtk_static = static_library('gtk',
link_with: [libgtk_css, libgdk, libgsk ],
)
# `link_whole:` is actually only supported on Visual Studio 2015 Update 2
# or later via the linker flag `/WHOLEARCHIVE:<static_lib>`, so we need
# to work around it for Visual Studio 2013. Note that all needed static
# libs are required so that we grab the object files from each of them to
# link the final GTK DLL.
whole_archives = []
gtk4_objs = []
if cc.get_id() == 'msvc' and cc.version().split('.').get(0) < '19'
foreach target : [ libgtk_static, libgtk_css, libgdk, libgdk_win32, libgsk, libgsk_f16c ]
gtk4_objs += target.extract_all_objects(recursive: false)
endforeach
else
whole_archives = [libgtk_static, libgtk_css, libgdk, libgsk ]
endif
libgtk = shared_library('gtk-4',
c_args: gtk_cargs + common_cflags,
include_directories: [confinc, gdkinc, gskinc, gtkinc],
dependencies: gtk_deps + [libgtk_css_dep, libgdk_dep, libgsk_dep],
link_whole: [libgtk_static, libgtk_css, libgdk, libgsk ],
link_whole: whole_archives,
objects: gtk4_objs,
link_args: common_ldflags,
soversion: gtk_soversion,
version: gtk_library_version,
+7 -14
View File
@@ -622,7 +622,7 @@ button {
min-width: 26px;
min-height: 32px;
&.image-button {
&.image-button {
min-width: 30px;
&:only-child {
margin: 4px;
@@ -911,15 +911,7 @@ modelbutton.flat arrow {
/* oldstyle toolbar buttons */
.toolbar > button,
.toolbar > :not(.linked) > button,
.toolbar :not(.linked) > menubutton > button,
.toolbar :not(.linked) > scalebutton > button,
.toolbar :not(.linked) > dropdown > button,
.toolbar :not(.linked) > colorbutton > button,
.toolbar :not(.linked) > fontbutton > button,
.toolbar :not(.linked) > appchooserbutton > button,
.toolbar :not(.linked) > combobox > box > button {
.toolbar button {
margin: 1px;
@extend %button_basic_flat;
@@ -1327,7 +1319,8 @@ combobox {
background-color: $bg_color;
}
.toolbar {
.toolbar,
toolbar {
@extend %toolbar;
// on OSD
@@ -1876,7 +1869,7 @@ popover.background {
> list,
> .view,
> .toolbar {
> toolbar {
border-style: none;
background-color: transparent;
}
@@ -2431,7 +2424,7 @@ switch {
border-radius: 50%;
transition: $button_transition;
}
> image { color: transparent; } /* only show i / o for the accessible theme */
&:hover > slider {
@@ -2540,7 +2533,7 @@ radio {
}
}
}
@if $variant == 'light' {
// the borders of the light variant versions of checks and radios are too similar in luminosity to the selected background
// color, hence we need special casing.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More