Compare commits

..

1 Commits

Author SHA1 Message Date
Matthias Clasen c640e4a4cc wip: Add a bin with slack
Just an experiment: Make a bin that adds 'slack' around
its child, and avoids resizing unless the child size changes
more than the slack allows.
2020-05-18 21:18:36 -04:00
136 changed files with 2936 additions and 2476 deletions
-3
View File
@@ -292,6 +292,3 @@
#mesondefine HAVE_PANGOFT
#mesondefine ISO_CODES_PREFIX
/* Define if tracker3 is available */
#mesondefine HAVE_TRACKER3
+1 -1
View File
@@ -83,7 +83,7 @@ do_builder (GtkWidget *do_widget)
window);
gtk_widget_insert_action_group (window, "win", actions);
g_object_unref (builder);
g_object_set_data_full (G_OBJECT(window), "builder", builder, g_object_unref);
}
if (!gtk_widget_get_visible (window))
+1 -1
View File
@@ -97,7 +97,7 @@ do_css_basics (GtkWidget *do_widget)
container = gtk_scrolled_window_new (NULL, NULL);
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_text_view_new_with_buffer (text);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (container), child);
gtk_box_append (GTK_BOX (container), child);
g_signal_connect (text, "changed",
G_CALLBACK (css_text_changed), provider);
-2
View File
@@ -134,8 +134,6 @@ do_css_blendmodes (GtkWidget *do_widget)
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
setup_listbox (builder, provider);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
+9 -9
View File
@@ -85,7 +85,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
if (!window)
{
GtkWidget *paned, *overlay, *child, *sw;
GtkWidget *paned, *container, *child;
GtkStyleProvider *provider;
GtkTextBuffer *text;
GBytes *bytes;
@@ -96,25 +96,25 @@ do_css_multiplebgs (GtkWidget *do_widget)
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
overlay = gtk_overlay_new ();
gtk_window_set_child (GTK_WINDOW (window), overlay);
container = gtk_overlay_new ();
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_drawing_area_new ();
gtk_widget_set_name (child, "canvas");
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (child),
drawing_area_draw,
NULL, NULL);
gtk_overlay_set_child (GTK_OVERLAY (overlay), child);
gtk_box_append (GTK_BOX (container), child);
child = gtk_button_new ();
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child);
gtk_overlay_add_overlay (GTK_OVERLAY (container), child);
gtk_widget_set_name (child, "bricks-button");
gtk_widget_set_halign (child, GTK_ALIGN_CENTER);
gtk_widget_set_valign (child, GTK_ALIGN_CENTER);
gtk_widget_set_size_request (child, 250, 84);
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), paned);
gtk_overlay_add_overlay (GTK_OVERLAY (container), paned);
/* Need a filler so we get a handle */
child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
@@ -132,10 +132,10 @@ do_css_multiplebgs (GtkWidget *do_widget)
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_paned_set_end_child (GTK_PANED (paned), sw);
container = gtk_scrolled_window_new (NULL, NULL);
gtk_paned_set_end_child (GTK_PANED (paned), container);
child = gtk_text_view_new_with_buffer (text);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), child);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (container), child);
g_signal_connect (text,
"changed",
G_CALLBACK (css_text_changed),
+1 -1
View File
@@ -29,7 +29,7 @@ do_cursors (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
g_object_unref (builder);
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
}
if (!gtk_widget_get_visible (window))
+4 -13
View File
@@ -25,12 +25,13 @@ static gboolean
reveal_one (gpointer data)
{
GtkWidget *window = data;
GtkBuilder *builder;
gchar *name;
GtkRevealer *revealer;
builder = GTK_BUILDER (g_object_get_data (G_OBJECT (window), "builder"));
name = g_strdup_printf ("revealer%d", count);
revealer = GTK_REVEALER (g_object_get_data (G_OBJECT (window), name));
g_free (name);
revealer = (GtkRevealer *)gtk_builder_get_object (builder, name);
gtk_revealer_set_reveal_child (revealer, TRUE);
@@ -58,7 +59,6 @@ on_destroy (gpointer data)
g_source_remove (timeout);
timeout = 0;
}
}
GtkWidget *
@@ -67,23 +67,14 @@ do_revealer (GtkWidget *do_widget)
if (!window)
{
GtkBuilder *builder;
int i;
builder = gtk_builder_new_from_resource ("/revealer/revealer.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
for (i = 0; i < 10; i++)
{
char *name = g_strdup_printf ("revealer%d", i);
GtkWidget *revealer = GTK_WIDGET (gtk_builder_get_object (builder, name));
g_object_set_data (G_OBJECT (window), name, revealer);
g_free (name);
}
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
g_object_unref (builder);
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
}
if (!gtk_widget_get_visible (window))
+1 -1
View File
@@ -387,7 +387,7 @@ add_choice (GtkWidget *container,
icon = gtk_image_new_from_paintable (paintable);
gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE);
gtk_flow_box_insert (GTK_FLOW_BOX (container), icon, -1);
gtk_box_append (GTK_BOX (container), icon);
}
GtkWidget *
+1 -1
View File
@@ -47,7 +47,7 @@ How to compile GTK itself
</para>
<informalexample>
<programlisting>
meson setup --prefix /opt/gtk builddir
meson --prefix /opt/gtk builddir
</programlisting>
</informalexample>
<para>
+8 -8
View File
@@ -36,7 +36,7 @@ additional environment variables.
<title><envar>GTK_DEBUG</envar></title>
<para>
Unless GTK has been configured with <option>-Ddebug=false</option>,
Unless GTK has been configured with <option>--enable-debug=no</option>,
this variable can be set to a list of debug options, which cause GTK
to print out different types of debugging information.
<variablelist>
@@ -237,7 +237,7 @@ nevertheless.
<title><envar>GDK_DEBUG</envar></title>
<para>
Unless GTK has been configured with <option>-Ddebug=false</option>,
If GTK has been configured with <option>--enable-debug=yes</option>,
this variable can be set to a list of debug options, which cause GDK
to print out different types of debugging information.
<variablelist>
@@ -327,7 +327,7 @@ nevertheless.
<title><envar>GSK_DEBUG</envar></title>
<para>
Unless GTK has been configured with <option>-Ddebug=false</option>,
If GTK has been configured with <option>--enable-debug=yes</option>,
this variable can be set to a list of debug options, which cause GSK
to print out different types of debugging information.
<variablelist>
@@ -432,11 +432,11 @@ nevertheless.
</varlistentry>
</variablelist>
This environment variable can contain a comma-separated list of backend names,
which are tried in order. The list may also contain a *, which means: try all
remaining backends. The special value "help" can be used to make GDK print out
a list of all available backends. For more information about selecting backends,
see the gdk_display_manager_get() function.
Since 3.10, this environment variable can contain a comma-separated list
of backend names, which are tried in order. The list may also contain
a *, which means: try all remaining backends. The special value "help" can
be used to make GDK print out a list of all available backends.
For more information about selecting backends, see the gdk_display_manager_get() function.
</para>
</formalpara>
+6 -5
View File
@@ -21,17 +21,18 @@ Wayland-specific aspects of using GTK
<para>
The GDK Wayland backend provides support for running GTK applications
under a Wayland compositor. To run your application in this way, select
the Wayland backend by setting <literal>GDK_BACKEND=wayland</literal>.
under the Wayland display server. To run your application in this way,
select the Wayland backend by setting <literal>GDK_BACKEND=wayland</literal>.
</para>
<para>
On UNIX, the Wayland backend is enabled by default, so you don't need to
do anything special when compiling it, and everything should "just work."
Currently, the Wayland backend does not use any additional commandline
options or environment variables.
</para>
<para>
Currently, the Wayland backend does not use any additional environment variables.
For up-to-date information about the current status of this backend, see
the <ulink url="https://wiki.gnome.org/Initiatives/Wayland/GTK%2B">project page</ulink>.
</para>
</refsect1>
+62 -10
View File
@@ -25,19 +25,65 @@ on top of the Win32 API. When compiling GTK on Windows, this backend is
the default.
</para>
<refsect2 id="win32-cmdline">
<title>Windows-specific commandline options</title>
<para>
The Windows GDK backend can be influenced with some
additional command line arguments.
</para>
<formalpara>
<title><systemitem>--sync</systemitem></title>
<para>
Don't batch GDI requests. This might be a marginally useful option for
debugging.
</para>
</formalpara>
<formalpara>
<title><systemitem>--no-wintab</systemitem>,
<systemitem>--ignore-wintab</systemitem></title>
<para>
Don't use the Wintab API for tablet support.
</para>
</formalpara>
<formalpara>
<title><systemitem>--use-wintab</systemitem></title>
<para>
Use the Wintab API for tablet support. This is the default.
</para>
</formalpara>
<formalpara>
<title><systemitem>--max-colors <replaceable>number</replaceable></systemitem></title>
<para>
In 256 color mode, restrict the size of the color palette to
the specified number of colors. This option is obsolete.
</para>
</formalpara>
</refsect2>
<refsect2 id="win32-envar">
<title>Windows-specific environment variables</title>
<para>
The Win32 GDK backend can be influenced with some additional environment
variables.
The Win32 GDK backend can be influenced with some
additional environment variables.
</para>
<formalpara>
<title><envar>GDK_IGNORE_WINTAB</envar></title>
<para>
If this variable is set, GTK doesn't use the Wintab API for tablet support.
If this variable is set, GTK doesn't use
the Wintab API for tablet support.
</para>
</formalpara>
@@ -45,8 +91,17 @@ If this variable is set, GTK doesn't use the Wintab API for tablet support.
<title><envar>GDK_USE_WINTAB</envar></title>
<para>
If this variable is set, GTK uses the Wintab API for tablet support.
This is the default.
If this variable is set, GTK uses the Wintab API for
tablet support. This is the default.
</para>
</formalpara>
<formalpara>
<title><envar>GDK_WIN32_MAX_COLORS</envar></title>
<para>
Specifies the size of the color palette used
in 256 color mode.
</para>
</formalpara>
@@ -65,9 +120,7 @@ When any other cursor theme is used, GTK will prefer cursors from that theme,
falling back to Windows cursors and built-in X cursors.
</para>
<para>
Theme can be changed by setting <literal>gtk-cursor-theme-name</literal> GTK
setting. Users can override GTK settings in the <filename>settings.ini</filename>
file or at runtime in the GTK Inspector.
Theme can be changed by setting <literal>gtk-cursor-theme-name</literal> GTK setting. Users can override GTK settings in the <filename>settings.ini</filename> file or at runtime in the GTK Inspector.
</para>
<para>
Themes are loaded from normal Windows variants of the XDG locations:
@@ -76,8 +129,7 @@ Themes are loaded from normal Windows variants of the XDG locations:
<filename>RUNTIME_PREFIX/share/icons/THEME/cursors</filename>.
</para>
<para>
The <literal>gtk-cursor-theme-size</literal> setting is ignored, GTK will use
the cursor size that Windows tells it to use.
The <literal>gtk-cursor-theme-size</literal> setting is ignored, GTK will use the cursor size that Windows tells it to use.
</para>
</refsect2>
+34 -9
View File
@@ -20,16 +20,35 @@ X11-specific aspects of using GTK
<title>GTK for the X Window System</title>
<para>
On UNIX, the X backend is enabled by default, so you don't need to do anything
special when compiling it, and everything should "just work."
On UNIX, the X backend is the default build for GTK.
So you don't need to do anything special when compiling it,
and everything should "just work."
</para>
<para>
To mix low-level Xlib routines into a GTK program, see
<link linkend="gdk-X-Window-System-Interaction">GDK X Window System
interaction</link> in the GDK manual.
To mix low-level Xlib routines into a GTK program,
see <link linkend="gdk-X-Window-System-Interaction">GDK X Window
System interaction</link> in the GDK manual.
</para>
<refsect2 id="x11-cmdline">
<title>X11-specific commandline options</title>
<para>
The X backend understands some additional command line arguments.
</para>
<formalpara>
<title><systemitem>--display <replaceable>display</replaceable></systemitem></title>
<para>
The name of the X display to open instead of the one specified
in the <envar>DISPLAY</envar> environment variable.
</para>
</formalpara>
</refsect2>
<refsect2 id="x11-envar">
<title>X11-specific environment variables</title>
@@ -110,9 +129,9 @@ The window manager is in charge of rendering the frame or borders
around windows; it also has final say on the size of each window,
and window states such as minimized, maximized, and so forth.
On Windows and MacOS the application handles most of this.
On X11, if you wish to modify the window's state, or change its frame,
you must ask the window manager to do so on your behalf, using an
established <ulink
On X11, if you wish to modify the window's state, or
change its frame, you must ask the window manager to do so on your
behalf, using an established <ulink
url="http://www.freedesktop.org/standards/">convention</ulink>.
</para>
@@ -120,11 +139,17 @@ url="http://www.freedesktop.org/standards/">convention</ulink>.
GTK has functions for asking the window manager to do various things;
see for example <link
linkend="gtk-window-minimize">gtk_window_minimize()</link> or <link
linkend="gtk-window-maximize">gtk_window_maximize()</link>.
linkend="gtk-window-maximize">gtk_window_maximize()</link> or <link
linkend="gtk-window-set-decorated">gtk_window_set_decorated()</link>.
Keep in mind that most window managers <emphasis>will</emphasis> ignore
certain requests from time to time, in the interests of good user interface.
</para>
<!--
May also want to explain DESKTOP_STARTUP_ID here.
http://www.freedesktop.org/Standards/startup-notification-spec
-->
</refsect2>
</refsect1>
-1
View File
@@ -12,7 +12,6 @@ typedef struct
typedef GtkApplicationClass BloatPadClass;
GType bloat_pad_get_type (void);
G_DEFINE_TYPE (BloatPad, bloat_pad, GTK_TYPE_APPLICATION)
static void
+1 -1
View File
@@ -2,4 +2,4 @@ bp_resources = gnome.compile_resources('bloatpad_resources',
'bloatpad.gresources.xml',
source_dir: '.')
executable('bloatpad', 'bloatpad.c', bp_resources, dependencies: libgtk_dep, c_args: common_cflags)
executable('bloatpad', 'bloatpad.c', bp_resources, dependencies: libgtk_dep)
+4 -2
View File
@@ -54,7 +54,8 @@ static void gdk_broadway_device_ungrab (GdkDevice *device,
static GdkSurface * gdk_broadway_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask);
GdkModifierType *mask,
gboolean get_toplevel);
G_DEFINE_TYPE (GdkBroadwayDevice, gdk_broadway_device, GDK_TYPE_DEVICE)
@@ -291,7 +292,8 @@ static GdkSurface *
gdk_broadway_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask)
GdkModifierType *mask,
gboolean get_toplevel)
{
GdkSurface *surface = NULL;
+10 -8
View File
@@ -628,7 +628,7 @@ gdk_device_get_surface_at_position (GdkDevice *device,
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL);
surface = _gdk_device_surface_at_position (device, &tmp_x, &tmp_y, NULL);
surface = _gdk_device_surface_at_position (device, &tmp_x, &tmp_y, NULL, FALSE);
if (win_x)
*win_x = tmp_x;
@@ -1588,15 +1588,17 @@ _gdk_device_query_state (GdkDevice *device,
}
GdkSurface *
_gdk_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask)
_gdk_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
{
return GDK_DEVICE_GET_CLASS (device)->surface_at_position (device,
win_x,
win_y,
mask);
win_x,
win_y,
mask,
get_toplevel);
}
/**
+4 -2
View File
@@ -105,7 +105,8 @@ struct _GdkDeviceClass
GdkSurface * (* surface_at_position) (GdkDevice *device,
double *win_x,
double *win_y,
GdkModifierType *mask);
GdkModifierType *mask,
gboolean get_toplevel);
};
void _gdk_device_set_associated_device (GdkDevice *device,
@@ -166,7 +167,8 @@ void _gdk_device_query_state (GdkDevice *device,
GdkSurface * _gdk_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask);
GdkModifierType *mask,
gboolean get_toplevel);
void gdk_device_set_seat (GdkDevice *device,
GdkSeat *seat);
+1 -1
View File
@@ -589,7 +589,7 @@ get_current_toplevel (GdkDisplay *display,
gdouble x, y;
GdkModifierType state;
pointer_surface = _gdk_device_surface_at_position (device, &x, &y, &state);
pointer_surface = _gdk_device_surface_at_position (device, &x, &y, &state, TRUE);
if (pointer_surface != NULL &&
GDK_SURFACE_DESTROYED (pointer_surface))
+4 -71
View File
@@ -380,64 +380,6 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
*out_final_rect = final_rect;
}
/* Since GdkEvent is a GTypeInstance, GValue can only store it as a pointer,
* and GClosure does not know how to handle its memory management. To avoid
* the event going away in the middle of the signal emission, we provide a
* marshaller that keeps the event alive for the duration of the closure.
*/
static void
gdk_surface_event_marshaller (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data)
{
GdkEvent *event = g_value_get_pointer (&param_values[1]);
gdk_event_ref (event);
_gdk_marshal_BOOLEAN__POINTER (closure,
return_value,
n_param_values,
param_values,
invocation_hint,
marshal_data);
gdk_event_unref (event);
}
static void
gdk_surface_event_marshallerv (GClosure *closure,
GValue *return_value,
gpointer instance,
va_list args,
gpointer marshal_data,
int n_params,
GType *param_types)
{
va_list args_copy;
GdkEvent *event;
G_VA_COPY (args_copy, args);
event = va_arg (args_copy, gpointer);
gdk_event_ref (event);
_gdk_marshal_BOOLEAN__POINTERv (closure,
return_value,
instance,
args,
marshal_data,
n_params,
param_types);
gdk_event_unref (event);
va_end (args_copy);
}
static void
gdk_surface_init (GdkSurface *surface)
{
@@ -578,7 +520,7 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
/**
* GdkSurface::event:
* @surface: the #GdkSurface
* @event: (type Gdk.Event): an input event
* @event: an input event
*
* Emitted when GDK receives an input event for @surface.
*
@@ -591,13 +533,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
0,
g_signal_accumulator_true_handled,
NULL,
gdk_surface_event_marshaller,
_gdk_marshal_BOOLEAN__POINTER,
G_TYPE_BOOLEAN,
1,
G_TYPE_POINTER);
GDK_TYPE_EVENT);
g_signal_set_va_marshaller (signals[EVENT],
G_OBJECT_CLASS_TYPE (object_class),
gdk_surface_event_marshallerv);
_gdk_marshal_BOOLEAN__POINTERv);
/**
* GdkSurface::enter-montor:
@@ -2118,9 +2060,6 @@ gdk_surface_set_input_region (GdkSurface *surface,
if (GDK_SURFACE_DESTROYED (surface))
return;
if (cairo_region_equal (surface->input_region, region))
return;
if (surface->input_region)
cairo_region_destroy (surface->input_region);
@@ -2705,12 +2644,6 @@ gdk_surface_set_shadow_width (GdkSurface *surface,
g_return_if_fail (!GDK_SURFACE_DESTROYED (surface));
g_return_if_fail (left >= 0 && right >= 0 && top >= 0 && bottom >= 0);
if (surface->shadow_left == left &&
surface->shadow_right == right &&
surface->shadow_top == top &&
surface->shadow_bottom == bottom)
return;
surface->shadow_top = top;
surface->shadow_left = left;
surface->shadow_right = right;
+4 -3
View File
@@ -802,9 +802,10 @@ gdk_wayland_device_ungrab (GdkDevice *device,
static GdkSurface *
gdk_wayland_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask)
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
{
GdkWaylandPointerData *pointer;
-2
View File
@@ -2530,8 +2530,6 @@ gdk_wayland_display_remove_output (GdkWaylandDisplay *self,
g_list_store_remove (self->monitors, i);
gdk_monitor_invalidate (GDK_MONITOR (monitor));
update_scale (GDK_DISPLAY (self));
g_object_unref (monitor);
break;
}
g_object_unref (monitor);
+54 -26
View File
@@ -177,9 +177,10 @@ screen_to_client (HWND hwnd, POINT screen_pt, POINT *client_pt)
GdkSurface *
_gdk_device_win32_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask)
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
{
GdkSurface *window = NULL;
GdkWin32Surface *impl = NULL;
@@ -189,33 +190,60 @@ _gdk_device_win32_surface_at_position (GdkDevice *device,
GetCursorPos (&screen_pt);
/* Only consider visible children of the desktop to avoid the various
* non-visible windows you often find on a running Windows box. These
* might overlap our windows and cause our walk to fail. As we assume
* WindowFromPoint() can find our windows, we follow similar logic
* here, and ignore invisible and disabled windows.
*/
hwnd = GetDesktopWindow ();
do {
window = gdk_win32_handle_table_lookup (hwnd);
if (get_toplevel)
{
/* Only consider visible children of the desktop to avoid the various
* non-visible windows you often find on a running Windows box. These
* might overlap our windows and cause our walk to fail. As we assume
* WindowFromPoint() can find our windows, we follow similar logic
* here, and ignore invisible and disabled windows.
*/
hwnd = GetDesktopWindow ();
do {
window = gdk_win32_handle_table_lookup (hwnd);
if (window != NULL)
break;
if (window != NULL)
break;
screen_to_client (hwnd, screen_pt, &client_pt);
hwndc = ChildWindowFromPointEx (hwnd, client_pt, CWP_SKIPDISABLED |
CWP_SKIPINVISIBLE);
screen_to_client (hwnd, screen_pt, &client_pt);
hwndc = ChildWindowFromPointEx (hwnd, client_pt, CWP_SKIPDISABLED |
CWP_SKIPINVISIBLE);
/* Verify that we're really inside the client area of the window */
if (hwndc != hwnd)
{
GetClientRect (hwndc, &rect);
screen_to_client (hwndc, screen_pt, &client_pt);
if (!PtInRect (&rect, client_pt))
hwndc = hwnd;
}
/* Verify that we're really inside the client area of the window */
if (hwndc != hwnd)
{
GetClientRect (hwndc, &rect);
screen_to_client (hwndc, screen_pt, &client_pt);
if (!PtInRect (&rect, client_pt))
hwndc = hwnd;
}
} while (hwndc != hwnd && (hwnd = hwndc, 1));
} while (hwndc != hwnd && (hwnd = hwndc, 1));
}
else
{
hwnd = WindowFromPoint (screen_pt);
/* Verify that we're really inside the client area of the window */
GetClientRect (hwnd, &rect);
screen_to_client (hwnd, screen_pt, &client_pt);
if (!PtInRect (&rect, client_pt))
hwnd = NULL;
/* If we didn't hit any window at that point, return the desktop */
if (hwnd == NULL)
{
if (win_x)
*win_x = screen_pt.x + _gdk_offset_x;
if (win_y)
*win_y = screen_pt.y + _gdk_offset_y;
return NULL;
}
window = gdk_win32_handle_table_lookup (hwnd);
}
if (window && (win_x || win_y))
{
+4 -3
View File
@@ -45,9 +45,10 @@ struct _GdkDeviceWin32Class
GType gdk_device_win32_get_type (void) G_GNUC_CONST;
GdkSurface *_gdk_device_win32_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask);
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
G_END_DECLS
+4 -3
View File
@@ -188,9 +188,10 @@ gdk_device_wintab_ungrab (GdkDevice *device,
static GdkSurface *
gdk_device_wintab_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask)
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
{
return NULL;
}
+9 -7
View File
@@ -95,9 +95,10 @@ static void gdk_x11_device_xi2_ungrab (GdkDevice *device,
guint32 time_);
static GdkSurface * gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask);
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
enum {
@@ -447,9 +448,10 @@ gdk_x11_device_xi2_ungrab (GdkDevice *device,
static GdkSurface *
gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask)
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
{
GdkX11Surface *impl;
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
@@ -585,7 +587,7 @@ gdk_x11_device_xi2_surface_at_position (GdkDevice *device,
if (!retval)
break;
if (last != root &&
if (get_toplevel && last != root &&
(surface = gdk_x11_surface_lookup_for_display (display, last)) != NULL)
{
xwindow = last;
-31
View File
@@ -106,8 +106,6 @@ static void set_wm_name (GdkDisplay *display,
const gchar *name);
static void move_to_current_desktop (GdkSurface *surface);
static void gdk_x11_toplevel_state_callback (GdkSurface *surface);
static gboolean gdk_x11_toplevel_event_callback (GdkSurface *surface,
GdkEvent *gdk_event);
/* Return whether time1 is considered later than time2 as far as xserver
* time is concerned. Accounts for wraparound.
@@ -151,9 +149,6 @@ _gdk_x11_surface_get_toplevel (GdkSurface *surface)
g_signal_connect (surface, "notify::state",
G_CALLBACK (gdk_x11_toplevel_state_callback),
NULL);
g_signal_connect (surface, "event",
G_CALLBACK (gdk_x11_toplevel_event_callback),
NULL);
}
return impl->toplevel;
@@ -454,9 +449,6 @@ gdk_x11_surface_finalize (GObject *object)
g_signal_handlers_disconnect_by_func (GDK_SURFACE (impl),
gdk_x11_toplevel_state_callback,
NULL);
g_signal_handlers_disconnect_by_func (GDK_SURFACE (impl),
gdk_x11_toplevel_event_callback,
NULL);
_gdk_x11_surface_grab_check_destroy (GDK_SURFACE (impl));
@@ -5041,29 +5033,6 @@ gdk_x11_toplevel_state_callback (GdkSurface *surface)
gdk_x11_toplevel_restore_system_shortcuts (GDK_TOPLEVEL (surface));
}
static gboolean
gdk_x11_toplevel_event_callback (GdkSurface *surface,
GdkEvent *gdk_event)
{
GdkSeat *gdk_seat;
if (!surface->shortcuts_inhibited)
return FALSE;
if (gdk_event_get_event_type (gdk_event) != GDK_GRAB_BROKEN)
return FALSE;
gdk_seat = gdk_surface_get_seat_from_event (surface, gdk_event);
if (gdk_seat != surface->current_shortcuts_inhibited_seat)
return FALSE;
surface->current_shortcuts_inhibited_seat = NULL;
surface->shortcuts_inhibited = FALSE;
g_object_notify (G_OBJECT (surface), "shortcuts-inhibited");
return FALSE;
}
static void
gdk_x11_toplevel_iface_init (GdkToplevelInterface *iface)
{
-287
View File
@@ -1,287 +0,0 @@
#pragma once
#define SANITY_CHECKS 0
enum {
NINE_SLICE_TOP_LEFT = 0,
NINE_SLICE_TOP_CENTER = 1,
NINE_SLICE_TOP_RIGHT = 2,
NINE_SLICE_LEFT_CENTER = 3,
NINE_SLICE_CENTER = 4,
NINE_SLICE_RIGHT_CENTER = 5,
NINE_SLICE_BOTTOM_LEFT = 6,
NINE_SLICE_BOTTOM_CENTER = 7,
NINE_SLICE_BOTTOM_RIGHT = 8,
};
#define NINE_SLICE_SIZE 9 /* Hah. */
typedef struct
{
int texture_id;
float x;
float y;
float x2;
float y2;
} TextureRegion;
static inline bool G_GNUC_PURE
slice_is_visible (const cairo_rectangle_int_t *r)
{
return (r->width > 0 && r->height > 0);
}
static inline void
nine_slice_rounded_rect (const GskRoundedRect *rect,
cairo_rectangle_int_t *out_rects)
{
const graphene_point_t *origin = &rect->bounds.origin;
const graphene_size_t *size = &rect->bounds.size;
const int top_height = ceilf (MAX (rect->corner[GSK_CORNER_TOP_LEFT].height,
rect->corner[GSK_CORNER_TOP_RIGHT].height));
const int bottom_height = ceilf (MAX (rect->corner[GSK_CORNER_BOTTOM_LEFT].height,
rect->corner[GSK_CORNER_BOTTOM_RIGHT].height));
const int right_width = ceilf (MAX (rect->corner[GSK_CORNER_TOP_RIGHT].width,
rect->corner[GSK_CORNER_BOTTOM_RIGHT].width));
const int left_width = ceilf (MAX (rect->corner[GSK_CORNER_TOP_LEFT].width,
rect->corner[GSK_CORNER_BOTTOM_LEFT].width));
/* Top left */
out_rects[0] = (cairo_rectangle_int_t) {
origin->x, origin->y,
left_width, top_height,
};
/* Top center */
out_rects[1] = (cairo_rectangle_int_t) {
origin->x + size->width / 2.0 - 0.5, origin->y,
1, top_height,
};
/* Top right */
out_rects[2] = (cairo_rectangle_int_t) {
origin->x + size->width - right_width, origin->y,
right_width, top_height
};
/* Left center */
out_rects[3] = (cairo_rectangle_int_t) {
origin->x, origin->y + size->height / 2,
left_width, 1,
};
/* center */
out_rects[4] = (cairo_rectangle_int_t) {
origin->x + size->width / 2.0 - 0.5,
origin->y + size->height / 2.0 - 0.5,
1, 1
};
/* Right center */
out_rects[5] = (cairo_rectangle_int_t) {
origin->x + size->width - right_width,
origin->y + (size->height / 2.0) - 0.5,
right_width,
1,
};
/* Bottom Left */
out_rects[6] = (cairo_rectangle_int_t) {
origin->x, origin->y + size->height - bottom_height,
left_width, bottom_height,
};
/* Bottom center */
out_rects[7] = (cairo_rectangle_int_t) {
origin->x + (size->width / 2.0) - 0.5,
origin->y + size->height - bottom_height,
1, bottom_height,
};
/* Bottom right */
out_rects[8] = (cairo_rectangle_int_t) {
origin->x + size->width - right_width,
origin->y + size->height - bottom_height,
right_width, bottom_height,
};
#if SANITY_CHECKS
g_assert_cmpfloat (size->width, >=, left_width + right_width);
g_assert_cmpfloat (size->height, >=, top_height + bottom_height);
#endif
}
static inline void
nine_slice_grow (cairo_rectangle_int_t *slices,
const int amount)
{
/* top left */
slices[0].x -= amount;
slices[0].y -= amount;
if (amount > slices[0].width)
slices[0].width += amount * 2;
else
slices[0].width += amount;
if (amount > slices[0].height)
slices[0].height += amount * 2;
else
slices[0].height += amount;
/* Top center */
slices[1].y -= amount;
if (amount > slices[1].height)
slices[1].height += amount * 2;
else
slices[1].height += amount;
/* top right */
slices[2].y -= amount;
if (amount > slices[2].width)
{
slices[2].x -= amount;
slices[2].width += amount * 2;
}
else
{
slices[2].width += amount;
}
if (amount > slices[2].height)
slices[2].height += amount * 2;
else
slices[2].height += amount;
slices[3].x -= amount;
if (amount > slices[3].width)
slices[3].width += amount * 2;
else
slices[3].width += amount;
/* Leave Britney^Wcenter alone */
if (amount > slices[5].width)
{
slices[5].x -= amount;
slices[5].width += amount * 2;
}
else
{
slices[5].width += amount;
}
/* Bottom left */
slices[6].x -= amount;
if (amount > slices[6].width)
{
slices[6].width += amount * 2;
}
else
{
slices[6].width += amount;
}
if (amount > slices[6].height)
{
slices[6].y -= amount;
slices[6].height += amount * 2;
}
else
{
slices[6].height += amount;
}
/* Bottom center */
if (amount > slices[7].height)
{
slices[7].y -= amount;
slices[7].height += amount * 2;
}
else
{
slices[7].height += amount;
}
if (amount > slices[8].width)
{
slices[8].x -= amount;
slices[8].width += amount * 2;
}
else
{
slices[8].width += amount;
}
if (amount > slices[8].height)
{
slices[8].y -= amount;
slices[8].height += amount * 2;
}
else
{
slices[8].height += amount;
}
#if SANITY_CHECKS
{
for (int i = 0; i < 9; i ++)
{
g_assert_cmpint (slices[i].x, >=, 0);
g_assert_cmpint (slices[i].y, >=, 0);
g_assert_cmpint (slices[i].width, >=, 0);
g_assert_cmpint (slices[i].height, >=, 0);
}
/* Rows don't overlap */
for (int i = 0; i < 3; i++)
{
g_assert_cmpint (slices[i * 3 + 0].x + slices[i * 3 + 0].width, <, slices[i * 3 + 1].x);
}
}
#endif
}
static inline void
nine_slice_to_texture_coords (const cairo_rectangle_int_t *slices,
const int texture_width,
const int texture_height,
TextureRegion *out_regions)
{
const float fw = (float)texture_width;
const float fh = (float)texture_height;
int i;
for (i = 0; i < 9; i++)
{
out_regions[i] = (TextureRegion) {
0, /* Texture id */
slices[i].x / fw,
1.0 - ((slices[i].y + slices[i].height) / fh),
(slices[i].x + slices[i].width) / fw,
1.0 - (slices[i].y / fh),
};
}
#if SANITY_CHECKS
{
for (i = 0; i < 9; i++)
{
const TextureRegion *r = &out_regions[i];
g_assert_cmpfloat (r->x, >=, 0);
g_assert_cmpfloat (r->x, <=, 1);
g_assert_cmpfloat (r->y, >=, 0);
g_assert_cmpfloat (r->y, <=, 1);
g_assert_cmpfloat (r->x, <, r->x2);
g_assert_cmpfloat (r->y, <, r->y2);
}
}
#endif
}
+133 -123
View File
@@ -18,7 +18,6 @@
#include "gskglshadowcacheprivate.h"
#include "gskglnodesampleprivate.h"
#include "gsktransform.h"
#include "glutilsprivate.h"
#include "gskprivate.h"
@@ -74,6 +73,15 @@ typedef enum
NO_CACHE_PLZ = 1 << 5,
} OffscreenFlags;
typedef struct
{
int texture_id;
float x;
float y;
float x2;
float y2;
} TextureRegion;
static inline void
init_full_texture_region (TextureRegion *r,
int texture_id)
@@ -273,15 +281,13 @@ node_supports_transform (GskRenderNode *node)
case GSK_OPACITY_NODE:
case GSK_COLOR_MATRIX_NODE:
case GSK_TEXTURE_NODE:
case GSK_TRANSFORM_NODE:
case GSK_CROSS_FADE_NODE:
case GSK_LINEAR_GRADIENT_NODE:
case GSK_DEBUG_NODE:
case GSK_TEXT_NODE:
return TRUE;
case GSK_TRANSFORM_NODE:
return node_supports_transform (gsk_transform_node_get_child (node));
default:
return FALSE;
}
@@ -1706,8 +1712,6 @@ render_unblurred_outset_shadow_node (GskGLRenderer *self,
load_vertex_data (ops_draw (builder, NULL), node, builder);
}
static GdkRGBA COLOR_WHITE = { 1, 1, 1, 1 };
static inline void
render_outset_shadow_node (GskGLRenderer *self,
@@ -1719,12 +1723,12 @@ render_outset_shadow_node (GskGLRenderer *self,
const GdkRGBA *color = gsk_outset_shadow_node_peek_color (node);
const float blur_radius = gsk_outset_shadow_node_get_blur_radius (node);
const float blur_extra = blur_radius * 3; /* 3 Because we use that in the shader as well */
const int extra_blur_pixels = (int) ceilf(blur_extra / 2.0 * scale);
const float spread = gsk_outset_shadow_node_get_spread (node);
const float dx = gsk_outset_shadow_node_get_dx (node);
const float dy = gsk_outset_shadow_node_get_dy (node);
GskRoundedRect scaled_outline;
int texture_width, texture_height;
GskRoundedRect unscaled_outline;
float texture_width, texture_height;
OpShadow *shadow;
int blurred_texture_id;
int cached_tid;
@@ -1736,19 +1740,21 @@ render_outset_shadow_node (GskGLRenderer *self,
gsk_rounded_rect_shrink_to_minimum (&scaled_outline);
/* Increase by the spread */
gsk_rounded_rect_shrink (&scaled_outline, -spread, -spread, -spread, -spread);
/* Grow bounds but don't grow corners */
graphene_rect_inset (&scaled_outline.bounds, - extra_blur_pixels, - extra_blur_pixels);
/* For the center part, we add a few pixels */
scaled_outline.bounds.size.width += SHADOW_EXTRA_SIZE;
scaled_outline.bounds.size.height += SHADOW_EXTRA_SIZE;
texture_width = (int)ceil ((scaled_outline.bounds.size.width + blur_extra) * scale);
texture_height = (int)ceil ((scaled_outline.bounds.size.height + blur_extra) * scale);
texture_width = ceil ((scaled_outline.bounds.size.width + (blur_extra)) * scale);
texture_height = ceil ((scaled_outline.bounds.size.height + (blur_extra)) * scale);
/* Preserve this for usage later */
unscaled_outline = scaled_outline;
scaled_outline.bounds.origin.x = blur_extra / 2.0 * scale;
scaled_outline.bounds.origin.y = blur_extra / 2.0 * scale;
scaled_outline.bounds.size.width = texture_width - (blur_extra * scale);
scaled_outline.bounds.size.height = texture_height - (blur_extra * scale);
scaled_outline.bounds.origin.x = extra_blur_pixels;
scaled_outline.bounds.origin.y = extra_blur_pixels;
scaled_outline.bounds.size.width = texture_width - (extra_blur_pixels * 2);
scaled_outline.bounds.size.height = texture_height - (extra_blur_pixels * 2);
for (int i = 0; i < 4; i ++)
{
@@ -1776,7 +1782,6 @@ render_outset_shadow_node (GskGLRenderer *self,
gdk_gl_context_label_object_printf (self->gl_context, GL_FRAMEBUFFER, render_target,
"Outset Shadow FB Temp %d", render_target);
ops_set_program (builder, &self->programs->color_program);
graphene_matrix_init_ortho (&item_proj,
0, texture_width, 0, texture_height,
ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE);
@@ -1789,6 +1794,7 @@ render_outset_shadow_node (GskGLRenderer *self,
prev_viewport = ops_set_viewport (builder, &GRAPHENE_RECT_INIT (0, 0, texture_width, texture_height));
/* Draw outline */
ops_set_program (builder, &self->programs->color_program);
ops_push_clip (builder, &scaled_outline);
ops_set_color (builder, &COLOR_WHITE);
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
@@ -1833,36 +1839,46 @@ render_outset_shadow_node (GskGLRenderer *self,
shadow->outline = transform_rect (self, builder, outline);
{
const float min_x = floorf (builder->dx + outline->bounds.origin.x - spread - (blur_extra / 2.0) + dx);
const float min_y = floorf (builder->dy + outline->bounds.origin.y - spread - (blur_extra / 2.0) + dy);
const float max_x = ceilf (builder->dx + outline->bounds.origin.x + outline->bounds.size.width +
(blur_extra / 2.0) + dx + spread);
const float max_y = ceilf (builder->dy + outline->bounds.origin.y + outline->bounds.size.height +
(blur_extra / 2.0) + dy + spread);
const float min_x = builder->dx + outline->bounds.origin.x - spread - (blur_extra / 2.0) + dx;
const float min_y = builder->dy + outline->bounds.origin.y - spread - (blur_extra / 2.0) + dy;
const float max_x = min_x + outline->bounds.size.width + (spread + (blur_extra / 2.0)) * 2;
const float max_y = min_y + outline->bounds.size.height + (spread + (blur_extra / 2.0)) * 2;
const float left_width = MAX (MAX (unscaled_outline.corner[GSK_CORNER_TOP_LEFT].width,
unscaled_outline.corner[GSK_CORNER_BOTTOM_LEFT].width),
blur_extra / 2.0);
const float top_height = MAX (MAX (unscaled_outline.corner[GSK_CORNER_TOP_LEFT].height,
unscaled_outline.corner[GSK_CORNER_TOP_RIGHT].height),
blur_extra / 2.0);
const float right_width = MAX (MAX (unscaled_outline.corner[GSK_CORNER_TOP_RIGHT].width,
unscaled_outline.corner[GSK_CORNER_BOTTOM_RIGHT].width),
blur_extra / 2.0);
const float bottom_height = MAX (MAX (unscaled_outline.corner[GSK_CORNER_BOTTOM_LEFT].height,
unscaled_outline.corner[GSK_CORNER_BOTTOM_RIGHT].height),
blur_extra / 2.0);
const float center_width = (max_x - min_x) - left_width - right_width;
const float center_height = (max_y - min_y) - top_height - bottom_height;
float x1, x2, y1, y2, tx1, tx2, ty1, ty2;
cairo_rectangle_int_t slices[9];
TextureRegion tregs[9];
/* TODO: The slicing never changes and could just go into the cache */
nine_slice_rounded_rect (&scaled_outline, slices);
nine_slice_grow (slices, extra_blur_pixels);
nine_slice_to_texture_coords (slices, texture_width, texture_height, tregs);
/* Our texture coordinates MUST be scaled, while the actual vertex coords
* MUST NOT be scaled. */
/* Top left */
if (slice_is_visible (&slices[NINE_SLICE_TOP_LEFT]))
if (top_height > 0 && left_width > 0)
{
x1 = min_x;
x2 = min_x + (slices[NINE_SLICE_TOP_LEFT].width / scale);
x2 = min_x + left_width;
y1 = min_y;
y2 = min_y + (slices[NINE_SLICE_TOP_LEFT].height / scale);
y2 = min_y + top_height;
tx1 = tregs[NINE_SLICE_TOP_LEFT].x;
tx2 = tregs[NINE_SLICE_TOP_LEFT].x2;
ty1 = tregs[NINE_SLICE_TOP_LEFT].y;
ty2 = tregs[NINE_SLICE_TOP_LEFT].y2;
tx1 = 0;
tx2 = (left_width * scale) / texture_width;
ty1 = 1 - (top_height * scale / texture_height);
ty2 = 1;
g_assert_cmpfloat (x1, <=, x2);
g_assert_cmpfloat (y1, <=, y2);
g_assert_cmpfloat (tx1, <=, tx2);
g_assert_cmpfloat (ty1, <=, ty2);
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
@@ -1875,18 +1891,23 @@ render_outset_shadow_node (GskGLRenderer *self,
});
}
/* Top center */
if (slice_is_visible (&slices[NINE_SLICE_TOP_CENTER]))
/* Top side */
if (top_height > 0 && center_width > 0)
{
x1 = min_x + (slices[NINE_SLICE_TOP_LEFT].width / scale);
x2 = max_x - (slices[NINE_SLICE_TOP_RIGHT].width / scale);
x1 = min_x + left_width;
x2 = x1 + center_width;
y1 = min_y;
y2 = min_y + (slices[NINE_SLICE_TOP_CENTER].height / scale);
y2 = min_y + top_height;
tx1 = tregs[NINE_SLICE_TOP_CENTER].x;
tx2 = tregs[NINE_SLICE_TOP_CENTER].x2;
ty1 = tregs[NINE_SLICE_TOP_CENTER].y;
ty2 = tregs[NINE_SLICE_TOP_CENTER].y2;
tx1 = left_width * scale / texture_width;
tx2 = 1.0 - (right_width * scale / texture_width);
ty1 = 1 - (top_height * scale / texture_height);
ty2 = 1;
g_assert_cmpfloat (x1, <=, x2);
g_assert_cmpfloat (y1, <=, y2);
g_assert_cmpfloat (tx1, <=, tx2);
g_assert_cmpfloat (ty1, <=, ty2);
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
@@ -1900,23 +1921,20 @@ render_outset_shadow_node (GskGLRenderer *self,
}
/* Top right */
if (slice_is_visible (&slices[NINE_SLICE_TOP_RIGHT]))
{
x1 = max_x - (slices[NINE_SLICE_TOP_RIGHT].width / scale);
x2 = max_x;
y1 = min_y;
y2 = min_y + (slices[NINE_SLICE_TOP_RIGHT].height / scale);
tx1 = tregs[NINE_SLICE_TOP_RIGHT].x;
tx2 = tregs[NINE_SLICE_TOP_RIGHT].x2;
ty1 = tregs[NINE_SLICE_TOP_RIGHT].y;
ty2 = tregs[NINE_SLICE_TOP_RIGHT].y2;
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
{ { x1, y2 }, { tx1, ty1 }, },
{ { x2, y1 }, { tx2, ty2 }, },
if (top_height > 0 && right_width > 0)
{
x1 = max_x - right_width;
x2 = max_x;
y1 = min_y;
y2 = min_y + top_height;
tx1 = 1 - (right_width * scale / texture_width);
tx2 = 1;
ty1 = 1 - (top_height * scale / texture_height);
ty2 = 1;
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
{ { x1, y2 }, { tx1, ty1 }, },
{ { x2, y1 }, { tx2, ty2 }, },
{ { x2, y2 }, { tx2, ty1 }, },
{ { x1, y2 }, { tx1, ty1 }, },
@@ -1925,17 +1943,16 @@ render_outset_shadow_node (GskGLRenderer *self,
}
/* Bottom right */
if (slice_is_visible (&slices[NINE_SLICE_BOTTOM_RIGHT]))
if (bottom_height > 0 && left_width > 0)
{
x1 = max_x - (slices[NINE_SLICE_BOTTOM_RIGHT].width / scale);
x1 = max_x - right_width;
x2 = max_x;
y1 = max_y - (slices[NINE_SLICE_BOTTOM_RIGHT].height / scale);
y1 = max_y - bottom_height;
y2 = max_y;
tx1 = tregs[NINE_SLICE_BOTTOM_RIGHT].x;
tx2 = tregs[NINE_SLICE_BOTTOM_RIGHT].x2;
ty1 = tregs[NINE_SLICE_BOTTOM_RIGHT].y;
ty2 = tregs[NINE_SLICE_BOTTOM_RIGHT].y2;
tx1 = 1 - (right_width * scale / texture_width);
tx2 = 1;
ty1 = 0;
ty2 = (bottom_height * scale / texture_height);
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
{ { x1, y2 }, { tx1, ty1 }, },
@@ -1948,18 +1965,16 @@ render_outset_shadow_node (GskGLRenderer *self,
}
/* Bottom left */
if (slice_is_visible (&slices[NINE_SLICE_BOTTOM_LEFT]))
if (bottom_height > 0 && left_width > 0)
{
x1 = min_x;
x2 = min_x + (slices[NINE_SLICE_BOTTOM_LEFT].width / scale);
y1 = max_y - (slices[NINE_SLICE_BOTTOM_LEFT].height / scale);
x2 = min_x + left_width;
y1 = max_y - bottom_height;
y2 = max_y;
tx1 = tregs[NINE_SLICE_BOTTOM_LEFT].x;
tx2 = tregs[NINE_SLICE_BOTTOM_LEFT].x2;
ty1 = tregs[NINE_SLICE_BOTTOM_LEFT].y;
ty2 = tregs[NINE_SLICE_BOTTOM_LEFT].y2;
tx1 = 0;
tx2 = left_width * scale / texture_width;
ty1 = 0;
ty2 = bottom_height * scale / texture_height;
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
{ { x1, y2 }, { tx1, ty1 }, },
@@ -1972,16 +1987,21 @@ render_outset_shadow_node (GskGLRenderer *self,
}
/* Left side */
if (slice_is_visible (&slices[NINE_SLICE_LEFT_CENTER]))
if (left_width > 0)
{
x1 = min_x;
x2 = min_x + (slices[NINE_SLICE_LEFT_CENTER].width / scale);
y1 = min_y + (slices[NINE_SLICE_TOP_LEFT].height / scale);
y2 = max_y - (slices[NINE_SLICE_BOTTOM_LEFT].height / scale);
tx1 = tregs[NINE_SLICE_LEFT_CENTER].x;
tx2 = tregs[NINE_SLICE_LEFT_CENTER].x2;
ty1 = tregs[NINE_SLICE_LEFT_CENTER].y;
ty2 = tregs[NINE_SLICE_LEFT_CENTER].y2;
x2 = min_x + left_width;
y1 = min_y + top_height;
y2 = y1 + center_height;
tx1 = 0;
tx2 = left_width * scale / texture_width;
ty1 = top_height * scale / texture_height;
ty2 = 1.0 - (bottom_height * scale / texture_height);
g_assert_cmpfloat (x1, <=, x2);
g_assert_cmpfloat (y1, <=, y2);
g_assert_cmpfloat (tx1, <=, tx2);
g_assert_cmpfloat (ty1, <=, ty2);
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
@@ -1995,19 +2015,16 @@ render_outset_shadow_node (GskGLRenderer *self,
}
/* Right side */
if (slice_is_visible (&slices[NINE_SLICE_RIGHT_CENTER]))
if (right_width > 0)
{
x1 = max_x - (slices[NINE_SLICE_RIGHT_CENTER].width / scale);
x1 = max_x - right_width;
x2 = max_x;
y1 = min_y + (slices[NINE_SLICE_TOP_RIGHT].height / scale);
y2 = max_y - (slices[NINE_SLICE_BOTTOM_RIGHT].height / scale);
tx1 = tregs[NINE_SLICE_RIGHT_CENTER].x;
tx2 = tregs[NINE_SLICE_RIGHT_CENTER].x2;
ty1 = tregs[NINE_SLICE_RIGHT_CENTER].y;
ty2 = tregs[NINE_SLICE_RIGHT_CENTER].y2;
y1 = min_y + top_height;
y2 = y1 + center_height;
tx1 = 1 - (right_width * scale / texture_width);
tx2 = 1;
ty1 = top_height * scale / texture_height;
ty2 = 1.0 - (bottom_height * scale / texture_height);
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
{ { x1, y2 }, { tx1, ty1 }, },
@@ -2020,20 +2037,16 @@ render_outset_shadow_node (GskGLRenderer *self,
}
/* Bottom side */
if (slice_is_visible (&slices[NINE_SLICE_BOTTOM_CENTER]))
if (bottom_height > 0)
{
x1 = min_x + (slices[NINE_SLICE_BOTTOM_LEFT].width / scale);
x2 = max_x - (slices[NINE_SLICE_BOTTOM_RIGHT].width / scale);
y1 = max_y - (slices[NINE_SLICE_BOTTOM_CENTER].height / scale);
x1 = min_x + left_width;
x2 = max_x - right_width;
y1 = max_y - bottom_height;
y2 = max_y;
tx1 = tregs[NINE_SLICE_BOTTOM_CENTER].x;
tx2 = tregs[NINE_SLICE_BOTTOM_CENTER].x2;
ty1 = tregs[NINE_SLICE_BOTTOM_CENTER].y;
ty2 = tregs[NINE_SLICE_BOTTOM_CENTER].y2;
tx1 = left_width * scale / texture_width;
tx2 = 1.0 - (right_width * scale / texture_width);
ty1 = 0;
ty2 = bottom_height * scale / texture_height;
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
{ { x1, y2 }, { tx1, ty1 }, },
@@ -2046,19 +2059,16 @@ render_outset_shadow_node (GskGLRenderer *self,
}
/* Middle */
if (slice_is_visible (&slices[NINE_SLICE_CENTER]))
if (center_width > 0 && center_height > 0)
{
x1 = min_x + (slices[NINE_SLICE_LEFT_CENTER].width / scale);
x2 = max_x - (slices[NINE_SLICE_RIGHT_CENTER].width / scale);
y1 = min_y + (slices[NINE_SLICE_TOP_CENTER].height / scale);
y2 = max_y - (slices[NINE_SLICE_BOTTOM_CENTER].height / scale);
tx1 = tregs[NINE_SLICE_CENTER].x;
tx2 = tregs[NINE_SLICE_CENTER].x2;
ty1 = tregs[NINE_SLICE_CENTER].y;
ty2 = tregs[NINE_SLICE_CENTER].y2;
x1 = min_x + left_width;
x2 = max_x - right_width;
y1 = min_y + top_height;
y2 = max_y - bottom_height;
tx1 = left_width * scale / texture_width;
tx2 = 1.0 - (right_width * scale / texture_width);
ty1 = top_height * scale / texture_height;
ty2 = 1.0 - (bottom_height * scale / texture_height);
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
{ { x1, y1 }, { tx1, ty2 }, },
{ { x1, y2 }, { tx1, ty1 }, },
+44 -50
View File
@@ -220,14 +220,14 @@ static inline gboolean
is_primary (const gchar *string)
{
return ((string[0] == '<') &&
(string[1] == 'p' || string[1] == 'P') &&
(string[2] == 'r' || string[2] == 'R') &&
(string[3] == 'i' || string[3] == 'I') &&
(string[4] == 'm' || string[4] == 'M') &&
(string[5] == 'a' || string[5] == 'A') &&
(string[6] == 'r' || string[6] == 'R') &&
(string[7] == 'y' || string[7] == 'Y') &&
(string[8] == '>'));
(string[1] == 'p' || string[1] == 'P') &&
(string[2] == 'r' || string[2] == 'R') &&
(string[3] == 'i' || string[3] == 'I') &&
(string[4] == 'm' || string[4] == 'M') &&
(string[5] == 'a' || string[5] == 'A') &&
(string[6] == 'r' || string[6] == 'R') &&
(string[7] == 'y' || string[7] == 'Y') &&
(string[8] == '>'));
}
static inline gboolean
@@ -411,15 +411,15 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator,
goto out;
}
}
else
{
keyval = gdk_keyval_from_name (accelerator);
if (keyval == GDK_KEY_VoidSymbol)
{
error = TRUE;
goto out;
}
}
else
{
keyval = gdk_keyval_from_name (accelerator);
if (keyval == GDK_KEY_VoidSymbol)
{
error = TRUE;
goto out;
}
}
if (keyval && accelerator_codes != NULL)
{
@@ -841,7 +841,7 @@ gtk_accelerator_print_label (GString *gstring,
g_string_append (gstring, C_("keyboard label", "Shift"));
#else
/* U+21E7 UPWARDS WHITE ARROW */
g_string_append (gstring, "");
g_string_append (gstring, "\xe2\x87\xa7");
#endif
seen_mod = TRUE;
}
@@ -860,7 +860,7 @@ gtk_accelerator_print_label (GString *gstring,
g_string_append (gstring, C_("keyboard label", "Ctrl"));
#else
/* U+2303 UP ARROWHEAD */
g_string_append (gstring, "");
g_string_append (gstring, "\xe2\x8c\x83");
#endif
seen_mod = TRUE;
}
@@ -879,7 +879,7 @@ gtk_accelerator_print_label (GString *gstring,
g_string_append (gstring, C_("keyboard label", "Alt"));
#else
/* U+2325 OPTION KEY */
g_string_append (gstring, "");
g_string_append (gstring, "\xe2\x8c\xa5");
#endif
seen_mod = TRUE;
}
@@ -925,7 +925,8 @@ gtk_accelerator_print_label (GString *gstring,
*/
g_string_append (gstring, C_("keyboard label", "Meta"));
#else
g_string_append (gstring, "");
/* Command key symbol U+2318 PLACE OF INTEREST SIGN */
g_string_append (gstring, "\xe2\x8c\x98");
#endif
seen_mod = TRUE;
}
@@ -936,25 +937,18 @@ gtk_accelerator_print_label (GString *gstring,
if (seen_mod)
append_separator (gstring);
if (accelerator_key >= GDK_KEY_KP_Space &&
accelerator_key <= GDK_KEY_KP_Equal)
{
g_string_append (gstring, C_("keyboard label", "KP"));
g_string_append (gstring, "");
}
switch (ch)
{
case ' ':
g_string_append (gstring, C_("keyboard label", "Space"));
break;
case '\\':
g_string_append (gstring, C_("keyboard label", "Backslash"));
break;
default:
g_string_append_unichar (gstring, g_unichar_toupper (ch));
break;
}
{
case ' ':
g_string_append (gstring, C_("keyboard label", "Space"));
break;
case '\\':
g_string_append (gstring, C_("keyboard label", "Backslash"));
break;
default:
g_string_append_unichar (gstring, g_unichar_toupper (ch));
break;
}
}
else if (!append_keyval_symbol (accelerator_key, gstring))
{
@@ -962,22 +956,22 @@ gtk_accelerator_print_label (GString *gstring,
tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key));
if (tmp != NULL)
{
{
if (seen_mod)
append_separator (gstring);
if (tmp[0] != 0 && tmp[1] == 0)
g_string_append_c (gstring, g_ascii_toupper (tmp[0]));
else
{
const char *str;
if (tmp[0] != 0 && tmp[1] == 0)
g_string_append_c (gstring, g_ascii_toupper (tmp[0]));
else
{
const char *str;
str = g_dpgettext2 (GETTEXT_PACKAGE, "keyboard label", tmp);
if (str == tmp)
if (str == tmp)
append_without_underscores (gstring, tmp);
else
g_string_append (gstring, str);
}
}
else
g_string_append (gstring, str);
}
}
}
}
+3 -4
View File
@@ -58,8 +58,7 @@
*
* # CSS nodes
*
* GtkAssistant has a single CSS node with the name window and style
* class .assistant.
* GtkAssistant has a single CSS node with the name assistant.
*/
#include "config.h"
@@ -631,6 +630,8 @@ gtk_assistant_class_init (GtkAssistantClass *class)
gtk_widget_class_bind_template_callback (widget_class, on_assistant_back);
gtk_widget_class_bind_template_callback (widget_class, on_assistant_cancel);
gtk_widget_class_bind_template_callback (widget_class, on_assistant_last);
gtk_widget_class_set_css_name (widget_class, I_("assistant"));
}
static gint
@@ -1139,8 +1140,6 @@ assistant_remove_page (GtkAssistant *assistant,
static void
gtk_assistant_init (GtkAssistant *assistant)
{
gtk_widget_add_css_class (GTK_WIDGET (assistant), "assistant");
assistant->pages = NULL;
assistant->current_page = NULL;
assistant->visited_pages = NULL;
+1 -1
View File
@@ -27,7 +27,7 @@ struct _GtkCssValue {
GTK_CSS_VALUE_BASE
};
static void G_GNUC_NORETURN
static void
gtk_css_value_unset_free (GtkCssValue *value)
{
/* Can only happen if the unique value gets unreffed too often */
+3 -1
View File
@@ -555,6 +555,8 @@ gtk_dialog_class_init (GtkDialogClass *class)
gtk_widget_class_bind_template_child_internal_private (widget_class, GtkDialog, action_area);
gtk_widget_class_bind_template_child_internal_private (widget_class, GtkDialog, content_area);
gtk_widget_class_bind_template_child_private (widget_class, GtkDialog, action_box);
gtk_widget_class_set_css_name (widget_class, I_("dialog"));
}
static void
@@ -562,7 +564,7 @@ gtk_dialog_init (GtkDialog *dialog)
{
GtkDialogPrivate *priv = gtk_dialog_get_instance_private (dialog);
gtk_widget_add_css_class (GTK_WIDGET (dialog), "dialog");
priv = gtk_dialog_get_instance_private (dialog);
priv->use_header_bar = -1;
priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+1 -2
View File
@@ -6535,7 +6535,6 @@ search_engine_hits_added_cb (GtkSearchEngine *engine,
/* Callback used from GtkSearchEngine when the query is done running */
static void
search_engine_finished_cb (GtkSearchEngine *engine,
gboolean got_results,
gpointer data)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (data);
@@ -6549,7 +6548,7 @@ search_engine_finished_cb (GtkSearchEngine *engine,
impl->show_progress_timeout = 0;
}
if (!got_results)
if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (impl->search_model), NULL) == 0)
{
gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_files_stack), "empty");
gtk_widget_grab_focus (impl->search_entry);
-8
View File
@@ -51,7 +51,6 @@ struct _GtkMediaControls
GtkWidget *time_label;
GtkWidget *seek_scale;
GtkWidget *duration_label;
GtkWidget *volume_button;
};
enum
@@ -289,7 +288,6 @@ gtk_media_controls_class_init (GtkMediaControlsClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkMediaControls, time_label);
gtk_widget_class_bind_template_child (widget_class, GtkMediaControls, seek_scale);
gtk_widget_class_bind_template_child (widget_class, GtkMediaControls, duration_label);
gtk_widget_class_bind_template_child (widget_class, GtkMediaControls, volume_button);
gtk_widget_class_bind_template_callback (widget_class, play_button_clicked);
gtk_widget_class_bind_template_callback (widget_class, time_adjustment_changed);
@@ -441,10 +439,6 @@ update_volume (GtkMediaControls *controls)
volume = gtk_media_stream_get_volume (controls->stream);
gtk_adjustment_set_value (controls->volume_adjustment, volume);
gtk_widget_set_sensitive (controls->volume_button,
controls->stream == NULL ||
gtk_media_stream_has_audio (controls->stream));
}
static void
@@ -474,8 +468,6 @@ gtk_media_controls_notify_cb (GtkMediaStream *stream,
update_volume (controls);
else if (g_str_equal (pspec->name, "volume"))
update_volume (controls);
else if (g_str_equal (pspec->name, "has-audio"))
update_volume (controls);
}
/**
+8 -8
View File
@@ -313,7 +313,7 @@ gtk_media_stream_class_init (GtkMediaStreamClass *class)
P_("Error"),
P_("Error the stream is in"),
G_TYPE_ERROR,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* GtkMediaStream:has-audio:
@@ -325,7 +325,7 @@ gtk_media_stream_class_init (GtkMediaStreamClass *class)
P_("Has audio"),
P_("Whether the stream contains audio"),
FALSE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* GtkMediaStream:has-video:
@@ -337,7 +337,7 @@ gtk_media_stream_class_init (GtkMediaStreamClass *class)
P_("Has video"),
P_("Whether the stream contains video"),
FALSE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* GtkMediaStream:playing:
@@ -441,11 +441,11 @@ gtk_media_stream_class_init (GtkMediaStreamClass *class)
* Volume of the audio stream.
*/
properties[PROP_VOLUME] =
g_param_spec_double ("volume",
P_("Volume"),
P_("Volume of the audio stream."),
0.0, 1.0, 1.0,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_param_spec_boolean ("volume",
P_("Volume"),
P_("Volume of the audio stream."),
1.0,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
+2 -2
View File
@@ -253,6 +253,8 @@ gtk_message_dialog_class_init (GtkMessageDialogClass *class)
gtk_widget_class_bind_template_child_private (widget_class, GtkMessageDialog, label);
gtk_widget_class_bind_template_child_private (widget_class, GtkMessageDialog, secondary_label);
gtk_widget_class_bind_template_child_internal_private (widget_class, GtkMessageDialog, message_area);
gtk_widget_class_set_css_name (widget_class, I_("messagedialog"));
}
static void
@@ -269,8 +271,6 @@ gtk_message_dialog_init (GtkMessageDialog *dialog)
priv->has_secondary_text = FALSE;
priv->message_type = GTK_MESSAGE_OTHER;
gtk_widget_add_css_class (GTK_WIDGET (dialog), "message");
gtk_widget_init_template (GTK_WIDGET (dialog));
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
gtk_widget_set_halign (action_area, GTK_ALIGN_FILL);
+2 -2
View File
@@ -248,8 +248,8 @@ gtk_printer_option_allocate_choices (GtkPrinterOption *option,
void
gtk_printer_option_choices_from_array (GtkPrinterOption *option,
int num_choices,
const char **choices,
const char **choices_display)
char *choices[],
char *choices_display[])
{
int i;
+6 -6
View File
@@ -20,7 +20,7 @@
#define __GTK_PRINTER_OPTION_H__
/* This is a "semi-private" header; it is meant only for
* alternate GtkPrintDialog backend modules; no stability guarantees
* alternate GtkPrintDialog backend modules; no stability guarantees
* are made at this point
*/
#ifndef GTK_PRINT_BACKEND_ENABLE_UNSUPPORTED
@@ -64,11 +64,11 @@ struct _GtkPrinterOption
GtkPrinterOptionType type;
char *value;
int num_choices;
char **choices;
char **choices_display;
gboolean activates_default;
gboolean has_conflict;
@@ -111,9 +111,9 @@ void gtk_printer_option_allocate_choices (GtkPrinterOption
int num);
GDK_AVAILABLE_IN_ALL
void gtk_printer_option_choices_from_array (GtkPrinterOption *option,
int num_choices,
const char **choices,
const char **choices_display);
int num_choices,
char *choices[],
char *choices_display[]);
GDK_AVAILABLE_IN_ALL
gboolean gtk_printer_option_has_choice (GtkPrinterOption *option,
const char *choice);
+2 -2
View File
@@ -1746,9 +1746,9 @@ coord_to_value (GtkRange *range,
else
{
if (priv->slider_size_fixed)
frac = CLAMP (coord / (double) trough_length, 0, 1);
frac = MAX (0, coord) / (double) (trough_length);
else
frac = CLAMP (coord / (double) (trough_length - slider_length), 0, 1);
frac = MAX (0, coord) / (double) (trough_length - slider_length);
}
if (should_invert (range))
+10 -15
View File
@@ -21,20 +21,20 @@
#include "config.h"
#include "gtksearchengine.h"
#include "gtksearchenginetracker.h"
#include "gtksearchenginemodel.h"
#include "gtksearchenginequartz.h"
#include "gtkintl.h"
#include <gdk/gdk.h> /* for GDK_WINDOWING_QUARTZ */
#if defined(HAVE_TRACKER3)
#include "gtksearchenginetracker3.h"
#ifndef G_OS_WIN32 /* No tracker on Windows */
#define HAVE_TRACKER 1
#endif
struct _GtkSearchEnginePrivate {
GtkSearchEngine *native;
gboolean native_running;
gboolean got_results;
gchar *native_error;
GtkSearchEngine *model;
@@ -161,7 +161,7 @@ _gtk_search_engine_class_init (GtkSearchEngineClass *class)
G_STRUCT_OFFSET (GtkSearchEngineClass, finished),
NULL, NULL,
NULL,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
G_TYPE_NONE, 0);
signals[ERROR] =
g_signal_new (I_("error"),
@@ -230,16 +230,13 @@ update_status (GtkSearchEngine *engine)
else if (engine->priv->model_error)
_gtk_search_engine_error (engine, engine->priv->model_error);
else
_gtk_search_engine_finished (engine, engine->priv->got_results);
engine->priv->got_results = FALSE;
_gtk_search_engine_finished (engine);
}
}
}
static void
finished (GtkSearchEngine *engine,
gboolean got_results,
gpointer data)
{
GtkSearchEngine *composite = GTK_SEARCH_ENGINE (data);
@@ -249,7 +246,6 @@ finished (GtkSearchEngine *engine,
else if (engine == composite->priv->model)
composite->priv->model_running = FALSE;
composite->priv->got_results |= got_results;
update_status (composite);
}
@@ -333,11 +329,11 @@ _gtk_search_engine_new (void)
engine = g_object_new (GTK_TYPE_SEARCH_ENGINE, NULL);
#if defined(HAVE_TRACKER3)
engine->priv->native = gtk_search_engine_tracker3_new ();
#ifdef HAVE_TRACKER
engine->priv->native = _gtk_search_engine_tracker_new ();
if (engine->priv->native)
{
g_debug ("Using Tracker3 search engine");
g_debug ("Using Tracker search engine");
connect_engine_signals (engine->priv->native, engine);
}
#endif
@@ -395,12 +391,11 @@ _gtk_search_engine_hits_added (GtkSearchEngine *engine,
}
void
_gtk_search_engine_finished (GtkSearchEngine *engine,
gboolean got_results)
_gtk_search_engine_finished (GtkSearchEngine *engine)
{
g_return_if_fail (GTK_IS_SEARCH_ENGINE (engine));
g_signal_emit (engine, signals[FINISHED], 0, got_results);
g_signal_emit (engine, signals[FINISHED], 0);
}
void
+1 -4
View File
@@ -40,8 +40,6 @@ typedef struct _GtkSearchEngineClass GtkSearchEngineClass;
typedef struct _GtkSearchEnginePrivate GtkSearchEnginePrivate;
typedef struct _GtkSearchHit GtkSearchHit;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkSearchEngine, g_object_unref)
struct _GtkSearchHit
{
GFile *file;
@@ -84,8 +82,7 @@ void _gtk_search_engine_stop (GtkSearchEngine *engine);
void _gtk_search_engine_hits_added (GtkSearchEngine *engine,
GList *hits);
void _gtk_search_engine_finished (GtkSearchEngine *engine,
gboolean got_results);
void _gtk_search_engine_finished (GtkSearchEngine *engine);
void _gtk_search_engine_error (GtkSearchEngine *engine,
const gchar *error_message);
void _gtk_search_engine_set_recursive (GtkSearchEngine *engine,
+1 -1
View File
@@ -124,7 +124,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (GtkSearchEngineQuartz, _gtk_search_engine_quartz, GT
[self submitHits:ns_query];
_gtk_search_engine_finished (engine, submitted_hits > 0);
_gtk_search_engine_finished (engine);
submitted_hits = 0;
}
+584
View File
@@ -0,0 +1,584 @@
/*
* Copyright (C) 2009-2011 Nokia <ivan.frade@nokia.com>
*
* 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/>.
*
* Authors: Jürg Billeter <juerg.billeter@codethink.co.uk>
* Martyn Russell <martyn@lanedo.com>
*
* Based on nautilus-search-engine-tracker.c
*/
#include "config.h"
#include <string.h>
#include <gio/gio.h>
#include <gmodule.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include "gtksearchenginetracker.h"
#define DBUS_SERVICE_RESOURCES "org.freedesktop.Tracker1"
#define DBUS_PATH_RESOURCES "/org/freedesktop/Tracker1/Resources"
#define DBUS_INTERFACE_RESOURCES "org.freedesktop.Tracker1.Resources"
#define DBUS_SERVICE_STATUS "org.freedesktop.Tracker1"
#define DBUS_PATH_STATUS "/org/freedesktop/Tracker1/Status"
#define DBUS_INTERFACE_STATUS "org.freedesktop.Tracker1.Status"
/* Time in second to wait for service before deciding it's not available */
#define WAIT_TIMEOUT_SECONDS 1
/* Time in second to wait for query results to come back */
#define QUERY_TIMEOUT_SECONDS 10
/* If defined, we use fts:match, this has to be enabled in Tracker to
* work which it usually is. The alternative is to undefine it and
* use filename matching instead. This doesnt use the content of the
* file however.
*/
#define FTS_MATCHING
struct _GtkSearchEngineTracker
{
GtkSearchEngine parent;
GDBusConnection *connection;
GCancellable *cancellable;
GtkQuery *query;
gboolean query_pending;
GPtrArray *indexed_locations;
};
struct _GtkSearchEngineTrackerClass
{
GtkSearchEngineClass parent_class;
};
G_DEFINE_TYPE (GtkSearchEngineTracker, _gtk_search_engine_tracker, GTK_TYPE_SEARCH_ENGINE)
static void
finalize (GObject *object)
{
GtkSearchEngineTracker *tracker;
g_debug ("Finalizing GtkSearchEngineTracker");
tracker = GTK_SEARCH_ENGINE_TRACKER (object);
if (tracker->cancellable)
{
g_cancellable_cancel (tracker->cancellable);
g_object_unref (tracker->cancellable);
}
g_clear_object (&tracker->query);
g_clear_object (&tracker->connection);
g_ptr_array_unref (tracker->indexed_locations);
G_OBJECT_CLASS (_gtk_search_engine_tracker_parent_class)->finalize (object);
}
static GDBusConnection *
get_connection (void)
{
GDBusConnection *connection;
GError *error = NULL;
GVariant *reply;
/* Normally I hate sync calls with UIs, but we need to return NULL
* or a GtkSearchEngine as a result of this function.
*/
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (error)
{
g_debug ("Couldn't connect to D-Bus session bus, %s", error->message);
g_error_free (error);
return NULL;
}
/* If connection is set, we know it worked. */
g_debug ("Finding out if Tracker is available via D-Bus...");
/* We only wait 1 second max, we expect it to be very fast. If we
* don't get a response by then, clearly we're replaying a journal
* or cleaning up the DB internally. Either way, services is not
* available.
*
* We use the sync call here because we don't expect to be waiting
* long enough to block UI painting.
*/
reply = g_dbus_connection_call_sync (connection,
DBUS_SERVICE_STATUS,
DBUS_PATH_STATUS,
DBUS_INTERFACE_STATUS,
"Wait",
NULL,
NULL,
G_DBUS_CALL_FLAGS_NONE,
WAIT_TIMEOUT_SECONDS * 1000,
NULL,
&error);
if (error)
{
g_debug ("Tracker is not available, %s", error->message);
g_error_free (error);
g_object_unref (connection);
return NULL;
}
g_variant_unref (reply);
g_debug ("Tracker is ready");
return connection;
}
static void
get_query_results (GtkSearchEngineTracker *engine,
const gchar *sparql,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_dbus_connection_call (engine->connection,
DBUS_SERVICE_RESOURCES,
DBUS_PATH_RESOURCES,
DBUS_INTERFACE_RESOURCES,
"SparqlQuery",
g_variant_new ("(s)", sparql),
NULL,
G_DBUS_CALL_FLAGS_NONE,
QUERY_TIMEOUT_SECONDS * 1000,
engine->cancellable,
callback,
user_data);
}
/* Stolen from libtracker-sparql */
static gchar *
sparql_escape_string (const gchar *literal)
{
GString *str;
const gchar *p;
g_return_val_if_fail (literal != NULL, NULL);
str = g_string_new ("");
p = literal;
while (TRUE)
{
gsize len;
if (!((*p) != '\0'))
break;
len = strcspn ((const gchar *) p, "\t\n\r\b\f\"\\");
g_string_append_len (str, (const gchar *) p, (gssize) ((glong) len));
p = p + len;
switch (*p)
{
case '\t':
g_string_append (str, "\\t");
break;
case '\n':
g_string_append (str, "\\n");
break;
case '\r':
g_string_append (str, "\\r");
break;
case '\b':
g_string_append (str, "\\b");
break;
case '\f':
g_string_append (str, "\\f");
break;
case '"':
g_string_append (str, "\\\"");
break;
case '\\':
g_string_append (str, "\\\\");
break;
default:
continue;
}
p++;
}
return g_string_free (str, FALSE);
}
static void
sparql_append_string_literal (GString *sparql,
const gchar *str,
gboolean glob,
gboolean is_dir_uri,
gboolean quoted)
{
gchar *s;
s = sparql_escape_string (str);
g_string_append_c (sparql, '"');
if (quoted)
g_string_append (sparql, "\\\"");
g_string_append (sparql, s);
if (is_dir_uri)
g_string_append_c (sparql, '/');
if (quoted)
g_string_append (sparql, "\\\"");
if (glob)
g_string_append_c (sparql, '*');
g_string_append_c (sparql, '"');
g_free (s);
}
static void
sparql_append_string_literal_lower_case (GString *sparql,
const gchar *str)
{
gchar *s;
s = g_utf8_strdown (str, -1);
sparql_append_string_literal (sparql, s, FALSE, FALSE, FALSE);
g_free (s);
}
static void
query_callback (GObject *object,
GAsyncResult *res,
gpointer user_data)
{
GtkSearchEngineTracker *tracker;
GList *hits;
GVariant *reply;
GVariant *r;
GVariantIter iter;
GError *error = NULL;
gint i, n;
GtkSearchHit *hit;
tracker = GTK_SEARCH_ENGINE_TRACKER (user_data);
tracker->query_pending = FALSE;
reply = g_dbus_connection_call_finish (tracker->connection, res, &error);
if (error)
{
_gtk_search_engine_error (GTK_SEARCH_ENGINE (tracker), error->message);
g_error_free (error);
g_object_unref (tracker);
return;
}
if (!reply)
{
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (tracker));
g_object_unref (tracker);
return;
}
r = g_variant_get_child_value (reply, 0);
g_variant_iter_init (&iter, r);
n = g_variant_iter_n_children (&iter);
hit = g_new (GtkSearchHit, n);
hits = NULL;
for (i = 0; i < n; i++)
{
GVariant *v;
const gchar **strv;
v = g_variant_iter_next_value (&iter);
strv = g_variant_get_strv (v, NULL);
hit[i].file = g_file_new_for_uri (strv[0]);
hit[i].info = NULL;
g_free (strv);
hits = g_list_prepend (hits, &hit[i]);
}
_gtk_search_engine_hits_added (GTK_SEARCH_ENGINE (tracker), hits);
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (tracker));
g_list_free (hits);
for (i = 0; i < n; i++)
g_object_unref (hit[i].file);
g_free (hit);
g_variant_unref (reply);
g_variant_unref (r);
g_object_unref (tracker);
}
static void
gtk_search_engine_tracker_start (GtkSearchEngine *engine)
{
GtkSearchEngineTracker *tracker;
const gchar *search_text;
GFile *location;
GString *sparql;
gboolean recursive;
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
if (tracker->query_pending)
{
g_debug ("Attempt to start a new search while one is pending, doing nothing");
return;
}
if (tracker->query == NULL)
{
g_debug ("Attempt to start a new search with no GtkQuery, doing nothing");
return;
}
search_text = gtk_query_get_text (tracker->query);
location = gtk_query_get_location (tracker->query);
recursive = _gtk_search_engine_get_recursive (engine);
sparql = g_string_new ("SELECT nie:url(?urn) "
"WHERE {"
" ?urn a nfo:FileDataObject ;"
" tracker:available true ; "
" nfo:belongsToContainer ?parent; ");
#ifdef FTS_MATCHING
/* Using FTS: */
g_string_append (sparql, "fts:match ");
sparql_append_string_literal (sparql, search_text, TRUE, FALSE, TRUE);
#endif
g_string_append (sparql, ". FILTER (BOUND(nie:url(?urn)) && ");
g_string_append (sparql, "fn:contains(fn:lower-case(nfo:fileName(?urn)),");
sparql_append_string_literal_lower_case (sparql, search_text);
g_string_append (sparql, ")");
if (location)
{
gchar *location_uri = g_file_get_uri (location);
g_string_append (sparql, " && ");
if (recursive)
{
g_string_append (sparql, "fn:starts-with(nie:url(?urn),");
sparql_append_string_literal (sparql, location_uri, FALSE, TRUE, FALSE);
g_string_append (sparql, ")");
}
else
{
g_string_append (sparql, "nie:url(?parent) = ");
sparql_append_string_literal (sparql, location_uri, FALSE, FALSE, FALSE);
}
g_free (location_uri);
}
g_string_append (sparql, ")");
#ifdef FTS_MATCHING
g_string_append (sparql, " } ORDER BY DESC(fts:rank(?urn)) DESC(nie:url(?urn))");
#else /* FTS_MATCHING */
g_string_append (sparql, "} ORDER BY DESC(nie:url(?urn)) DESC(nfo:fileName(?urn))");
#endif /* FTS_MATCHING */
tracker->query_pending = TRUE;
g_debug ("SearchEngineTracker: query: %s", sparql->str);
get_query_results (tracker, sparql->str, query_callback, g_object_ref (tracker));
g_string_free (sparql, TRUE);
}
static void
gtk_search_engine_tracker_stop (GtkSearchEngine *engine)
{
GtkSearchEngineTracker *tracker;
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
if (tracker->query && tracker->query_pending)
{
g_cancellable_cancel (tracker->cancellable);
tracker->query_pending = FALSE;
}
}
static void
gtk_search_engine_tracker_set_query (GtkSearchEngine *engine,
GtkQuery *query)
{
GtkSearchEngineTracker *tracker;
tracker = GTK_SEARCH_ENGINE_TRACKER (engine);
if (query)
g_object_ref (query);
if (tracker->query)
g_object_unref (tracker->query);
tracker->query = query;
}
static void
_gtk_search_engine_tracker_class_init (GtkSearchEngineTrackerClass *class)
{
GObjectClass *gobject_class;
GtkSearchEngineClass *engine_class;
gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = finalize;
engine_class = GTK_SEARCH_ENGINE_CLASS (class);
engine_class->set_query = gtk_search_engine_tracker_set_query;
engine_class->start = gtk_search_engine_tracker_start;
engine_class->stop = gtk_search_engine_tracker_stop;
}
static void get_indexed_locations (GtkSearchEngineTracker *engine);
static void
_gtk_search_engine_tracker_init (GtkSearchEngineTracker *engine)
{
engine->cancellable = g_cancellable_new ();
engine->query_pending = FALSE;
engine->indexed_locations = g_ptr_array_new_with_free_func (g_object_unref);
get_indexed_locations (engine);
}
GtkSearchEngine *
_gtk_search_engine_tracker_new (void)
{
GtkSearchEngineTracker *engine;
GDBusConnection *connection;
g_debug ("--");
connection = get_connection ();
if (!connection)
return NULL;
g_debug ("Creating GtkSearchEngineTracker...");
engine = g_object_new (GTK_TYPE_SEARCH_ENGINE_TRACKER, NULL);
engine->connection = connection;
return GTK_SEARCH_ENGINE (engine);
}
#define TRACKER_SCHEMA "org.freedesktop.Tracker.Miner.Files"
#define TRACKER_KEY_RECURSIVE_DIRECTORIES "index-recursive-directories"
static const gchar *
get_user_special_dir_if_not_home (GUserDirectory idx)
{
const gchar *path;
path = g_get_user_special_dir (idx);
if (g_strcmp0 (path, g_get_home_dir ()) == 0)
return NULL;
return path;
}
static const gchar *
path_from_tracker_dir (const gchar *value)
{
const gchar *path;
if (g_strcmp0 (value, "&DESKTOP") == 0)
path = get_user_special_dir_if_not_home (G_USER_DIRECTORY_DESKTOP);
else if (g_strcmp0 (value, "&DOCUMENTS") == 0)
path = get_user_special_dir_if_not_home (G_USER_DIRECTORY_DOCUMENTS);
else if (g_strcmp0 (value, "&DOWNLOAD") == 0)
path = get_user_special_dir_if_not_home (G_USER_DIRECTORY_DOWNLOAD);
else if (g_strcmp0 (value, "&MUSIC") == 0)
path = get_user_special_dir_if_not_home (G_USER_DIRECTORY_MUSIC);
else if (g_strcmp0 (value, "&PICTURES") == 0)
path = get_user_special_dir_if_not_home (G_USER_DIRECTORY_PICTURES);
else if (g_strcmp0 (value, "&PUBLIC_SHARE") == 0)
path = get_user_special_dir_if_not_home (G_USER_DIRECTORY_PUBLIC_SHARE);
else if (g_strcmp0 (value, "&TEMPLATES") == 0)
path = get_user_special_dir_if_not_home (G_USER_DIRECTORY_TEMPLATES);
else if (g_strcmp0 (value, "&VIDEOS") == 0)
path = get_user_special_dir_if_not_home (G_USER_DIRECTORY_VIDEOS);
else if (g_strcmp0 (value, "$HOME") == 0)
path = g_get_home_dir ();
else
path = value;
return path;
}
static void
get_indexed_locations (GtkSearchEngineTracker *engine)
{
GSettingsSchemaSource *source;
GSettingsSchema *schema;
GSettings *settings;
gchar **locations;
gint i;
GFile *location;
const gchar *path;
source = g_settings_schema_source_get_default ();
schema = g_settings_schema_source_lookup (source, TRACKER_SCHEMA, FALSE);
if (!schema)
return;
settings = g_settings_new_full (schema, NULL, NULL);
g_settings_schema_unref (schema);
locations = g_settings_get_strv (settings, TRACKER_KEY_RECURSIVE_DIRECTORIES);
for (i = 0; locations[i] != NULL; i++)
{
path = path_from_tracker_dir (locations[i]);
if (path == NULL)
continue;
location = g_file_new_for_path (path);
g_ptr_array_add (engine->indexed_locations, location);
}
g_strfreev (locations);
g_object_unref (settings);
}
gboolean
_gtk_search_engine_tracker_is_indexed (GFile *location,
gpointer data)
{
GtkSearchEngineTracker *engine = data;
gint i;
GFile *place;
for (i = 0; i < engine->indexed_locations->len; i++)
{
place = g_ptr_array_index (engine->indexed_locations, i);
if (g_file_equal (location, place) || g_file_has_prefix (location, place))
return TRUE;
}
return FALSE;
}
+47
View File
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2005 Mr Jamie McCracken
*
* 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/>.
*
* Author: Jamie McCracken (jamiemcc@gnome.org)
*
* Based on nautilus-search-engine-tracker.h
*/
#ifndef __GTK_SEARCH_ENGINE_TRACKER_H__
#define __GTK_SEARCH_ENGINE_TRACKER_H__
#include "gtksearchengine.h"
G_BEGIN_DECLS
#define GTK_TYPE_SEARCH_ENGINE_TRACKER (_gtk_search_engine_tracker_get_type ())
#define GTK_SEARCH_ENGINE_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SEARCH_ENGINE_TRACKER, GtkSearchEngineTracker))
#define GTK_SEARCH_ENGINE_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SEARCH_ENGINE_TRACKER, GtkSearchEngineTrackerClass))
#define GTK_IS_SEARCH_ENGINE_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SEARCH_ENGINE_TRACKER))
#define GTK_IS_SEARCH_ENGINE_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SEARCH_ENGINE_TRACKER))
#define GTK_SEARCH_ENGINE_TRACKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SEARCH_ENGINE_TRACKER, GtkSearchEngineTrackerClass))
typedef struct _GtkSearchEngineTracker GtkSearchEngineTracker;
typedef struct _GtkSearchEngineTrackerClass GtkSearchEngineTrackerClass;
GType _gtk_search_engine_tracker_get_type (void);
GtkSearchEngine* _gtk_search_engine_tracker_new (void);
gboolean _gtk_search_engine_tracker_is_indexed (GFile *file,
gpointer data);
G_END_DECLS
#endif /* __GTK_SEARCH_ENGINE_TRACKER_H__ */
-373
View File
@@ -1,373 +0,0 @@
/*
* Copyright (C) 2020 Red Hat Inc
* Copyright (C) 2009-2011 Nokia <ivan.frade@nokia.com>
*
* 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/>.
*
* Authors: Carlos Garnacho <carlosg@gnome.org>
* Jürg Billeter <juerg.billeter@codethink.co.uk>
* Martyn Russell <martyn@lanedo.com>
*
* Based on nautilus-search-engine-tracker.c
*/
#include "config.h"
#include <string.h>
#include <gio/gio.h>
#include <gmodule.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <libtracker-sparql/tracker-sparql.h>
#include "gtksearchenginetracker3.h"
#define MINER_FS_BUS_NAME "org.freedesktop.Tracker3.Miner.Files"
#define SEARCH_QUERY_BASE(__PATTERN__) \
"SELECT ?url " \
" nfo:fileName(?urn) " \
" nie:mimeType(?urn)" \
" nfo:fileSize(?urn)" \
" nfo:fileLastModified(?urn)" \
"FROM tracker:FileSystem " \
"WHERE {" \
" ?urn a nfo:FileDataObject ;" \
" nie:url ?url ; " \
" fts:match ~match . " \
__PATTERN__ \
"} " \
"ORDER BY DESC(fts:rank(?urn)) DESC(?url)"
#define SEARCH_QUERY SEARCH_QUERY_BASE("")
#define SEARCH_RECURSIVE_QUERY SEARCH_QUERY_BASE("?urn (nfo:belongsToContainer/nie:isStoredAs)+/nie:url ~location")
#define SEARCH_LOCATION_QUERY SEARCH_QUERY_BASE("?urn nfo:belongsToContainer/nie:isStoredAs/nie:url ~location")
struct _GtkSearchEngineTracker3
{
GtkSearchEngine parent;
TrackerSparqlConnection *sparql_conn;
TrackerSparqlStatement *search_query;
TrackerSparqlStatement *search_recursive_query;
TrackerSparqlStatement *search_location_query;
GCancellable *cancellable;
GtkQuery *query;
gboolean query_pending;
};
struct _GtkSearchEngineTracker3Class
{
GtkSearchEngineClass parent_class;
};
static void gtk_search_engine_tracker3_initable_iface_init (GInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkSearchEngineTracker3,
gtk_search_engine_tracker3,
GTK_TYPE_SEARCH_ENGINE,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
gtk_search_engine_tracker3_initable_iface_init))
static void
finalize (GObject *object)
{
GtkSearchEngineTracker3 *engine;
g_debug ("Finalizing GtkSearchEngineTracker3");
engine = GTK_SEARCH_ENGINE_TRACKER3 (object);
if (engine->cancellable)
{
g_cancellable_cancel (engine->cancellable);
g_object_unref (engine->cancellable);
}
g_clear_object (&engine->search_query);
g_clear_object (&engine->search_location_query);
tracker_sparql_connection_close (engine->sparql_conn);
g_clear_object (&engine->sparql_conn);
G_OBJECT_CLASS (gtk_search_engine_tracker3_parent_class)->finalize (object);
}
static void
free_hit (gpointer data)
{
GtkSearchHit *hit = data;
g_clear_object (&hit->file);
g_clear_object (&hit->info);
g_slice_free (GtkSearchHit, hit);
}
static GFileInfo *
create_file_info (TrackerSparqlCursor *cursor)
{
GFileInfo *info;
const gchar *str;
GDateTime *creation;
info = g_file_info_new ();
str = tracker_sparql_cursor_get_string (cursor, 1, NULL);
if (str)
g_file_info_set_display_name (info, str);
str = tracker_sparql_cursor_get_string (cursor, 2, NULL);
if (str)
g_file_info_set_content_type (info, str);
g_file_info_set_size (info,
tracker_sparql_cursor_get_integer (cursor, 3));
str = tracker_sparql_cursor_get_string (cursor, 4, NULL);
if (str)
{
creation = g_date_time_new_from_iso8601 (str, NULL);
g_file_info_set_modification_date_time (info, creation);
g_date_time_unref (creation);
}
return info;
}
static void
query_callback (TrackerSparqlStatement *statement,
GAsyncResult *res,
gpointer user_data)
{
GtkSearchEngineTracker3 *engine;
TrackerSparqlCursor *cursor;
GList *hits = NULL;
GError *error = NULL;
GtkSearchHit *hit;
engine = GTK_SEARCH_ENGINE_TRACKER3 (user_data);
engine->query_pending = FALSE;
cursor = tracker_sparql_statement_execute_finish (statement, res, &error);
if (!cursor)
{
_gtk_search_engine_error (GTK_SEARCH_ENGINE (engine), error->message);
g_error_free (error);
g_object_unref (engine);
return;
}
while (tracker_sparql_cursor_next (cursor, NULL, NULL))
{
const gchar *url;
url = tracker_sparql_cursor_get_string (cursor, 0, NULL);
hit = g_slice_new0 (GtkSearchHit);
hit->file = g_file_new_for_uri (url);
hit->info = create_file_info (cursor);
hits = g_list_prepend (hits, hit);
}
tracker_sparql_cursor_close (cursor);
_gtk_search_engine_hits_added (GTK_SEARCH_ENGINE (engine), hits);
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (engine), hits != NULL);
g_list_free_full (hits, free_hit);
g_object_unref (engine);
g_object_unref (cursor);
}
static void
gtk_search_engine_tracker3_start (GtkSearchEngine *engine)
{
GtkSearchEngineTracker3 *tracker;
TrackerSparqlStatement *statement;
const gchar *search_text;
gboolean recursive;
gchar *match;
GFile *location;
tracker = GTK_SEARCH_ENGINE_TRACKER3 (engine);
if (tracker->query_pending)
{
g_debug ("Attempt to start a new search while one is pending, doing nothing");
return;
}
if (tracker->query == NULL)
{
g_debug ("Attempt to start a new search with no GtkQuery, doing nothing");
return;
}
tracker->query_pending = TRUE;
search_text = gtk_query_get_text (tracker->query);
location = gtk_query_get_location (tracker->query);
recursive = _gtk_search_engine_get_recursive (engine);
if (location)
{
gchar *location_uri = g_file_get_uri (location);
if (recursive)
{
g_debug ("Recursive search query in location: %s", location_uri);
statement = tracker->search_recursive_query;
}
else
{
g_debug ("Search query in location: %s", location_uri);
statement = tracker->search_location_query;
}
tracker_sparql_statement_bind_string (statement,
"location",
location_uri);
g_free (location_uri);
}
else
{
g_debug ("Search query");
statement = tracker->search_query;
}
match = g_strdup_printf ("%s*", search_text);
tracker_sparql_statement_bind_string (statement, "match", match);
g_debug ("search text: %s\n", match);
tracker_sparql_statement_execute_async (statement, tracker->cancellable,
(GAsyncReadyCallback) query_callback,
g_object_ref (tracker));
g_free (match);
}
static void
gtk_search_engine_tracker3_stop (GtkSearchEngine *engine)
{
GtkSearchEngineTracker3 *tracker;
tracker = GTK_SEARCH_ENGINE_TRACKER3 (engine);
if (tracker->query && tracker->query_pending)
{
g_cancellable_cancel (tracker->cancellable);
tracker->query_pending = FALSE;
}
}
static void
gtk_search_engine_tracker3_set_query (GtkSearchEngine *engine,
GtkQuery *query)
{
GtkSearchEngineTracker3 *tracker;
tracker = GTK_SEARCH_ENGINE_TRACKER3 (engine);
if (query)
g_object_ref (query);
if (tracker->query)
g_object_unref (tracker->query);
tracker->query = query;
}
static void
gtk_search_engine_tracker3_class_init (GtkSearchEngineTracker3Class *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkSearchEngineClass *engine_class = GTK_SEARCH_ENGINE_CLASS (class);
gobject_class->finalize = finalize;
engine_class->set_query = gtk_search_engine_tracker3_set_query;
engine_class->start = gtk_search_engine_tracker3_start;
engine_class->stop = gtk_search_engine_tracker3_stop;
}
static void
gtk_search_engine_tracker3_init (GtkSearchEngineTracker3 *engine)
{
engine->cancellable = g_cancellable_new ();
engine->query_pending = FALSE;
}
static gboolean
gtk_search_engine_tracker3_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
GtkSearchEngineTracker3 *engine;
engine = GTK_SEARCH_ENGINE_TRACKER3 (initable);
engine->sparql_conn = tracker_sparql_connection_bus_new (MINER_FS_BUS_NAME,
NULL, NULL,
error);
if (!engine->sparql_conn)
return FALSE;
engine->search_query =
tracker_sparql_connection_query_statement (engine->sparql_conn,
SEARCH_QUERY,
cancellable,
error);
if (!engine->search_query)
return FALSE;
engine->search_recursive_query =
tracker_sparql_connection_query_statement (engine->sparql_conn,
SEARCH_RECURSIVE_QUERY,
cancellable,
error);
if (!engine->search_recursive_query)
return FALSE;
engine->search_location_query =
tracker_sparql_connection_query_statement (engine->sparql_conn,
SEARCH_LOCATION_QUERY,
cancellable,
error);
if (!engine->search_location_query)
return FALSE;
return TRUE;
}
static void
gtk_search_engine_tracker3_initable_iface_init (GInitableIface *iface)
{
iface->init = gtk_search_engine_tracker3_initable_init;
}
GtkSearchEngine *
gtk_search_engine_tracker3_new (void)
{
GtkSearchEngineTracker3 *engine;
GError *error = NULL;
g_debug ("Creating GtkSearchEngineTracker3...");
engine = g_initable_new (GTK_TYPE_SEARCH_ENGINE_TRACKER3,
NULL, &error, NULL);
if (!engine)
{
g_critical ("Could not init tracker3 search engine: %s",
error->message);
g_error_free (error);
}
return GTK_SEARCH_ENGINE (engine);
}
-41
View File
@@ -1,41 +0,0 @@
/*
* Copyright (C) 2020 Red Hat Inc
* 2005 Mr Jamie McCracken
*
* 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/>.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
* Jamie McCracken (jamiemcc@gnome.org)
*
* Based on nautilus-search-engine-tracker.h
*/
#ifndef __GTK_SEARCH_ENGINE_TRACKER3_H__
#define __GTK_SEARCH_ENGINE_TRACKER3_H__
#include "gtksearchengine.h"
G_BEGIN_DECLS
#define GTK_TYPE_SEARCH_ENGINE_TRACKER3 (gtk_search_engine_tracker3_get_type ())
G_DECLARE_FINAL_TYPE (GtkSearchEngineTracker3,
gtk_search_engine_tracker3,
GTK, SEARCH_ENGINE_TRACKER3,
GtkSearchEngine)
GtkSearchEngine * gtk_search_engine_tracker3_new (void);
G_END_DECLS
#endif /* __GTK_SEARCH_ENGINE_TRACKER3_H__ */
+1 -3
View File
@@ -2944,8 +2944,6 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
text = _gtk_text_get_selected_text (self);
gtk_text_get_pixel_ranges (self, &ranges, &n_ranges);
g_assert (n_ranges > 0);
if (priv->editable)
actions = GDK_ACTION_COPY|GDK_ACTION_MOVE;
else
@@ -2970,7 +2968,7 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
priv->drag = drag;
g_object_unref (drag);
g_free (ranges);
g_free (text);
+4 -7
View File
@@ -919,21 +919,18 @@ _gtk_tooltip_handle_event (GtkWidget *target,
GdkSurface *surface;
double x, y;
double nx, ny;
GtkNative *native;
GtkWidget *native;
if (!tooltips_enabled (event))
return;
native = gtk_widget_get_native (target);
if (!native)
return;
event_type = gdk_event_get_event_type (event);
surface = gdk_event_get_surface (event);
gdk_event_get_position (event, &x, &y);
native = GTK_WIDGET (gtk_widget_get_native (target));
gtk_native_get_surface_transform (native, &nx, &ny);
gtk_widget_translate_coordinates (GTK_WIDGET (native), target, x - nx, y - ny, &x, &y);
gtk_native_get_surface_transform (GTK_NATIVE (native), &nx, &ny);
gtk_widget_translate_coordinates (native, target, x - nx, y - ny, &x, &y);
gtk_tooltip_handle_event_internal (event_type, surface, target, x, y);
}
+14 -55
View File
@@ -24,18 +24,13 @@
#include "gtkmarshalers.h"
#include "gtktrashmonitor.h"
#define UPDATE_RATE_SECONDS 1
struct _GtkTrashMonitor
{
GObject parent;
GFileMonitor *file_monitor;
gulong file_monitor_changed_id;
gboolean pending;
gint timeout_id;
guint has_trash : 1;
};
@@ -75,10 +70,6 @@ gtk_trash_monitor_dispose (GObject *object)
g_clear_object (&monitor->file_monitor);
}
if (monitor->timeout_id > 0)
g_source_remove (monitor->timeout_id);
monitor->timeout_id = 0;
G_OBJECT_CLASS (_gtk_trash_monitor_parent_class)->dispose (object);
}
@@ -93,18 +84,18 @@ _gtk_trash_monitor_class_init (GtkTrashMonitorClass *class)
signals[TRASH_STATE_CHANGED] =
g_signal_new (I_("trash-state-changed"),
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkTrashMonitorClass, trash_state_changed),
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkTrashMonitorClass, trash_state_changed),
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
}
/* Updates the internal has_trash flag and emits the "trash-state-changed" signal */
static void
update_has_trash_and_notify (GtkTrashMonitor *monitor,
gboolean has_trash)
gboolean has_trash)
{
if (monitor->has_trash == !!has_trash)
return;
@@ -145,38 +136,12 @@ trash_query_info_cb (GObject *source,
g_object_unref (monitor); /* was reffed in recompute_trash_state() */
}
static void recompute_trash_state (GtkTrashMonitor *monitor);
static gboolean
recompute_trash_state_cb (gpointer data)
{
GtkTrashMonitor *monitor = data;
monitor->timeout_id = 0;
if (monitor->pending)
{
monitor->pending = FALSE;
recompute_trash_state (monitor);
}
return G_SOURCE_REMOVE;
}
/* Asynchronously recomputes whether there is trash or not */
static void
recompute_trash_state (GtkTrashMonitor *monitor)
{
GFile *file;
/* Rate limit the updates to not flood the gvfsd-trash when too many changes
* happended in a short time.
*/
if (monitor->timeout_id > 0)
{
monitor->pending = TRUE;
return;
}
file = g_file_new_for_uri ("trash:///");
g_file_query_info_async (file,
G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT,
@@ -184,10 +149,6 @@ recompute_trash_state (GtkTrashMonitor *monitor)
G_PRIORITY_DEFAULT, NULL,
trash_query_info_cb, g_object_ref (monitor));
monitor->timeout_id = g_timeout_add_seconds (UPDATE_RATE_SECONDS,
recompute_trash_state_cb,
monitor);
g_object_unref (file);
}
@@ -195,11 +156,11 @@ recompute_trash_state (GtkTrashMonitor *monitor)
* whenever something happens.
*/
static void
file_monitor_changed_cb (GFileMonitor *file_monitor,
GFile *child,
GFile *other_file,
GFileMonitorEvent event_type,
GtkTrashMonitor *monitor)
file_monitor_changed_cb (GFileMonitor *file_monitor,
GFile *child,
GFile *other_file,
GFileMonitorEvent event_type,
GtkTrashMonitor *monitor)
{
recompute_trash_state (monitor);
}
@@ -212,14 +173,12 @@ _gtk_trash_monitor_init (GtkTrashMonitor *monitor)
file = g_file_new_for_uri ("trash:///");
monitor->file_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
monitor->pending = FALSE;
monitor->timeout_id = 0;
g_object_unref (file);
if (monitor->file_monitor)
monitor->file_monitor_changed_id = g_signal_connect (monitor->file_monitor, "changed",
G_CALLBACK (file_monitor_changed_cb), monitor);
G_CALLBACK (file_monitor_changed_cb), monitor);
recompute_trash_state (monitor);
}
+25 -13
View File
@@ -812,12 +812,14 @@ static void gtk_tree_view_move_cursor_start_end (GtkTreeView
static gboolean gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeRBTree *tree,
GtkTreeRBNode *node);
GtkTreeRBNode *node,
gboolean animate);
static gboolean gtk_tree_view_real_expand_row (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeRBTree *tree,
GtkTreeRBNode *node,
gboolean open_all);
gboolean open_all,
gboolean animate);
static void gtk_tree_view_real_set_cursor (GtkTreeView *tree_view,
GtkTreePath *path,
SetCursorFlags flags);
@@ -3303,11 +3305,11 @@ gtk_tree_view_click_gesture_released (GtkGestureClick *gesture,
gtk_tree_view_real_expand_row (tree_view, path,
tree_view->button_pressed_tree,
tree_view->button_pressed_node,
FALSE);
FALSE, TRUE);
else
gtk_tree_view_real_collapse_row (tree_view, path,
tree_view->button_pressed_tree,
tree_view->button_pressed_node);
tree_view->button_pressed_node, TRUE);
gtk_tree_path_free (path);
}
else if (tree_view->activate_on_single_click && !modify && !extend)
@@ -9876,12 +9878,14 @@ gtk_tree_view_real_expand_collapse_cursor_row (GtkTreeView *tree_view,
cursor_path,
tree_view->cursor_tree,
tree_view->cursor_node,
open_all);
open_all,
TRUE);
else
gtk_tree_view_real_collapse_row (tree_view,
cursor_path,
tree_view->cursor_tree,
tree_view->cursor_node);
tree_view->cursor_node,
TRUE);
gtk_tree_path_free (cursor_path);
@@ -11248,7 +11252,7 @@ gtk_tree_view_expand_all (GtkTreeView *tree_view)
while (node)
{
gtk_tree_view_real_expand_row (tree_view, path, tree, node, TRUE);
gtk_tree_view_real_expand_row (tree_view, path, tree, node, TRUE, FALSE);
node = gtk_tree_rbtree_next (tree, node);
gtk_tree_path_next (path);
}
@@ -11285,7 +11289,7 @@ gtk_tree_view_collapse_all (GtkTreeView *tree_view)
while (node)
{
if (node->children)
gtk_tree_view_real_collapse_row (tree_view, path, tree, node);
gtk_tree_view_real_collapse_row (tree_view, path, tree, node, FALSE);
indices[0]++;
node = gtk_tree_rbtree_next (tree, node);
}
@@ -11338,12 +11342,16 @@ gtk_tree_view_real_expand_row (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeRBTree *tree,
GtkTreeRBNode *node,
gboolean open_all)
gboolean open_all,
gboolean animate)
{
GtkTreeIter iter;
GtkTreeIter temp;
gboolean expand;
if (animate)
animate = gtk_settings_get_enable_animations (gtk_widget_get_settings (GTK_WIDGET (tree_view)));
remove_auto_expand_timeout (tree_view);
if (node->children && !open_all)
@@ -11370,7 +11378,7 @@ gtk_tree_view_real_expand_row (GtkTreeView *tree_view,
{
gboolean t;
t = gtk_tree_view_real_expand_row (tree_view, tmp_path, tree, node,
TRUE);
TRUE, animate);
if (t)
retval = TRUE;
@@ -11453,7 +11461,7 @@ gtk_tree_view_expand_row (GtkTreeView *tree_view,
return FALSE;
if (tree != NULL)
return gtk_tree_view_real_expand_row (tree_view, path, tree, node, open_all);
return gtk_tree_view_real_expand_row (tree_view, path, tree, node, open_all, FALSE);
else
return FALSE;
}
@@ -11462,7 +11470,8 @@ static gboolean
gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeRBTree *tree,
GtkTreeRBNode *node)
GtkTreeRBNode *node,
gboolean animate)
{
GtkTreeIter iter;
GtkTreeIter children;
@@ -11470,6 +11479,9 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
GList *list;
gboolean selection_changed, cursor_changed;
if (animate)
animate = gtk_settings_get_enable_animations (gtk_widget_get_settings (GTK_WIDGET (tree_view)));
remove_auto_expand_timeout (tree_view);
if (node->children == NULL)
@@ -11595,7 +11607,7 @@ gtk_tree_view_collapse_row (GtkTreeView *tree_view,
if (tree == NULL || node->children == NULL)
return FALSE;
return gtk_tree_view_real_collapse_row (tree_view, path, tree, node);
return gtk_tree_view_real_collapse_row (tree_view, path, tree, node, FALSE);
}
static void
+5 -2
View File
@@ -11579,8 +11579,11 @@ gtk_widget_create_render_node (GtkWidget *widget,
if (opacity < 1.0)
gtk_snapshot_push_opacity (snapshot, opacity);
gtk_css_style_snapshot_background (&boxes, snapshot);
gtk_css_style_snapshot_border (&boxes, snapshot);
if (!GTK_IS_WINDOW (widget))
{
gtk_css_style_snapshot_background (&boxes, snapshot);
gtk_css_style_snapshot_border (&boxes, snapshot);
}
if (priv->overflow == GTK_OVERFLOW_HIDDEN)
{
+676 -380
View File
File diff suppressed because it is too large Load Diff
+45
View File
@@ -106,6 +106,37 @@ restore_window_clicked (GtkModelButton *button,
gtk_window_unmaximize (window);
}
static void
move_window_clicked (GtkModelButton *button,
GtkWindowHandle *self)
{
GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self));
GdkSurface *surface = gtk_native_get_surface (native);
if (GDK_IS_TOPLEVEL (surface))
gdk_toplevel_begin_move (GDK_TOPLEVEL (surface),
NULL,
0, /* 0 means "use keyboard" */
0, 0,
GDK_CURRENT_TIME);
}
static void
resize_window_clicked (GtkModelButton *button,
GtkWindowHandle *self)
{
GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self));
GdkSurface *surface = gtk_native_get_surface (native);
if (GDK_IS_TOPLEVEL (surface))
gdk_toplevel_begin_resize (GDK_TOPLEVEL (surface),
0,
NULL,
0, /* 0 means "use keyboard" */
0, 0,
GDK_CURRENT_TIME);
}
static void
minimize_window_clicked (GtkModelButton *button,
GtkWindowHandle *self)
@@ -220,6 +251,20 @@ do_popup_fallback (GtkWindowHandle *self,
G_CALLBACK (restore_window_clicked), self);
gtk_box_append (GTK_BOX (box), menuitem);
menuitem = gtk_model_button_new ();
g_object_set (menuitem, "text", _("Move"), NULL);
gtk_widget_set_sensitive (menuitem, !maximized);
g_signal_connect (G_OBJECT (menuitem), "clicked",
G_CALLBACK (move_window_clicked), self);
gtk_box_append (GTK_BOX (box), menuitem);
menuitem = gtk_model_button_new ();
g_object_set (menuitem, "text", _("Resize"), NULL);
gtk_widget_set_sensitive (menuitem, resizable && !maximized);
g_signal_connect (G_OBJECT (menuitem), "clicked",
G_CALLBACK (resize_window_clicked), self);
gtk_box_append (GTK_BOX (box), menuitem);
menuitem = gtk_model_button_new ();
g_object_set (menuitem, "text", _("Minimize"), NULL);
g_signal_connect (G_OBJECT (menuitem), "clicked",
+8
View File
@@ -51,6 +51,7 @@ void _gtk_window_set_allocation (GtkWindow *window,
int width,
int height,
GtkAllocation *allocation_out);
void gtk_window_check_resize (GtkWindow *self);
typedef void (*GtkWindowKeysForeachFunc) (GtkWindow *window,
guint keyval,
@@ -58,6 +59,9 @@ typedef void (*GtkWindowKeysForeachFunc) (GtkWindow *window,
gpointer data);
gboolean gtk_window_emit_close_request (GtkWindow *window);
gboolean gtk_window_configure (GtkWindow *window,
guint width,
guint height);
/* --- internal (GtkAcceleratable) --- */
void _gtk_window_schedule_mnemonics_visible (GtkWindow *window);
@@ -128,6 +132,10 @@ GtkWidget * gtk_window_pick_popover (GtkWindow *window,
double y,
GtkPickFlags flags);
void gtk_window_set_extra_input_region (GtkWindow *window,
cairo_region_t *region);
G_END_DECLS
#endif /* __GTK_WINDOW_PRIVATE_H__ */
+5
View File
@@ -49,6 +49,7 @@ gtk_focus_overlay_snapshot (GtkInspectorOverlay *overlay,
GtkFocusOverlay *self = GTK_FOCUS_OVERLAY (overlay);
GtkWidget *focus;
graphene_rect_t bounds;
double nx, ny;
if (!GTK_IS_NATIVE (widget))
return;
@@ -66,6 +67,10 @@ gtk_focus_overlay_snapshot (GtkInspectorOverlay *overlay,
if (!gtk_widget_compute_bounds (focus, widget, &bounds))
return;
gtk_native_get_surface_transform (GTK_NATIVE (widget), &nx, &ny);
bounds.origin.x += nx;
bounds.origin.y += ny;
gtk_snapshot_append_color (snapshot, &self->color, &bounds);
}
+6
View File
@@ -157,7 +157,13 @@ gtk_layout_overlay_snapshot (GtkInspectorOverlay *overlay,
GskRenderNode *node,
GtkWidget *widget)
{
double nx, ny;
gtk_native_get_surface_transform (GTK_NATIVE (widget), &nx, &ny);
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &(graphene_point_t){ nx, ny });
recurse_child_widgets (widget, snapshot);
gtk_snapshot_restore (snapshot);
}
static void
+1 -10
View File
@@ -172,14 +172,6 @@ gtk_updates_overlay_snapshot (GtkInspectorOverlay *overlay,
GtkUpdate *draw;
gint64 now;
GList *l;
double native_x, native_y;
if (!GTK_IS_NATIVE (widget))
return;
/* The coordinates we're getting from GdkSurface API are in GdkSurface coordinate spaces,
* but we're snapshotting in widget space, so we need to transform */
gtk_native_get_surface_transform (GTK_NATIVE (widget), &native_x, &native_y);
updates = gtk_update_overlay_lookup_for_widget (self, widget, TRUE);
now = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
@@ -234,8 +226,7 @@ gtk_updates_overlay_snapshot (GtkInspectorOverlay *overlay,
cairo_region_get_rectangle (draw->region, i, &rect);
gtk_snapshot_append_color (snapshot,
&(GdkRGBA) { 1, 0, 0, 0.4 * (1 - progress) },
&GRAPHENE_RECT_INIT(rect.x - native_x, rect.y - native_y,
rect.width, rect.height));
&GRAPHENE_RECT_INIT(rect.x, rect.y, rect.width, rect.height));
}
}
}
+1 -4
View File
@@ -605,15 +605,12 @@ gtk_inspector_prepare_render (GtkWidget *widget,
{
GtkSnapshot *snapshot;
GList *l;
double native_x, native_y;
snapshot = gtk_snapshot_new ();
gtk_snapshot_append_node (snapshot, node);
gtk_native_get_surface_transform (GTK_NATIVE (widget), &native_x, &native_y);
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &(graphene_point_t) { native_x, native_y });
gtk_snapshot_transform (snapshot, gtk_widget_get_transform (widget));
for (l = iw->overlays; l; l = l->next)
{
+1 -8
View File
@@ -671,10 +671,6 @@ foreach p: proto_sources
endif
endforeach
if os_unix and tracker3_enabled
gtk_sources += 'gtksearchenginetracker3.c'
endif
if os_unix
gtk_unix_print_headers = [
'gtkpagesetupunixdialog.h',
@@ -698,6 +694,7 @@ if os_unix
'gtkprintoperation-unix.c',
'gtkprintoperation-portal.c',
'gtkprintunixdialog.c',
'gtksearchenginetracker.c',
])
gtk_sources += gtk_unix_print_sources
@@ -961,10 +958,6 @@ if cloudproviders_enabled
gtk_deps += cloudproviders_dep
endif
if os_unix and tracker3_enabled
gtk_deps += tracker3_dep
endif
# Unconditional. If libintl isn't found,
# the object just does nothing being in the deplist
gtk_deps += libintl_dep
+34 -34
View File
@@ -180,7 +180,7 @@ label {
text-shadow: none;
}
window.assistant {
assistant {
.sidebar {
background-color: $base_color;
border-top: 1px solid $borders_color;
@@ -3474,7 +3474,7 @@ calendar {
/***********
* Dialogs *
***********/
window.dialog.message { // Message Dialog styling
messagedialog { // Message Dialog styling
.titlebar {
min-height: 20px;
background-image: none;
@@ -4030,7 +4030,8 @@ colorchooser .popover.osd { border-radius: 5px; }
/**********************
* Window Decorations *
*********************/
window {
decoration {
border-radius: $window_radius $window_radius 0 0;
// lamefun trick to get rounded borders regardless of CSD use
border-width: 0px;
@@ -4039,25 +4040,14 @@ window {
$_wm_border: if($variant=='light', transparentize(black, 0.77), transparentize($borders_color, 0.1));
$_wm_border_backdrop: if($variant=='light', transparentize(black, 0.82), transparentize($borders_color, 0.1));
&.csd {
box-shadow: 0 3px 9px 1px transparentize(black, 0.5),
0 0 0 1px $_wm_border; //doing borders with box-shadow
margin: 0px;
border-radius: $window_radius $window_radius 0 0;
}
&.solid-csd {
margin: 0;
padding: 0;
border: solid 14px $borders_color;
border-radius: 0;
box-shadow: inset 0 0 0 3px $headerbar_color, inset 0 1px $top_hilight;
&:backdrop { box-shadow: inset 0 0 0 3px $backdrop_bg_color, inset 0 1px $top_hilight; }
}
box-shadow: 0 3px 9px 1px transparentize(black, 0.5),
0 0 0 1px $_wm_border; //doing borders with box-shadow
// FIXME rationalize shadows
// this is used for the resize cursor area
margin: 10px;
&:backdrop {
// the transparent shadow here is to enforce that the shadow extents don't
// change when we go to backdrop, to prevent jumping windows.
@@ -4069,36 +4059,46 @@ window {
transition: $backdrop_transition;
}
&.maximized,
&.fullscreen,
&.tiled,
&.tiled-top,
&.tiled-left,
&.tiled-right,
&.tiled-bottom { border-radius: 0; }
.maximized > &,
.fullscreen > &,
.tiled > &,
.tiled-top > &,
.tiled-left > &,
.tiled-right > &,
.tiled-bottom > & { border-radius: 0; }
&.popup { box-shadow: none; }
.popup > & { box-shadow: none; }
// server-side decorations as used by mutter
&.ssd { box-shadow: 0 0 0 1px $_wm_border; } //just doing borders, wm draws actual shadows
.ssd > & { box-shadow: 0 0 0 1px $_wm_border; } //just doing borders, wm draws actual shadows
&.csd.popup {
.csd.popup > & {
border-radius: $menu_radius;
box-shadow: 0 1px 2px transparentize(black, 0.8),
0 0 0 1px transparentize($_wm_border, 0.1);
}
&.dialog.message.csd {
tooltip.csd > & {
border-radius: 5px;
box-shadow: none;
}
messagedialog.csd > & {
border-radius: $window_radius;
box-shadow: 0 1px 2px transparentize(black, 0.8),
0 0 0 1px transparentize($_wm_border, 0.1);
}
}
.solid-csd > & {
margin: 0;
padding: 4px;
background-color: $borders_color;
border: solid 1px $borders_color;
border-radius: 0;
box-shadow: inset 0 0 0 3px $headerbar_color, inset 0 1px $top_hilight;
tooltip.csd {
border-radius: 5px;
box-shadow: none;
&:backdrop { box-shadow: inset 0 0 0 3px $backdrop_bg_color, inset 0 1px $top_hilight; }
}
}
// catch all extend :)
+1 -2
View File
@@ -26,7 +26,6 @@
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtkbuilderprivate.h"
#include "gtk-builder-tool.h"
static const gchar *
object_get_name (GObject *object)
@@ -38,7 +37,7 @@ object_get_name (GObject *object)
}
void
do_enumerate (int *argc, const char ***argv)
do_enumerate (int *argc, char ***argv)
{
GtkBuilder *builder;
GError *error = NULL;
+1 -16
View File
@@ -26,8 +26,6 @@
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtkbuilderprivate.h"
#include "gtk-builder-tool.h"
static void
set_window_title (GtkWindow *window,
@@ -50,17 +48,6 @@ set_window_title (GtkWindow *window,
g_free (name);
}
static void
quit_cb (GtkWidget *widget,
gpointer user_data)
{
gboolean *is_done = user_data;
*is_done = TRUE;
g_main_context_wakeup (NULL);
}
static void
preview_file (const char *filename,
const char *id,
@@ -70,7 +57,6 @@ preview_file (const char *filename,
GError *error = NULL;
GObject *object;
GtkWidget *window;
gboolean done = FALSE;
if (cssfile)
{
@@ -156,9 +142,8 @@ preview_file (const char *filename,
}
gtk_window_present (GTK_WINDOW (window));
g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
while (!done)
while (TRUE)
g_main_context_iteration (NULL, TRUE);
g_object_unref (builder);
+1 -2
View File
@@ -26,7 +26,6 @@
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtkbuilderprivate.h"
#include "gtk-builder-tool.h"
typedef struct Element Element;
struct Element {
@@ -1817,7 +1816,7 @@ dump_tree (MyParserData *data)
dump_element (data->root, data->output, 0);
}
static gboolean
gboolean
simplify_file (const char *filename,
gboolean replace,
gboolean convert3to4)
+3 -2
View File
@@ -26,7 +26,6 @@
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtkbuilderprivate.h"
#include "gtk-builder-tool.h"
static GType
make_fake_type (const gchar *type_name,
@@ -148,7 +147,7 @@ validate_file (const char *filename)
}
void
do_validate (int *argc, const char ***argv)
do_validate (int *argc, char ***argv)
{
int i;
@@ -157,4 +156,6 @@ do_validate (int *argc, const char ***argv)
if (!validate_file ((*argv)[i]))
exit (1);
}
return;
}
+6 -2
View File
@@ -26,9 +26,13 @@
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtkbuilderprivate.h"
#include "gtk-builder-tool.h"
static void G_GNUC_NORETURN
extern void do_simplify (int *argc, const char ***argv);
extern void do_validate (int *argc, const char ***argv);
extern void do_enumerate (int *argc, const char ***argv);
extern void do_preview (int *argc, const char ***argv);
static void
usage (void)
{
g_print (_("Usage:\n"
-10
View File
@@ -1,10 +0,0 @@
#ifndef __GTK_BUILDER_TOOL_H__
#define __GTK_BUILDER_TOOL_H__
void do_simplify (int *argc, const char ***argv);
void do_validate (int *argc, const char ***argv);
void do_enumerate (int *argc, const char ***argv);
void do_preview (int *argc, const char ***argv);
#endif
+1 -1
View File
@@ -20,7 +20,7 @@ foreach tool: gtk_tools
exe = executable(tool_name, tool_srcs,
include_directories: [confinc],
c_args: common_cflags,
c_args: gtk_cargs,
dependencies: libgtk_dep,
install: true)
-10
View File
@@ -386,16 +386,6 @@ if os_unix
platform_gio_dep = giounix_dep
endif
tracker3_enabled = get_option('tracker3')
if tracker3_enabled
tracker3_dep = dependency('tracker-sparql-3.0', required: false)
if tracker3_dep.found()
cdata.set('HAVE_TRACKER3', tracker3_dep.found())
else
error('Tracker3 not found, but was explicitly requested.')
endif
endif
if iso_codes_dep.found()
cdata.set_quoted('ISO_CODES_PREFIX', iso_codes_dep.get_pkgconfig_variable('prefix'))
else
-2
View File
@@ -23,8 +23,6 @@ option('cloudproviders', type: 'boolean', value: false,
description : 'Enable the cloudproviders support')
option('profiler', type: 'boolean', value: false,
description : 'Enable profiler support')
option('tracker3', type: 'boolean', value: false,
description : 'Enable Tracker3 filechooser search')
# Print backends
option('print-backends', type : 'string', value : 'cups,file',
+1 -6
View File
@@ -96,8 +96,6 @@ gtk_gst_media_file_paintable_init (GdkPaintableInterface *iface)
G_DEFINE_TYPE_EXTENDED (GtkGstMediaFile, gtk_gst_media_file, GTK_TYPE_MEDIA_FILE, 0,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_gst_media_file_paintable_init))
G_MODULE_EXPORT
void
g_io_module_load (GIOModule *module)
{
@@ -109,20 +107,17 @@ g_io_module_load (GIOModule *module)
10);
}
G_MODULE_EXPORT
G_GNUC_NORETURN
void
g_io_module_unload (GIOModule *module)
{
g_assert_not_reached ();
}
G_MODULE_EXPORT
char **
g_io_module_query (void)
{
char *eps[] = {
(char *) GTK_MEDIA_FILE_EXTENSION_POINT_NAME,
GTK_MEDIA_FILE_EXTENSION_POINT_NAME,
NULL
};
+5 -1
View File
@@ -24,7 +24,11 @@ media_subdir = 'gtk-4.0/@0@/media'.format(gtk_binary_version)
media_install_dir = join_paths(get_option('libdir'), media_subdir)
extra_c_args = ['-DGTK_COMPILATION']
extra_c_args += common_cflags
# Detect and set symbol visibility
if cc.get_id() == 'msvc'
extra_c_args += ['-D_GLIB_EXTERN=__declspec (dllexport) extern']
endif
if media_backends.contains('ffmpeg')
libavfilter_dep = dependency('libavfilter', version: '>= 6.47.100', required: true)
+6 -14
View File
@@ -61,8 +61,8 @@ typedef struct
*/
static GVariant *
create_attributes (const gchar *printer_uri,
const char **additional_attrs,
const char **additional_labels)
gchar **additional_attrs,
gchar **additional_labels)
{
GVariantBuilder *attr_builder = NULL;
GVariant *ret = NULL;
@@ -276,7 +276,7 @@ do_store_auth_info (GTask *task)
GVariant *attributes = NULL,
*properties = NULL,
*secret = NULL;
const char **additional_attrs = NULL,
gchar **additional_attrs = NULL,
**additional_labels = NULL,
*password = NULL;
SecretsServiceData *task_data = g_task_get_task_data (task);
@@ -287,8 +287,8 @@ do_store_auth_info (GTask *task)
length = g_strv_length (task_data->auth_info_labels);
additional_attrs = g_new0 (const char *, length + 1);
additional_labels = g_new0 (const char *, length + 1);
additional_attrs = g_new0 (gchar *, length + 1);
additional_labels = g_new0 (gchar *, length + 1);
/* The labels user and server are chosen to be compatible with
the attributes used by system-config-printer */
for (i = 0; task_data->auth_info_labels[i] != NULL; i++)
@@ -420,8 +420,6 @@ prompt_completed_cb (GDBusConnection *connection,
get_secret_cb,
task);
break;
default:
;
}
}
@@ -523,8 +521,6 @@ unlock_collection_cb (GObject *source_object,
get_secret_cb,
task);
break;
default:
;
}
}
g_variant_unref (output);
@@ -660,8 +656,6 @@ item_proxy_cb (GObject *source_object,
get_secret_cb,
task);
break;
default:
;
}
}
@@ -832,8 +826,6 @@ open_session_cb (GObject *source_object,
task);
break;
}
default:
;
}
}
@@ -896,7 +888,7 @@ gtk_cups_secrets_service_watch (GBusNameAppearedCallback appeared,
NULL);
}
static void
void
cleanup_task_data (gpointer data)
{
gint i;
+6 -7
View File
@@ -81,13 +81,13 @@ static GtkCupsRequestStateFunc get_states[] = {
_get_read_data
};
static void G_GNUC_PRINTF (5, 6)
static void
gtk_cups_result_set_error (GtkCupsResult *result,
GtkCupsErrorType error_type,
int error_status,
int error_code,
int error_code,
const char *error_msg,
...)
...)
{
va_list args;
@@ -476,7 +476,7 @@ gtk_cups_request_encode_option (GtkCupsRequest *request,
}
}
switch ((guint)option_tag)
switch (option_tag)
{
case IPP_TAG_INTEGER:
case IPP_TAG_ENUM:
@@ -1430,12 +1430,11 @@ _get_read_data (GtkCupsRequest *request)
{
request->state = GTK_CUPS_GET_DONE;
request->poll_state = GTK_CUPS_HTTP_IDLE;
gtk_cups_result_set_error (request->result,
GTK_CUPS_ERROR_IO,
io_status,
error->code,
"%s",
error->code,
error->message);
g_error_free (error);
}
@@ -103,7 +103,6 @@ void t_goa_account_free (gpointer data);
G_DEFINE_DYNAMIC_TYPE (GtkPrintBackendCloudprint, gtk_print_backend_cloudprint, GTK_TYPE_PRINT_BACKEND)
G_MODULE_EXPORT
void
g_io_module_load (GIOModule *module)
{
@@ -119,13 +118,11 @@ g_io_module_load (GIOModule *module)
10);
}
G_MODULE_EXPORT
void
g_io_module_unload (GIOModule *module)
{
}
G_MODULE_EXPORT
char **
g_io_module_query (void)
{
+30 -36
View File
@@ -156,6 +156,8 @@ struct _GtkPrintBackendCups
static GObjectClass *backend_parent_class;
static void gtk_print_backend_cups_class_init (GtkPrintBackendCupsClass *class);
static void gtk_print_backend_cups_init (GtkPrintBackendCups *impl);
static void gtk_print_backend_cups_finalize (GObject *object);
static void gtk_print_backend_cups_dispose (GObject *object);
static void cups_get_printer_list (GtkPrintBackend *print_backend);
@@ -236,7 +238,6 @@ static void secrets_service_vanished_cb (GDBusConnec
G_DEFINE_DYNAMIC_TYPE(GtkPrintBackendCups, gtk_print_backend_cups, GTK_TYPE_PRINT_BACKEND)
G_MODULE_EXPORT
void
g_io_module_load (GIOModule *module)
{
@@ -251,18 +252,16 @@ g_io_module_load (GIOModule *module)
10);
}
G_MODULE_EXPORT
void
g_io_module_unload (GIOModule *module)
{
}
G_MODULE_EXPORT
char **
g_io_module_query (void)
{
char *eps[] = {
(char *)GTK_PRINT_BACKEND_EXTENSION_POINT_NAME,
GTK_PRINT_BACKEND_EXTENSION_POINT_NAME,
NULL
};
@@ -650,7 +649,6 @@ add_cups_options (const gchar *key,
custom_value = TRUE;
break;
case PPD_CUSTOM_UNKNOWN:
default :
custom_value = FALSE;
}
@@ -1155,7 +1153,7 @@ request_password (gpointer data)
dispatch->backend->authentication_lock = TRUE;
switch ((guint)ippGetOperation (dispatch->request->ipp_request))
switch (ippGetOperation (dispatch->request->ipp_request))
{
case IPP_PRINT_JOB:
if (job_title != NULL && printer_name != NULL)
@@ -2288,7 +2286,7 @@ cups_printer_handle_attribute (GtkPrintBackendCups *cups_backend,
col = ippGetCollection (attr, i);
for (iter = ippFirstAttribute (col); iter != NULL; iter = ippNextAttribute (col))
{
switch ((guint)ippGetValueTag (iter))
switch (ippGetValueTag (iter))
{
case IPP_TAG_INTEGER:
if (g_strcmp0 (ippGetName (iter), "media-bottom-margin") == 0)
@@ -3040,7 +3038,7 @@ avahi_connection_test_cb (GObject *source_object,
g_free (data);
}
static gboolean
gboolean
avahi_txt_get_key_value_pair (const gchar *entry,
gchar **key,
gchar **value)
@@ -3707,8 +3705,6 @@ update_backend_status (GtkPrintBackendCups *cups_backend,
case GTK_CUPS_CONNECTION_AVAILABLE:
g_object_set (cups_backend, "status", GTK_PRINT_BACKEND_STATUS_OK, NULL);
break;
case GTK_CUPS_CONNECTION_IN_PROGRESS:
default: ;
}
}
@@ -4962,7 +4958,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (ppdNextCustomParam (coption) == NULL)
{
switch ((guint)cparam->type)
switch (cparam->type)
{
case PPD_CUSTOM_INT:
option = gtk_printer_option_new (gtk_name, label,
@@ -5364,8 +5360,8 @@ format_ipp_choice (const gchar *ipp_choice)
* if available.
*/
static GtkPrinterOption *
setup_ipp_option (const char *ipp_option_name,
const char *ipp_choice_default,
setup_ipp_option (gchar *ipp_option_name,
gchar *ipp_choice_default,
GList *ipp_choices,
GtkPrinterOptionSet *set)
{
@@ -5423,16 +5419,16 @@ setup_ipp_option (const char *ipp_option_name,
{
gtk_printer_option_choices_from_array (option,
length,
(const char **)choices,
(const char **)choices_display);
choices,
choices_display);
}
option_set_is_ipp_option (option, TRUE);
gtk_printer_option_set_add (set, option);
g_strfreev (choices);
g_strfreev (choices_display);
g_free (choices);
g_free (choices_display);
}
/* The option exists. Set its default value if available. */
@@ -5455,21 +5451,21 @@ cups_printer_get_options (GtkPrinter *printer,
GtkPrinterOption *option;
ppd_file_t *ppd_file;
int i;
const char *print_at[] = { "now", "at", "on-hold" };
const char *n_up[] = {"1", "2", "4", "6", "9", "16" };
const char *prio[] = {"100", "80", "50", "30" };
char *print_at[] = { "now", "at", "on-hold" };
char *n_up[] = {"1", "2", "4", "6", "9", "16" };
char *prio[] = {"100", "80", "50", "30" };
/* Translators: These strings name the possible values of the
* job priority option in the print dialog
*/
const char *prio_display[] = {N_("Urgent"), N_("High"), N_("Medium"), N_("Low") };
const char *n_up_layout[] = { "lrtb", "lrbt", "rltb", "rlbt", "tblr", "tbrl", "btlr", "btrl" };
char *prio_display[] = {N_("Urgent"), N_("High"), N_("Medium"), N_("Low") };
char *n_up_layout[] = { "lrtb", "lrbt", "rltb", "rlbt", "tblr", "tbrl", "btlr", "btrl" };
/* Translators: These strings name the possible arrangements of
* multiple pages on a sheet when printing
*/
const char *n_up_layout_display[] = { N_("Left to right, top to bottom"), N_("Left to right, bottom to top"),
N_("Right to left, top to bottom"), N_("Right to left, bottom to top"),
N_("Top to bottom, left to right"), N_("Top to bottom, right to left"),
N_("Bottom to top, left to right"), N_("Bottom to top, right to left") };
char *n_up_layout_display[] = { N_("Left to right, top to bottom"), N_("Left to right, bottom to top"),
N_("Right to left, top to bottom"), N_("Right to left, bottom to top"),
N_("Top to bottom, left to right"), N_("Top to bottom, right to left"),
N_("Bottom to top, left to right"), N_("Bottom to top, right to left") };
char *name;
int num_opts;
cups_option_t *opts = NULL;
@@ -5513,7 +5509,7 @@ cups_printer_get_options (GtkPrinter *printer,
if (backend != NULL && printer != NULL)
{
const char *cover_default[] = {
char *cover_default[] = {
"none",
"classified",
"confidential",
@@ -5522,7 +5518,7 @@ cups_printer_get_options (GtkPrinter *printer,
"topsecret",
"unclassified"
};
const char *cover_display_default[] = {
char *cover_display_default[] = {
/* Translators, these strings are names for various 'standard' cover
* pages that the printing system may support.
*/
@@ -5538,7 +5534,7 @@ cups_printer_get_options (GtkPrinter *printer,
char **cover_display = NULL;
char **cover_display_translated = NULL;
gint num_of_covers = 0;
gconstpointer value;
gpointer value;
gint j;
/* Translators, this string is used to label the pages-per-sheet option
@@ -5605,7 +5601,7 @@ cups_printer_get_options (GtkPrinter *printer,
*/
option = gtk_printer_option_new ("gtk-cover-before", C_("printer option", "Before"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, num_of_covers,
(const char **)cover, (const char **)cover_display_translated);
cover, cover_display_translated);
if (cups_printer->default_cover_before != NULL)
gtk_printer_option_set (option, cups_printer->default_cover_before);
@@ -5620,7 +5616,7 @@ cups_printer_get_options (GtkPrinter *printer,
*/
option = gtk_printer_option_new ("gtk-cover-after", C_("printer option", "After"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, num_of_covers,
(const char **)cover, (const char **)cover_display_translated);
cover, cover_display_translated);
if (cups_printer->default_cover_after != NULL)
gtk_printer_option_set (option, cups_printer->default_cover_after);
else
@@ -6324,7 +6320,7 @@ supports_am_pm (void)
* Returns a newly allocated string holding UTC time in HH:MM:SS format
* or NULL.
*/
static gchar *
gchar *
localtime_to_utctime (const char *local_time)
{
const char *formats_0[] = {" %I : %M : %S %p ", " %p %I : %M : %S ",
@@ -6539,6 +6535,8 @@ cups_printer_prepare_for_print (GtkPrinter *printer,
switch (gtk_page_setup_get_orientation (page_setup))
{
case GTK_PAGE_ORIENTATION_PORTRAIT:
break;
case GTK_PAGE_ORIENTATION_LANDSCAPE:
if (layout < 4)
layout = layout + 2 + 4 * (1 - layout / 2);
@@ -6554,10 +6552,6 @@ cups_printer_prepare_for_print (GtkPrinter *printer,
else
layout = layout - 6 + 4 * (1 - (layout - 4) / 2);
break;
case GTK_PAGE_ORIENTATION_PORTRAIT:
default:
break;
}
enum_class = g_type_class_ref (GTK_TYPE_NUMBER_UP_LAYOUT);
+12 -17
View File
@@ -74,6 +74,8 @@ static const gchar* formats[N_FORMATS] =
static GObjectClass *backend_parent_class;
static void gtk_print_backend_file_class_init (GtkPrintBackendFileClass *class);
static void gtk_print_backend_file_init (GtkPrintBackendFile *impl);
static void file_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options,
GtkPrintSettings *settings);
@@ -102,7 +104,6 @@ static GtkPageSetup * file_printer_get_default_page_size (GtkPrinter
G_DEFINE_DYNAMIC_TYPE(GtkPrintBackendFile, gtk_print_backend_file, GTK_TYPE_PRINT_BACKEND)
G_MODULE_EXPORT
void
g_io_module_load (GIOModule *module)
{
@@ -116,18 +117,16 @@ g_io_module_load (GIOModule *module)
10);
}
G_MODULE_EXPORT
void
g_io_module_unload (GIOModule *module)
{
}
G_MODULE_EXPORT
char **
g_io_module_query (void)
{
char *eps[] = {
(char *)GTK_PRINT_BACKEND_EXTENSION_POINT_NAME,
GTK_PRINT_BACKEND_EXTENSION_POINT_NAME,
NULL
};
@@ -218,7 +217,6 @@ output_file_from_settings (GtkPrintSettings *settings,
switch (format)
{
default:
case N_FORMATS:
case FORMAT_PDF:
extension = "pdf";
break;
@@ -335,7 +333,6 @@ file_printer_create_cairo_surface (GtkPrinter *printer,
switch (format)
{
default:
case N_FORMATS:
case FORMAT_PDF:
surface = cairo_pdf_surface_create_for_stream (_cairo_write, cache_io, width, height);
break;
@@ -635,14 +632,14 @@ file_printer_get_options (GtkPrinter *printer,
{
GtkPrinterOptionSet *set;
GtkPrinterOption *option;
const char *n_up[] = {"1", "2", "4", "6", "9", "16" };
const char *pages_per_sheet = NULL;
const char *format_names[N_FORMATS] = { N_("PDF"), N_("PostScript"), N_("SVG") };
const char *supported_formats[N_FORMATS];
const char *display_format_names[N_FORMATS];
const gchar *n_up[] = {"1", "2", "4", "6", "9", "16" };
const gchar *pages_per_sheet = NULL;
const gchar *format_names[N_FORMATS] = { N_("PDF"), N_("PostScript"), N_("SVG") };
const gchar *supported_formats[N_FORMATS];
gchar *display_format_names[N_FORMATS];
gint n_formats = 0;
OutputFormat format;
char *uri;
gchar *uri;
gint current_format = 0;
_OutputFormatChangedData *format_changed_data;
@@ -652,7 +649,7 @@ file_printer_get_options (GtkPrinter *printer,
option = gtk_printer_option_new ("gtk-n-up", _("Pages per _sheet:"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (n_up),
n_up, n_up /* FIXME i18n (localised digits)! */);
(char **) n_up, (char **) n_up /* FIXME i18n (localised digits)! */);
if (settings)
pages_per_sheet = gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_NUMBER_UP);
if (pages_per_sheet)
@@ -689,7 +686,6 @@ file_printer_get_options (GtkPrinter *printer,
switch (format)
{
default:
case N_FORMATS:
case FORMAT_PDF:
current_format = FORMAT_PDF;
break;
@@ -725,8 +721,8 @@ file_printer_get_options (GtkPrinter *printer,
option->group = g_strdup ("GtkPrintDialogExtension");
gtk_printer_option_choices_from_array (option, n_formats,
supported_formats,
display_format_names);
(char **) supported_formats,
display_format_names);
gtk_printer_option_set (option, supported_formats[current_format]);
gtk_printer_option_set_add (set, option);
@@ -807,7 +803,6 @@ file_printer_prepare_for_print (GtkPrinter *printer,
switch (format)
{
case FORMAT_PDF:
case N_FORMATS:
gtk_print_job_set_rotate (print_job, FALSE);
break;
default:
@@ -83,7 +83,6 @@ static void gtk_print_backend_lpr_print_stream (GtkPrintBacke
G_DEFINE_DYNAMIC_TYPE (GtkPrintBackendLpr, gtk_print_backend_lpr, GTK_TYPE_PRINT_BACKEND)
G_MODULE_EXPORT
void
g_io_module_load (GIOModule *module)
{
@@ -97,13 +96,11 @@ g_io_module_load (GIOModule *module)
10);
}
G_MODULE_EXPORT
void
g_io_module_unload (GIOModule *module)
{
}
G_MODULE_EXPORT
char **
g_io_module_query (void)
{
+1 -1
View File
@@ -68,7 +68,7 @@ printbackends_args = [
'-DGTK_COMPILATION',
'-DGTK_DISABLE_DEPRECATION_WARNINGS',
'-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED',
] + common_cflags
]
if print_backends.contains('cups')
shared_module('printbackend-cups',
+88 -89
View File
@@ -17,8 +17,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gtk+-properties.master\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-20 08:31+0000\n"
"PO-Revision-Date: 2020-05-20 12:06+0200\n"
"POT-Creation-Date: 2020-05-16 10:39+0000\n"
"PO-Revision-Date: 2020-05-18 10:13+0200\n"
"Last-Translator: Daniel Mustieles <daniel.mustieles@gmail.com>\n"
"Language-Team: Spanish - Spain <gnome-es-list@gnome.org>\n"
"Language: es_ES\n"
@@ -29,7 +29,7 @@ msgstr ""
"X-Generator: Gtranslator 3.36.0\n"
#: gdk/gdkapplaunchcontext.c:133 gdk/gdkdrawcontext.c:155 gdk/gdkseat.c:200
#: gdk/gdkseat.c:201 gdk/gdksurface.c:489 gdk/gdksurface.c:490
#: gdk/gdkseat.c:201 gdk/gdksurface.c:428 gdk/gdksurface.c:429
#: gdk/win32/gdkcursor-win32.c:234 gtk/gtkicontheme.c:990
#: gtk/gtkicontheme.c:991 gtk/gtkmountoperation.c:190 gtk/gtkstylecontext.c:145
#: gtk/gtkwindow.c:878
@@ -203,19 +203,14 @@ msgstr "Modificador de estado"
msgid "The modifier state of the keyboard"
msgstr "El modificador de estado del teclado"
#: gdk/gdkdisplay.c:183 gdk/gdkdisplay.c:184
#: gdk/gdkdisplay.c:180 gdk/gdkdisplay.c:181
msgid "Composited"
msgstr "Compuesto"
#: gdk/gdkdisplay.c:196 gdk/gdkdisplay.c:197
#: gdk/gdkdisplay.c:193 gdk/gdkdisplay.c:194
msgid "RGBA"
msgstr "RGBA"
#: gdk/gdkdisplay.c:209 gdk/gdkdisplay.c:210
#| msgid "Input source"
msgid "Input shapes"
msgstr "Formas de entrada"
#: gdk/gdkdisplaymanager.c:167
msgid "Default Display"
msgstr "Visor predeterminado"
@@ -252,23 +247,23 @@ msgstr "Padre"
msgid "The parent surface"
msgstr "La superficie padre"
#: gdk/gdkpopup.c:87 gtk/gtkpopover.c:1637
#: gdk/gdkpopup.c:87 gtk/gtkpopover.c:1703
msgid "Autohide"
msgstr "Ocultar automáticamente"
#: gdk/gdksurface.c:476 gdk/gdksurface.c:477 gtk/gtkwidget.c:1084
#: gdk/gdksurface.c:415 gdk/gdksurface.c:416 gtk/gtkwidget.c:1084
msgid "Cursor"
msgstr "Cursor"
#: gdk/gdksurface.c:496 gdk/gdksurface.c:497
#: gdk/gdksurface.c:435 gdk/gdksurface.c:436
msgid "Frame Clock"
msgstr "Marco del reloj"
#: gdk/gdksurface.c:503 gdk/gdksurface.c:504
#: gdk/gdksurface.c:442 gdk/gdksurface.c:443
msgid "Mapped"
msgstr "Mapeado"
#: gdk/gdktoplevel.c:103 gdk/gdktoplevel.c:104 gtk/gtkcssnode.c:617
#: gdk/gdktoplevel.c:101 gdk/gdktoplevel.c:102 gtk/gtkcssnode.c:617
#: gtk/gtkswitch.c:539
msgid "State"
msgstr "Estado"
@@ -317,11 +312,11 @@ msgstr "Menor"
msgid "Minor version number"
msgstr "Número de versión menor"
#: gdk/x11/gdkdevice-xi2.c:128
#: gdk/x11/gdkdevice-xi2.c:129
msgid "Device ID"
msgstr "ID del dispositivo"
#: gdk/x11/gdkdevice-xi2.c:129
#: gdk/x11/gdkdevice-xi2.c:130
msgid "Device identifier"
msgstr "Identificador del dispositivo"
@@ -762,17 +757,17 @@ msgstr "Forzar la proporción para que coincida con el hijo del marco"
#: gtk/gtkaspectframe.c:166 gtk/gtkbutton.c:253 gtk/gtkcombobox.c:784
#: gtk/gtkdragicon.c:372 gtk/gtkexpander.c:366 gtk/gtkflowbox.c:513
#: gtk/gtkframe.c:190 gtk/gtklistbox.c:3455 gtk/gtknotebook.c:570
#: gtk/gtkoverlay.c:319 gtk/gtkpopover.c:1665 gtk/gtkrevealer.c:354
#: gtk/gtkoverlay.c:319 gtk/gtkpopover.c:1731 gtk/gtkrevealer.c:354
#: gtk/gtkscrolledwindow.c:759 gtk/gtksearchbar.c:316 gtk/gtkstack.c:381
#: gtk/gtkviewport.c:390 gtk/gtkwindow.c:970 gtk/gtkwindowhandle.c:591
#: gtk/gtkviewport.c:390 gtk/gtkwindow.c:970 gtk/gtkwindowhandle.c:578
msgid "Child"
msgstr "Hijo"
#: gtk/gtkaspectframe.c:167 gtk/gtkbutton.c:254 gtk/gtkexpander.c:367
#: gtk/gtkflowbox.c:514 gtk/gtkframe.c:191 gtk/gtklistbox.c:3456
#: gtk/gtkoverlay.c:320 gtk/gtkpopover.c:1666 gtk/gtkrevealer.c:355
#: gtk/gtkoverlay.c:320 gtk/gtkpopover.c:1732 gtk/gtkrevealer.c:355
#: gtk/gtkscrolledwindow.c:760 gtk/gtksearchbar.c:317 gtk/gtkviewport.c:391
#: gtk/gtkwindow.c:971 gtk/gtkwindowhandle.c:592
#: gtk/gtkwindow.c:971 gtk/gtkwindowhandle.c:579
msgid "The child widget"
msgstr "El widget hijo"
@@ -1911,7 +1906,7 @@ msgstr "Indica si se debe mostrar el alfa"
msgid "Show editor"
msgstr "Mostrar editor"
#: gtk/gtkcolorscale.c:305
#: gtk/gtkcolorscale.c:280
msgid "Scale type"
msgstr "Tipo de escala"
@@ -2869,12 +2864,12 @@ msgstr "Etiqueta de cancelar"
msgid "The label on the cancel button"
msgstr "La etiqueta del botón de cancelar"
#: gtk/gtkfilechooserwidget.c:7643 gtk/gtkfilechooserwidget.c:7644
#: gtk/gtkfilechooserwidget.c:7639 gtk/gtkfilechooserwidget.c:7640
msgid "Search mode"
msgstr "Modo de búsqueda"
# components/music/nautilus-music-view.c:198
#: gtk/gtkfilechooserwidget.c:7650 gtk/gtkfilechooserwidget.c:7651
#: gtk/gtkfilechooserwidget.c:7646 gtk/gtkfilechooserwidget.c:7647
#: gtk/gtkshortcutsshortcut.c:634
msgid "Subtitle"
msgstr "Subtítulo"
@@ -2929,12 +2924,12 @@ msgid "The selection mode"
msgstr "El modo de selección"
#: gtk/gtkflowbox.c:3592 gtk/gtkiconview.c:598 gtk/gtklistbox.c:496
#: gtk/gtktreeview.c:1205
#: gtk/gtktreeview.c:1207
msgid "Activate on Single Click"
msgstr "Activar con una única pulsación"
#: gtk/gtkflowbox.c:3593 gtk/gtkiconview.c:599 gtk/gtklistbox.c:497
#: gtk/gtktreeview.c:1206
#: gtk/gtktreeview.c:1208
msgid "Activate row on a single click"
msgstr "Activar fila con una única pulsación"
@@ -3374,15 +3369,15 @@ msgid ""
msgstr ""
"Cómo se sitúan el texto y el icono para cada elemento relativo a los demás"
#: gtk/gtkiconview.c:544 gtk/gtktreeview.c:1071 gtk/gtktreeviewcolumn.c:379
#: gtk/gtkiconview.c:544 gtk/gtktreeview.c:1073 gtk/gtktreeviewcolumn.c:379
msgid "Reorderable"
msgstr "Reordenable"
#: gtk/gtkiconview.c:545 gtk/gtktreeview.c:1072
#: gtk/gtkiconview.c:545 gtk/gtktreeview.c:1074
msgid "View is reorderable"
msgstr "La vista es reordenable"
#: gtk/gtkiconview.c:552 gtk/gtktreeview.c:1191
#: gtk/gtkiconview.c:552 gtk/gtktreeview.c:1193
msgid "Tooltip Column"
msgstr "Columna de sugerencia"
@@ -4073,7 +4068,7 @@ msgstr "Etiqueta de menú"
msgid "The text of the menu widget"
msgstr "El texto del menú"
#: gtk/gtknotebook.c:605 gtk/gtkpaned.c:420 gtk/gtkpopover.c:1630
#: gtk/gtknotebook.c:605 gtk/gtkpaned.c:420 gtk/gtkpopover.c:1696
msgid "Position"
msgstr "Posición"
@@ -4293,18 +4288,22 @@ msgstr ""
"Si es cierto, el segundo hijo puede hacerse más pequeño que sus requisitos"
#: gtk/gtkpaned.c:528
#| msgid "Resize first child"
msgid "First child"
msgstr "Primer hijo"
#: gtk/gtkpaned.c:529
#| msgid "Resize first child"
msgid "The first child"
msgstr "El primer hijo"
#: gtk/gtkpaned.c:535
#| msgid "Shrink second child"
msgid "Second child"
msgstr "Segundo hijo"
#: gtk/gtkpaned.c:536
#| msgid "Resize second child"
msgid "The second child"
msgstr "El segundo hijo"
@@ -4348,19 +4347,19 @@ msgstr "Se puede encoger"
msgid "Allow self to be smaller than contents"
msgstr "Permitir ser más pequeño que el contenido"
#: gtk/gtkplacessidebar.c:4334
#: gtk/gtkplacessidebar.c:4336
msgid "Location to Select"
msgstr "Ubicación que seleccionar"
#: gtk/gtkplacessidebar.c:4335
#: gtk/gtkplacessidebar.c:4337
msgid "The location to highlight in the sidebar"
msgstr "La ubicación que resaltar en la barra lateral"
#: gtk/gtkplacessidebar.c:4340 gtk/gtkplacesview.c:2250
#: gtk/gtkplacessidebar.c:4342 gtk/gtkplacesview.c:2247
msgid "Open Flags"
msgstr "Abrir opciones"
#: gtk/gtkplacessidebar.c:4341 gtk/gtkplacesview.c:2251
#: gtk/gtkplacessidebar.c:4343 gtk/gtkplacesview.c:2248
msgid ""
"Modes in which the calling application can open locations selected in the "
"sidebar"
@@ -4368,78 +4367,78 @@ msgstr ""
"Modos en los que la aplicación llamante puede abrir ubicaciones "
"seleccionadas en la barra lateral"
#: gtk/gtkplacessidebar.c:4347
#: gtk/gtkplacessidebar.c:4349
msgid "Show recent files"
msgstr "Mostrar archivo recientes"
#: gtk/gtkplacessidebar.c:4348
#: gtk/gtkplacessidebar.c:4350
msgid "Whether the sidebar includes a builtin shortcut for recent files"
msgstr ""
"Indica si la barra lateral incluye un atajo para los archivos recientes"
#: gtk/gtkplacessidebar.c:4353
#: gtk/gtkplacessidebar.c:4355
msgid "Show “Desktop”"
msgstr "Mostrar «Escritorio»"
#: gtk/gtkplacessidebar.c:4354
#: gtk/gtkplacessidebar.c:4356
msgid "Whether the sidebar includes a builtin shortcut to the Desktop folder"
msgstr ""
"Indica si la barra lateral incluye un atajo a la carpeta del Escritorio"
#: gtk/gtkplacessidebar.c:4359
#: gtk/gtkplacessidebar.c:4361
msgid "Show “Enter Location”"
msgstr "Mostrar «Introducir ubicación»"
#: gtk/gtkplacessidebar.c:4360
#: gtk/gtkplacessidebar.c:4362
msgid ""
"Whether the sidebar includes a builtin shortcut to manually enter a location"
msgstr ""
"Indica si la barra lateral incluye un atajo integrado para introducir "
"manualmente la ubicación"
#: gtk/gtkplacessidebar.c:4365
#: gtk/gtkplacessidebar.c:4367
msgid "Show “Trash”"
msgstr "Mostrar «Papelera»"
#: gtk/gtkplacessidebar.c:4366
#: gtk/gtkplacessidebar.c:4368
msgid "Whether the sidebar includes a builtin shortcut to the Trash location"
msgstr ""
"Indica si la barra lateral incluye un atajo integrado a la ubicación de la "
"papelera"
#: gtk/gtkplacessidebar.c:4371
#: gtk/gtkplacessidebar.c:4373
msgid "Show “Other locations”"
msgstr "Mostrar «Otras ubicaciones»"
#: gtk/gtkplacessidebar.c:4372
#: gtk/gtkplacessidebar.c:4374
msgid "Whether the sidebar includes an item to show external locations"
msgstr ""
"Indica si la barra lateral incluye un elemento para mostrar ubicaciones "
"externas"
#: gtk/gtkplacessidebar.c:4377
#: gtk/gtkplacessidebar.c:4379
msgid "Show “Starred Location”"
msgstr "Mostrar «Ubicación favorita»"
#: gtk/gtkplacessidebar.c:4378
#: gtk/gtkplacessidebar.c:4380
msgid "Whether the sidebar includes an item to show starred files"
msgstr ""
"Indica si la barra lateral incluye un elemento para mostrar archivos "
"favoritos"
#: gtk/gtkplacesview.c:2236
#: gtk/gtkplacesview.c:2233
msgid "Loading"
msgstr "Cargando"
#: gtk/gtkplacesview.c:2237
#: gtk/gtkplacesview.c:2234
msgid "Whether the view is loading locations"
msgstr "Indica si la vista está cargando las ubicaciones"
#: gtk/gtkplacesview.c:2243
#: gtk/gtkplacesview.c:2240
msgid "Fetching networks"
msgstr "Obteniendo redes"
#: gtk/gtkplacesview.c:2244
#: gtk/gtkplacesview.c:2241
msgid "Whether the view is fetching networks"
msgstr "Indica si la vista está obteniendo redes"
@@ -4495,45 +4494,45 @@ msgstr "El archivo representado por la fila, si hay"
msgid "Whether the row represents a network location"
msgstr "Indica si la fila representa una ubicación de la red"
#: gtk/gtkpopover.c:1623
#: gtk/gtkpopover.c:1689
msgid "Pointing to"
msgstr "Apuntando a"
#: gtk/gtkpopover.c:1624
#: gtk/gtkpopover.c:1690
msgid "Rectangle the bubble window points to"
msgstr "Rectángulo al que la ventana de burbuja apunta"
#: gtk/gtkpopover.c:1631
#: gtk/gtkpopover.c:1697
msgid "Position to place the bubble window"
msgstr "Posición en la que colocar la ventana de burbuja"
#: gtk/gtkpopover.c:1638
#: gtk/gtkpopover.c:1704
msgid "Whether to dismiss the popover on outside clicks"
msgstr ""
"Indica si se debe descartar la ventana emergente en las pulsaciones fuera de "
"área"
#: gtk/gtkpopover.c:1644 gtk/gtkwindow.c:956
#: gtk/gtkpopover.c:1710 gtk/gtkwindow.c:956
msgid "Default widget"
msgstr "Widget predeterminado"
#: gtk/gtkpopover.c:1645 gtk/gtkwindow.c:957
#: gtk/gtkpopover.c:1711 gtk/gtkwindow.c:957
msgid "The default widget"
msgstr "El widget predeterminado"
#: gtk/gtkpopover.c:1651
#: gtk/gtkpopover.c:1717
msgid "Has Arrow"
msgstr "Tiene flecha"
#: gtk/gtkpopover.c:1652
#: gtk/gtkpopover.c:1718
msgid "Whether to draw an arrow"
msgstr "Indica si se debe dibujar una flecha"
#: gtk/gtkpopover.c:1658
#: gtk/gtkpopover.c:1724
msgid "Mnemonics visible"
msgstr "Nemónicos visibles"
#: gtk/gtkpopover.c:1659
#: gtk/gtkpopover.c:1725
msgid "Whether mnemonics are currently visible in this popover"
msgstr ""
"Indica si los nemónicos son visibles actualmente en esta ventana emergente"
@@ -6829,129 +6828,129 @@ msgstr "modelo"
msgid "The model for the popover"
msgstr "El modelo para la ventana emergente"
#: gtk/gtktreeview.c:1043
#: gtk/gtktreeview.c:1045
msgid "TreeView Model"
msgstr "Modelo TreeView"
#: gtk/gtktreeview.c:1044
#: gtk/gtktreeview.c:1046
msgid "The model for the tree view"
msgstr "El modelo para la vista de árbol"
#: gtk/gtktreeview.c:1050
#: gtk/gtktreeview.c:1052
msgid "Headers Visible"
msgstr "Cabeceras visibles"
#: gtk/gtktreeview.c:1051
#: gtk/gtktreeview.c:1053
msgid "Show the column header buttons"
msgstr "Mostrar botones en los encabezados de columna"
#: gtk/gtktreeview.c:1057
#: gtk/gtktreeview.c:1059
msgid "Headers Clickable"
msgstr "Cabeceras pulsables"
#: gtk/gtktreeview.c:1058
#: gtk/gtktreeview.c:1060
msgid "Column headers respond to click events"
msgstr "Las cabeceras de las columnas responden a los eventos de pulsación"
#: gtk/gtktreeview.c:1064
#: gtk/gtktreeview.c:1066
msgid "Expander Column"
msgstr "Columna expansora"
#: gtk/gtktreeview.c:1065
#: gtk/gtktreeview.c:1067
msgid "Set the column for the expander column"
msgstr "Define la columna para la columna expansora"
#: gtk/gtktreeview.c:1078
#: gtk/gtktreeview.c:1080
msgid "Enable Search"
msgstr "Habilitar búsqueda"
#: gtk/gtktreeview.c:1079
#: gtk/gtktreeview.c:1081
msgid "View allows user to search through columns interactively"
msgstr ""
"La vista permite a los usuarios buscar en forma interactiva a través de las "
"columnas"
#: gtk/gtktreeview.c:1085
#: gtk/gtktreeview.c:1087
msgid "Search Column"
msgstr "Columna de búsqueda"
#: gtk/gtktreeview.c:1086
#: gtk/gtktreeview.c:1088
msgid "Model column to search through during interactive search"
msgstr ""
"Columna modelo para buscar a través de ella en una búsqueda interactiva"
#: gtk/gtktreeview.c:1102
#: gtk/gtktreeview.c:1104
msgid "Fixed Height Mode"
msgstr "Modo de altura fija"
#: gtk/gtktreeview.c:1103
#: gtk/gtktreeview.c:1105
msgid "Speeds up GtkTreeView by assuming that all rows have the same height"
msgstr ""
"Acelera GtkTreeView asumiendo que todas las filas tienen la misma altura"
#: gtk/gtktreeview.c:1120
#: gtk/gtktreeview.c:1122
msgid "Hover Selection"
msgstr "Selección al pasar por encima"
#: gtk/gtktreeview.c:1121
#: gtk/gtktreeview.c:1123
msgid "Whether the selection should follow the pointer"
msgstr "Indica si la selección debe seguir al cursor"
#: gtk/gtktreeview.c:1137
#: gtk/gtktreeview.c:1139
msgid "Hover Expand"
msgstr "Expandir al poner el cursor encima"
#: gtk/gtktreeview.c:1138
#: gtk/gtktreeview.c:1140
msgid ""
"Whether rows should be expanded/collapsed when the pointer moves over them"
msgstr ""
"Indica si las filas deben expandirse/contraerse cuando el cursor se mueve "
"sobre ellas"
#: gtk/gtktreeview.c:1149
#: gtk/gtktreeview.c:1151
msgid "Show Expanders"
msgstr "Mostrar expansores"
#: gtk/gtktreeview.c:1150
#: gtk/gtktreeview.c:1152
msgid "View has expanders"
msgstr "La vista tiene expansores"
#: gtk/gtktreeview.c:1161
#: gtk/gtktreeview.c:1163
msgid "Level Indentation"
msgstr "Nivel de sangrado"
#: gtk/gtktreeview.c:1162
#: gtk/gtktreeview.c:1164
msgid "Extra indentation for each level"
msgstr "Sangría extra para cada nivel"
#: gtk/gtktreeview.c:1169
#: gtk/gtktreeview.c:1171
msgid "Rubber Banding"
msgstr "Bandas de goma"
#: gtk/gtktreeview.c:1170
#: gtk/gtktreeview.c:1172
msgid ""
"Whether to enable selection of multiple items by dragging the mouse pointer"
msgstr ""
"Indica si se debe activar la selección de múltiples elementos arrastrando el "
"cursor del ratón"
#: gtk/gtktreeview.c:1176
#: gtk/gtktreeview.c:1178
msgid "Enable Grid Lines"
msgstr "Activar líneas de la rejilla"
#: gtk/gtktreeview.c:1177
#: gtk/gtktreeview.c:1179
msgid "Whether grid lines should be drawn in the tree view"
msgstr "Indica si debe haber un icono cerca del elemento"
#: gtk/gtktreeview.c:1184
#: gtk/gtktreeview.c:1186
msgid "Enable Tree Lines"
msgstr "Activar líneas del árbol"
#: gtk/gtktreeview.c:1185
#: gtk/gtktreeview.c:1187
msgid "Whether tree lines should be drawn in the tree view"
msgstr "Indica si deben dibujar las líneas en la vista del árbol"
#: gtk/gtktreeview.c:1192
#: gtk/gtktreeview.c:1194
msgid "The column in the model containing the tooltip texts for the rows"
msgstr ""
"La columna del modelo que contiene los textos de consejo para las filas"
+525 -529
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -82,6 +82,7 @@ gtk_tests = [
['testscrolledge'],
['testscrolltofocus'],
['testcellarea'],
['testslack'],
['testswitch'],
['testtreepos'],
['testsensitive'],
+1 -1
View File
@@ -6154,7 +6154,7 @@ do_bench (char* what, int num)
}
}
static void G_GNUC_NORETURN
static void
usage (void)
{
fprintf (stderr, "Usage: testgtk [--bench ALL|<bench>[:<count>]]\n");
+271
View File
@@ -0,0 +1,271 @@
#include <gtk/gtk.h>
#define GTK_TYPE_SLACK (gtk_slack_get_type ())
G_DECLARE_FINAL_TYPE (GtkSlack, gtk_slack, GTK, SLACK, GtkWidget)
struct _GtkSlack {
GtkWidget parent;
GtkWidget *child;
gboolean has_width;
gboolean has_height;
int width;
int height;
int hslack;
int vslack;
};
struct _GtkSlackClass {
GtkWidgetClass parent_class;
};
enum {
PROP_HSLACK = 1,
PROP_VSLACK,
LAST_PROP
};
static GParamSpec *props[LAST_PROP];
G_DEFINE_TYPE (GtkSlack, gtk_slack, GTK_TYPE_WIDGET)
static void
gtk_slack_init (GtkSlack *slack)
{
slack->has_width = FALSE;
slack->has_height = FALSE;
slack->hslack = 0;
slack->vslack = 0;
}
static void
gtk_slack_measure (GtkWidget *widget,
GtkOrientation orientation,
gint for_size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline)
{
GtkSlack *slack = GTK_SLACK (widget);
int child_min, child_nat;
if (slack->child && gtk_widget_get_visible (slack->child))
{
gtk_widget_measure (slack->child,
orientation, for_size,
&child_min, &child_nat,
NULL, NULL);
}
else
{
child_min = 0;
child_nat = 0;
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (!slack->has_width)
{
slack->width = child_nat + slack->hslack;
slack->has_width = TRUE;
}
else if (abs (slack->width - child_nat) > slack->hslack)
{
slack->width = child_nat + slack->hslack;
}
else
{
slack->width = MAX (slack->width, child_min);
}
*minimum = child_min;
*natural = slack->width;
}
else
{
if (!slack->has_height)
{
slack->height = child_nat + slack->vslack;
slack->has_height = TRUE;
}
else if(abs (slack->height - child_nat) > slack->vslack)
{
slack->height = child_nat + slack->vslack;
}
else
{
slack->height = MAX (slack->height, child_min);
}
*minimum = child_min;
*natural = slack->height;
}
}
static void
gtk_slack_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkSlack *slack = GTK_SLACK (widget);
GtkAllocation allocation;
allocation.x = 0;
allocation.y = 0;
allocation.width = width;
allocation.height = height;
gtk_widget_size_allocate (slack->child, &allocation, -1);
}
static void
gtk_slack_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkSlack *slack = GTK_SLACK (object);
switch (prop_id)
{
case PROP_HSLACK:
if (slack->hslack != g_value_get_int (value))
{
slack->hslack = g_value_get_int (value);
slack->has_width = FALSE;
gtk_widget_queue_resize (GTK_WIDGET (slack));
}
break;
case PROP_VSLACK:
if (slack->vslack != g_value_get_int (value))
{
slack->vslack = g_value_get_int (value);
slack->has_height = FALSE;
gtk_widget_queue_resize (GTK_WIDGET (slack));
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_slack_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkSlack *slack = GTK_SLACK (object);
switch (prop_id)
{
case PROP_HSLACK:
g_value_set_int (value, slack->hslack);
break;
case PROP_VSLACK:
g_value_set_int (value, slack->vslack);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_slack_class_init (GtkSlackClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
gobject_class->get_property = gtk_slack_get_property;
gobject_class->set_property = gtk_slack_set_property;
widget_class->measure = gtk_slack_measure;
widget_class->size_allocate = gtk_slack_size_allocate;
props[PROP_HSLACK] =
g_param_spec_int ("hslack", "Horizontal Slack", "Horizontal Slack",
0, 100, 0,
G_PARAM_READWRITE);
props[PROP_VSLACK] =
g_param_spec_int ("vslack", "Vertical Slack", "Vertical Slack",
0, 100, 0,
G_PARAM_READWRITE);
g_object_class_install_properties (gobject_class, LAST_PROP, props);
gtk_widget_class_set_css_name (widget_class, "slack");
}
static GtkWidget *
gtk_slack_new (void)
{
return g_object_new (GTK_TYPE_SLACK, NULL);
}
static void
gtk_slack_set_child (GtkSlack *slack,
GtkWidget *widget)
{
slack->child = widget;
gtk_widget_set_parent (widget, GTK_WIDGET (slack));
}
static gboolean
close_cb (GtkWindow *window, gpointer data)
{
*((gboolean *)data) = TRUE;
g_main_context_wakeup (NULL);
return TRUE;
}
static const char css[] =
"window {"
" background: blue; "
"}"
".label {"
" background: yellow;"
"}";
int
main (int argc, char *argv[])
{
gboolean done = FALSE;
GtkWidget *window;
GtkWidget *slack;
GtkWidget *label;
GtkCssProvider *provider;
gtk_init ();
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
window = gtk_window_new ();
g_signal_connect (window, "close-request", G_CALLBACK (close_cb), &done);
slack = gtk_slack_new ();
gtk_widget_set_halign (slack, GTK_ALIGN_CENTER);
gtk_widget_set_valign (slack, GTK_ALIGN_CENTER);
gtk_window_set_child (GTK_WINDOW (window), slack);
label = gtk_label_new ("Test");
gtk_widget_add_css_class (label, "label");
gtk_slack_set_child (GTK_SLACK (slack), label);
gtk_window_present (GTK_WINDOW (window));
while (!done)
g_main_context_iteration (NULL, TRUE);
gtk_window_destroy (GTK_WINDOW (window));
}
+1 -1
View File
@@ -108,7 +108,7 @@ parent_notify (AtkObject *obj, GParamSpec *pspec, SignalData *data)
data->parent = atk_object_get_parent (obj);
}
static gboolean
gboolean
do_create_child (STATE *state, gint i)
{
if (GTK_IS_ENTRY (state->widget))
-3
View File
@@ -28,8 +28,6 @@
typedef GtkButtonAccessible MyButtonAccessible;
typedef GtkButtonAccessibleClass MyButtonAccessibleClass;
GType my_button_accessible_get_type (void);
G_DEFINE_TYPE (MyButtonAccessible, my_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE)
static void
@@ -45,7 +43,6 @@ my_button_accessible_class_init (MyButtonAccessibleClass *class)
typedef GtkButton MyButton;
typedef GtkButtonClass MyButtonClass;
GType my_button_get_type (void);
G_DEFINE_TYPE (MyButton, my_button, GTK_TYPE_BUTTON)
static void
-1
View File
@@ -78,7 +78,6 @@ foreach t: a11y_tests
test (t,
executable (t, '@0@.c'.format(t),
install: get_option('install-tests'),
c_args: common_cflags,
install_dir: testexecdir,
dependencies: libgtk_dep),
args: [ '--tap', '-k', ],
+1 -1
View File
@@ -216,7 +216,7 @@ quit_loop (gpointer data)
}
static void
process_pending_idles (void)
process_pending_idles ()
{
GMainLoop *loop = g_main_loop_new (NULL, FALSE);
g_idle_add (quit_loop, loop);
+1
View File
@@ -23,6 +23,7 @@ test_data = [
'test2.css', 'test2.ui', 'test2.nodes',
'test3.css', 'test3.ui', 'test3.nodes',
'test4.css', 'test4.ui', 'test4.nodes',
'test5.css', 'test5.ui', 'test5.nodes',
]
if get_option('install-tests')
+1
View File
@@ -1,4 +1,5 @@
window.background:dir(ltr)
decoration:dir(ltr)
box.horizontal:dir(ltr) name
label:dir(ltr) name
label.test:dir(ltr) name
+1
View File
@@ -1,4 +1,5 @@
window.background:dir(ltr)
decoration:dir(ltr)
box#box.horizontal.test:dir(ltr) name
label:dir(ltr) name
label.a:dir(ltr) class|name|disabled
+1
View File
@@ -1,4 +1,5 @@
window.background:dir(ltr)
decoration:dir(ltr)
box.horizontal:dir(ltr) name
label:dir(ltr) name|state|hover|disabled|backdrop
label.test:dir(ltr) name|state|hover|disabled|backdrop
+1
View File
@@ -1,4 +1,5 @@
window.background:dir(ltr)
decoration:dir(ltr)
box.horizontal:dir(ltr) name
label.a:dir(ltr) class|name|hover
label.b:dir(ltr) class|name|hover|backdrop
+1
View File
@@ -1,4 +1,5 @@
window.background:dir(ltr)
decoration:dir(ltr)
box.horizontal:dir(ltr)
label#label1:dir(ltr)
label#label2:dir(ltr)
+1
View File
@@ -1,4 +1,5 @@
window.background:dir(rtl)
decoration:dir(rtl)
box.horizontal:dir(rtl)
label#label1:dir(rtl)
label#label2:dir(rtl)
+1
View File
@@ -1,4 +1,5 @@
window.background:dir(ltr)
decoration:dir(ltr)
grid.horizontal:dir(ltr)
button.text-button.toggle:dir(ltr):checked
label:dir(ltr)
@@ -1,4 +1,5 @@
window.background:dir(ltr)
decoration:dir(ltr)
box.vertical:dir(ltr)
checkbutton:dir(ltr)
check:dir(ltr)
@@ -1,4 +1,5 @@
window.background:dir(rtl)
decoration:dir(rtl)
box.vertical:dir(rtl)
checkbutton:dir(rtl)
check:dir(rtl)
+1
View File
@@ -1,4 +1,5 @@
window.background:dir(ltr)
decoration:dir(ltr)
box.horizontal:dir(ltr)
combobox:dir(ltr)
box.horizontal.linked:dir(ltr)
+1
View File
@@ -1,4 +1,5 @@
window.background:dir(ltr)
decoration:dir(ltr)
box.horizontal:dir(ltr)
label:dir(ltr)
label:dir(ltr)

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