gtk4.git
7 years agobroadway: Add and use GdkBroadwayDrawContext
Alexander Larsson [Tue, 24 Apr 2018 13:39:53 +0000 (15:39 +0200)]
broadway: Add and use GdkBroadwayDrawContext

7 years agobroadway: Add basic GdkCairoContext implementation
Alexander Larsson [Tue, 24 Apr 2018 12:31:49 +0000 (14:31 +0200)]
broadway: Add basic GdkCairoContext implementation

7 years agobroadway: Call _gdk_surface_update_size when resizing surface
Alexander Larsson [Tue, 24 Apr 2018 12:31:24 +0000 (14:31 +0200)]
broadway: Call _gdk_surface_update_size when resizing surface

7 years agodrawcontext: Only pass the region that matters
Benjamin Otte [Mon, 23 Apr 2018 21:26:14 +0000 (23:26 +0200)]
drawcontext: Only pass the region that matters

We used to pass 2 regions to GdkDrawCotnext.end_frame() but code was
confusing what they meant. So we now don't do that anymore and only pass
the region that matters: The frame region.

7 years agodrawcontext: Add gdk_draw_context_in_frame() API
Benjamin Otte [Mon, 23 Apr 2018 16:24:29 +0000 (18:24 +0200)]
drawcontext: Add gdk_draw_context_in_frame() API

This makes the previous gdk_draw_context_is_drawing() function public
under a new name.

I decided against the old name because we use the term "frame" for a
drawing operation, so I wanted to have this boolean flag reuse the term.

7 years agodrawcontext: Move variable into private struct
Benjamin Otte [Mon, 23 Apr 2018 16:17:29 +0000 (18:17 +0200)]
drawcontext: Move variable into private struct

... and get rid of duplicate variable in the process.

7 years agogdk: Move begin/end_frame() functions
Benjamin Otte [Mon, 23 Apr 2018 15:28:55 +0000 (17:28 +0200)]
gdk: Move begin/end_frame() functions

As they require a draw context and the draw context is already bound to
the surface, it makes much more sense and reduces abiguity by moving
these APIs to the draw context.

As a side effect, we simplify GdkSurface APIs to a point where
GdkSurface now does not concern itself with drawing anymore at all,
apart from being the object that creates draw contexts.

7 years agogdk: Get rid of GdkDrawingContext
Benjamin Otte [Fri, 20 Apr 2018 23:22:19 +0000 (01:22 +0200)]
gdk: Get rid of GdkDrawingContext

All information is kept in GdkDrawContext these days, so use that one.

7 years agogdk: Get rid of gdk_drawing_context_get_clip()
Benjamin Otte [Fri, 20 Apr 2018 22:58:53 +0000 (00:58 +0200)]
gdk: Get rid of gdk_drawing_context_get_clip()

Use the identical gdk_draw_context_get_frame_region() instead.

7 years agogdk: Add gdk_draw_context_get_frame_region()
Benjamin Otte [Fri, 20 Apr 2018 22:47:35 +0000 (00:47 +0200)]
gdk: Add gdk_draw_context_get_frame_region()

This does the same as gdk_drawing_context_get_clip().

7 years agogdk: Remove gdk_gl_context_get_damage()
Benjamin Otte [Fri, 20 Apr 2018 15:04:36 +0000 (17:04 +0200)]
gdk: Remove gdk_gl_context_get_damage()

Remove it only form public API, because we still use the vfunc to figure
out the damage area in begin_frame().

7 years agogsk: Refactor damage computation for GL renderer
Benjamin Otte [Fri, 20 Apr 2018 14:07:34 +0000 (16:07 +0200)]
gsk: Refactor damage computation for GL renderer

Previously, we got the damage, then computed the changed area, then
started a frame with that changed area.

But starting a frame computes the damage for us.

So now we start a frame, then get the damage area from that, then
compute the change area.

7 years agowayland: Rewrite Cairo rendering
Benjamin Otte [Tue, 17 Apr 2018 21:05:41 +0000 (23:05 +0200)]
wayland: Rewrite Cairo rendering

Also, split it into its own file - which was the original reason for
looking at this code, the rewrite was an unintentional side effect.

This changes the context to create surfaces on demand.
So whenever the compositor holds onto a surface while GDK wants to
render, it just creates a new surface. If the compositor releases
surfaces, we will retain one for the next frame to be rendered, but free
all extra ones.
This way, we should get to a stage where we have exactly as many
surfaces as needed and never allocate/free any.

7 years agox11: Move implementation of Cairo context backends
Benjamin Otte [Sat, 14 Apr 2018 00:29:23 +0000 (02:29 +0200)]
x11: Move implementation of Cairo context backends

Also, don't implement SurfaceClass.ref_cairo_surface() anymore. This
means calls to it will crash now. But as they only happen in the generic
GdkCairoContext implementation, we shouldn't be affected by that.

Plus, once all backends have been ported, that call is going away
anyway.

7 years agosurface: Merge function into only caller
Benjamin Otte [Sun, 15 Apr 2018 16:42:23 +0000 (18:42 +0200)]
surface: Merge function into only caller

7 years agogdk: Remove GDK_DEBUG=cairo-image
Benjamin Otte [Sat, 14 Apr 2018 20:45:33 +0000 (22:45 +0200)]
gdk: Remove GDK_DEBUG=cairo-image

This is the default now - at least until cairo rendering gets split
into backends.

7 years agosurface: Fold function into only user
Benjamin Otte [Sat, 14 Apr 2018 20:35:46 +0000 (22:35 +0200)]
surface: Fold function into only user

7 years agocairocontext: Turn cairo_create() function into a vfunc
Benjamin Otte [Sat, 14 Apr 2018 00:17:47 +0000 (02:17 +0200)]
cairocontext: Turn cairo_create() function into a vfunc

7 years agogdk: Remove unused GL setting
Benjamin Otte [Sat, 14 Apr 2018 00:10:36 +0000 (02:10 +0200)]
gdk: Remove unused GL setting

7 years agogdk: Add Cairo context implementations for all backends
Benjamin Otte [Thu, 12 Apr 2018 14:48:31 +0000 (16:48 +0200)]
gdk: Add Cairo context implementations for all backends

And make the GdkCairoContext as abstract.

The idea of this and thje following commits is to get rid of all
Cairo code in gdksurface.c (and $backend/gdksurface-$backend.c)
by moving that code into the Cairo context files.
In particular, the GdkSurfaceClass.begin_frame/end_frame()
functions (which are currently exclusively used by the Cairo code
should end up being moved to GdkDrawContextClass.begin/end_frame().

This has multiple benefits:

1. It unifies code between the different drawing contexts.
   GL lives in GLContext, Vulkan in VulkanContext and Cairo in
   CairoContext. In turn, this makes it way easier to reason about
   what's going on in surface-specific code. Currently pretty much
   all backends do things wrong when they want to sync to drawing
   or to the frame clock.

2. It makes the API of GdkSurface smaller. No drawing code (apart
   from creating the contexts) needs to remain.

3. It confines Cairo to the Drawcontext, thereby making it way
   more obvious when backends are still using it in situations
   where it may now conflict with OpenGL (like when doing the dnd
   failed animation or in the APIs that I'm removing in this
   branch).

4. We have 2 very different types of Cairo contexts: The X/win32
   model, where we have a natively supported Cairo backend but do
   double buffering ourselves and use similar surfaces and the
   Wayland/Broadway model where we use image surfaces without any
   Cairo backend support and have to submit the buffers manually.
   By not sharing code between those 2 versions, we can make the
   actual code way smaller. We also get around the need to create
   1x1 image surfaces in the Wayland backend where we pretend
   there's a native Cairo surface.

7 years agocairocontext: Move a function
Benjamin Otte [Thu, 12 Apr 2018 00:10:22 +0000 (02:10 +0200)]
cairocontext: Move a function

A function of GdkDrawingContext is only used when drawing with Cairo, so
move it to GdkCairoContext.

7 years agogdk: Move Cairo code from surface to CairoContext
Benjamin Otte [Wed, 11 Apr 2018 22:32:53 +0000 (00:32 +0200)]
gdk: Move Cairo code from surface to CairoContext

This just moves code, no actual changes to functionality are happening.

7 years agogdk: Add GdkCairoContext
Benjamin Otte [Wed, 11 Apr 2018 22:16:43 +0000 (00:16 +0200)]
gdk: Add GdkCairoContext

This does nothing but disallow passing NULL to gdk_surface_begin_paint()
and instead require this context.

The ultimate goal is to split out Cairo drawing into its own source file
so it doesn't clutter up the generic rendering path.

7 years agogtk-demo: Merge widgetbowl into fishbowl
Benjamin Otte [Tue, 24 Apr 2018 19:32:36 +0000 (21:32 +0200)]
gtk-demo: Merge widgetbowl into fishbowl

7 years agodemo: Clean up GtkFishbowl widget
Benjamin Otte [Tue, 24 Apr 2018 18:32:57 +0000 (20:32 +0200)]
demo: Clean up GtkFishbowl widget

1. Remove set_icons property
2. Make it a GtkWidget subclass
3. Add gtk_fishbowl_set_creation_func()
4. Make the widgetbowl use the new benchmarking infrastructure of the
   fishbowl

7 years agodemo: Move benchmarking implementation to fishbowl widget
Benjamin Otte [Tue, 24 Apr 2018 17:04:44 +0000 (19:04 +0200)]
demo: Move benchmarking implementation to fishbowl widget

7 years agoUpdate Esperanto translation
Kristjan SCHMIDT [Tue, 24 Apr 2018 19:17:30 +0000 (19:17 +0000)]
Update Esperanto translation

7 years agotestentrycompletion: Use the model we already got
Daniel Boles [Tue, 24 Apr 2018 12:40:02 +0000 (13:40 +0100)]
testentrycompletion: Use the model we already got

cherry-pick of gtk-3-22 commit af350b20b1c396ec55ca6a71eab23fdca6ffb784

7 years agoUpdate Russian translation
Stas Solovey [Tue, 24 Apr 2018 10:32:36 +0000 (10:32 +0000)]
Update Russian translation

7 years agosnapshot: Get rid of record_nodes flag
Benjamin Otte [Tue, 24 Apr 2018 02:02:55 +0000 (04:02 +0200)]
snapshot: Get rid of record_nodes flag

Instead, use GTK_DEBUG=snapshot for it.

7 years agorendernode: Remove gsk_render_node_set_name()
Benjamin Otte [Tue, 24 Apr 2018 01:46:44 +0000 (03:46 +0200)]
rendernode: Remove gsk_render_node_set_name()

And of course, gsk_render_node_get_name() is gone, too.
The replacement is of course debug nodes.

As a side effect, GskRenderNode is now *really* immutable.

7 years agosnapshot: Redo debug messages
Benjamin Otte [Tue, 24 Apr 2018 01:17:23 +0000 (03:17 +0200)]
snapshot: Redo debug messages

Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.

7 years agogsk: Add GskDebugNode
Benjamin Otte [Mon, 23 Apr 2018 22:41:48 +0000 (00:41 +0200)]
gsk: Add GskDebugNode

7 years agoMerge branch 'wip/matthiasc/emoji-picker' into 'master'
Matthias Clasen [Tue, 24 Apr 2018 00:38:20 +0000 (00:38 +0000)]
Merge branch 'wip/matthiasc/emoji-picker' into 'master'

Wip/matthiasc/emoji picker

See merge request GNOME/gtk!115

7 years agoDrop Ctrl-Shift-e support
Matthias Clasen [Mon, 23 Apr 2018 04:29:21 +0000 (00:29 -0400)]
Drop Ctrl-Shift-e support

Now that we have Emoji completion, drop the rather limited
Ctrl-Shift-e support in GtkIMContextSimple, and leave this
sequence to input methods.

7 years agowidget-factory: add emoji completion to an entry
Matthias Clasen [Tue, 15 Aug 2017 21:35:03 +0000 (17:35 -0400)]
widget-factory: add emoji completion to an entry

7 years agoentry: Add emoji completion
Matthias Clasen [Sat, 19 Aug 2017 18:08:15 +0000 (14:08 -0400)]
entry: Add emoji completion

Pop up completions when the text in the entry matches :word:
This functionality has to be enabled using the enable-emoji-completion
property.

7 years agoAdd an emoji completion popup
Matthias Clasen [Sat, 19 Aug 2017 18:06:47 +0000 (14:06 -0400)]
Add an emoji completion popup

This widget provides entry completion-like functionality
for Emoji codes like :grin: or :kiss:.

7 years agoExport some entry functions privately
Matthias Clasen [Sat, 19 Aug 2017 18:07:59 +0000 (14:07 -0400)]
Export some entry functions privately

This will be used in the following commits.

7 years agowayland: Allow a NULL inhibitors hash table
Emmanuele Bassi [Mon, 23 Apr 2018 09:57:07 +0000 (10:57 +0100)]
wayland: Allow a NULL inhibitors hash table

The shortcuts inhibitors hash table is created when we create a
GdkWaylandWindow implementation for a GdkWindow, and it's destroyed once
we finalize the instance. The fake "root" window we create for the
Wayland display does not have a backing native window, so the shortcuts
inhibitors hash table is set to NULL; this causes a critical error
message when calling g_hash_table_destroy() on it. The finalization of
the root window happens when we close a display connection.

We should use g_clear_pointer(), instead, as it's NULL safe.

Without this change, the displayclose test fails, as all warnings are
considered fatal.

7 years agogtk-demo, testgtk: Don't pass an integer to fabs
Ting-Wei Lan [Sun, 22 Apr 2018 13:51:36 +0000 (21:51 +0800)]
gtk-demo, testgtk: Don't pass an integer to fabs

It looks like a mistake which compilers are likely to warn.

7 years agoimcontextxim: Don't assign a variable to itself
Ting-Wei Lan [Sun, 22 Apr 2018 13:48:35 +0000 (21:48 +0800)]
imcontextxim: Don't assign a variable to itself

This causes clang to show warnings.

7 years agoFix header guards
Ting-Wei Lan [Sun, 22 Apr 2018 13:45:19 +0000 (21:45 +0800)]
Fix header guards

They were found by clang.

7 years agobuild: Use cc.links to check linker arguments
Ting-Wei Lan [Sun, 22 Apr 2018 13:42:03 +0000 (21:42 +0800)]
build: Use cc.links to check linker arguments

Instead of hard-coding linker flags for a specific operating system and
a specific compiler, we can should cc.links to test them, so they can be
used on more operating systems and compilers.

7 years agobuild: Make the default setting work on non-Linux Unix-like systems
Ting-Wei Lan [Sun, 22 Apr 2018 12:47:32 +0000 (20:47 +0800)]
build: Make the default setting work on non-Linux Unix-like systems

All of the four platform-dependent backends are enabled by default. It
is usually a good default because it requires users to explicitly choose
backends they want to use. Rules in meson.build also automatically
disable unavailable backends for macOS, Windows, Linux, so users on
these 3 major platforms don't have to manually disable things when
running meson commands.

However, meson.build doesn't do the same thing for other Unix-like
systems, which is acceptable but not ideal. To make it easier to build
GTK+ on these systems, the Linux case, which enables X11 and Wayland and
disables Win32 and Quartz, is made the default for all operating systems
that are not Windows or macOS.

This commit also changes most 'host_machine.system()' calls to os_*
variables, which are easier to read and less likely to be used wrongly.

7 years agoUpdate Spanish translation
Daniel Mustieles [Mon, 23 Apr 2018 14:18:20 +0000 (14:18 +0000)]
Update Spanish translation

7 years agowayland: Allow a NULL inhibitors hash table
Emmanuele Bassi [Mon, 23 Apr 2018 09:57:07 +0000 (10:57 +0100)]
wayland: Allow a NULL inhibitors hash table

The shortcuts inhibitors hash table is created when we create a
GdkWaylandWindow implementation for a GdkWindow, and it's destroyed once
we finalize the instance. The fake "root" window we create for the
Wayland display does not have a backing native window, so the shortcuts
inhibitors hash table is set to NULL; this causes a critical error
message when calling g_hash_table_destroy() on it. The finalization of
the root window happens when we close a display connection.

We should use g_clear_pointer(), instead, as it's NULL safe.

Without this change, the displayclose test fails, as all warnings are
considered fatal.

7 years agoMerge branch 'wip/lantw/improve-freebsd-build-and-fix-warnings' into 'master'
Matthias Clasen [Mon, 23 Apr 2018 02:40:00 +0000 (02:40 +0000)]
Merge branch 'wip/lantw/improve-freebsd-build-and-fix-warnings' into 'master'

Improve meson.build for FreeBSD and reduce the number of warnings during compilation

See merge request GNOME/gtk!123

7 years agoWidget: Add missing space in new warning
Daniel Boles [Sun, 22 Apr 2018 22:12:18 +0000 (23:12 +0100)]
Widget: Add missing space in new warning

7 years agothemes: Fix a new comment
Daniel Boles [Sun, 22 Apr 2018 21:20:57 +0000 (22:20 +0100)]
themes: Fix a new comment

bah.

7 years agothemes: Fix swapped borders on RTL PathBar buttons
Daniel Boles [Sun, 22 Apr 2018 20:45:18 +0000 (21:45 +0100)]
themes: Fix swapped borders on RTL PathBar buttons

.linked assumes the container is a GtkBox, which is documented as never
flipping children in RTL, so :first-child is always the left child, etc.
GtkBox does that by reordering its CSS nodes when the direction changes.

But most widgets don’t do that, so :first|last-child are 1st/last ADDED
and swap sides in RTL. GtkPathBar is so, and ignoring that in our themes
meant that in RTL, its left/right buttons got each other’s borders. Yuk!

This patch adds the groundwork for supporting widgets like that, via the
%linked_flippable placeholder, and applies that to override buttons in
  filechooser .path-bar.linked > button
so that the correct borders get applied to those buttons when using RTL.

Note that I select only PathBars within a FileChooser because we also
have NautilusPathBar, which also uses widget.path-bar – but *does* flip
its nodes for RTL already, so letting that get affected broke it again!

https://bugzilla.gnome.org/show_bug.cgi?id=772817

7 years agoCheckMenuItem: Fix insert_after|before() here too
Daniel Boles [Sun, 22 Apr 2018 20:22:45 +0000 (21:22 +0100)]
CheckMenuItem: Fix insert_after|before() here too

See the previous commit.

There may be other cases of these being swapped by Gadget conversions,
but hopefully someone else will find and fix those before I have to…

Close https://gitlab.gnome.org/GNOME/gtk/issues/200

7 years agoMenuItem: Fix broken args to insert_before|after()
Daniel Boles [Sun, 22 Apr 2018 20:17:29 +0000 (21:17 +0100)]
MenuItem: Fix broken args to insert_before|after()

The widget & its parent were swapped to each other’s place in the calls.

https://gitlab.gnome.org/GNOME/gtk/issues/200

7 years agoWidget: Show widget name/addrs if fail to reparent
Daniel Boles [Sun, 22 Apr 2018 20:17:24 +0000 (21:17 +0100)]
Widget: Show widget name/addrs if fail to reparent

so we can more easily get an idea of where the problematic code is

https://gitlab.gnome.org/GNOME/gtk/issues/200

7 years agoWidget: Trivially fix arg name in non-doc comment
Daniel Boles [Sun, 22 Apr 2018 20:07:50 +0000 (21:07 +0100)]
Widget: Trivially fix arg name in non-doc comment

7 years agoMenuButton: popover connects to menu_deactivate_cb
Daniel Boles [Sun, 22 Apr 2018 15:25:54 +0000 (16:25 +0100)]
MenuButton: popover connects to menu_deactivate_cb

This was missed (even before my recent patches).

https://gitlab.gnome.org/GNOME/gtk/issues/199

7 years agoMenuButton: Disconnect newly added signal handler
Daniel Boles [Sun, 22 Apr 2018 15:25:07 +0000 (16:25 +0100)]
MenuButton: Disconnect newly added signal handler

Otherwise, we do stuff we shouldn't, as the failing pipeline showed:
https://gitlab.gnome.org/GNOME/gtk/pipelines/9431

https://gitlab.gnome.org/GNOME/gtk/issues/199

7 years agoMenuButton: Clarify NULL popup/over/menu/model doc
Daniel Boles [Sun, 22 Apr 2018 15:02:55 +0000 (16:02 +0100)]
MenuButton: Clarify NULL popup/over/menu/model doc

7 years agoMenuButton: Drop ref to Popover on its ::destroy
Daniel Boles [Sun, 22 Apr 2018 13:52:27 +0000 (14:52 +0100)]
MenuButton: Drop ref to Popover on its ::destroy

Otherwise, if the Popover is destroyed before the MenuButton, the latter
still had a non-NULL but invalid instance and tried to use it in dispose

Close https://gitlab.gnome.org/GNOME/gtk/issues/199

7 years agoEntry: Show optional style classes in node diagram
Daniel Boles [Wed, 18 Apr 2018 23:50:50 +0000 (00:50 +0100)]
Entry: Show optional style classes in node diagram

7 years agoa11y/ScrolledWin|IconView: Connect signals safely
Juan Pablo Ugarte [Thu, 19 Oct 2017 18:16:43 +0000 (15:16 -0300)]
a11y/ScrolledWin|IconView: Connect signals safely

Use g_signal_connect_data() instead of g_signal_connect_object()
to make sure the callback gets disconnected when the data object
is destroyed. This avoids problems in garbage-collected bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=789215

7 years agoUpdate Polish translation
Piotr Drąg [Sun, 22 Apr 2018 14:13:56 +0000 (16:13 +0200)]
Update Polish translation

7 years agogtk-demo, testgtk: Don't pass an integer to fabs
Ting-Wei Lan [Sun, 22 Apr 2018 13:51:36 +0000 (21:51 +0800)]
gtk-demo, testgtk: Don't pass an integer to fabs

It looks like a mistake which compilers are likely to warn.

7 years agoimcontextxim: Don't assign a variable to itself
Ting-Wei Lan [Sun, 22 Apr 2018 13:48:35 +0000 (21:48 +0800)]
imcontextxim: Don't assign a variable to itself

This causes clang to show warnings.

7 years agoFix header guards
Ting-Wei Lan [Sun, 22 Apr 2018 13:45:19 +0000 (21:45 +0800)]
Fix header guards

They were found by clang.

7 years agobuild: Use cc.links to check linker arguments
Ting-Wei Lan [Sun, 22 Apr 2018 13:42:03 +0000 (21:42 +0800)]
build: Use cc.links to check linker arguments

Instead of hard-coding linker flags for a specific operating system and
a specific compiler, we can should cc.links to test them, so they can be
used on more operating systems and compilers.

7 years agobuild: Make the default setting work on non-Linux Unix-like systems
Ting-Wei Lan [Sun, 22 Apr 2018 12:47:32 +0000 (20:47 +0800)]
build: Make the default setting work on non-Linux Unix-like systems

All of the four platform-dependent backends are enabled by default. It
is usually a good default because it requires users to explicitly choose
backends they want to use. Rules in meson.build also automatically
disable unavailable backends for macOS, Windows, Linux, so users on
these 3 major platforms don't have to manually disable things when
running meson commands.

However, meson.build doesn't do the same thing for other Unix-like
systems, which is acceptable but not ideal. To make it easier to build
GTK+ on these systems, the Linux case, which enables X11 and Wayland and
disables Win32 and Quartz, is made the default for all operating systems
that are not Windows or macOS.

This commit also changes most 'host_machine.system()' calls to os_*
variables, which are easier to read and less likely to be used wrongly.

7 years agowidget: Position changes don't require a redraw
Benjamin Otte [Sun, 22 Apr 2018 00:46:00 +0000 (02:46 +0200)]
widget: Position changes don't require a redraw

Well, they don't require a redraw of the widget, because the widget
itself didn't change.
They require a redraw of the parent, because that now displays the
widget in a different position.

And this means we can keep the cache of the widget's render node.

My fishbowl numbers are through the roof^W water surface. Vulkan gets
4000 now.

7 years agodemo: Don't add more icons all the time
Benjamin Otte [Sun, 22 Apr 2018 00:45:11 +0000 (02:45 +0200)]
demo: Don't add more icons all the time

If adding new icons takes longer than a second, the frame clock should
run before we add even more icons...

7 years agobuild: Remove 'name' kwarg from has_function calls
Timm Bäder [Sat, 21 Apr 2018 17:30:12 +0000 (19:30 +0200)]
build: Remove 'name' kwarg from has_function calls

They cause warnings with later meson versions.

7 years agobuild: Fix copy/paste error
Timm Bäder [Sat, 21 Apr 2018 17:24:25 +0000 (19:24 +0200)]
build: Fix copy/paste error

7 years agoAlways use #ifdef for G_ENABLE_DEBUG
Timm Bäder [Sat, 21 Apr 2018 17:18:20 +0000 (19:18 +0200)]
Always use #ifdef for G_ENABLE_DEBUG

Release builds don't define it to 0, they just don't define it. Avoid
the compilation warning we get otherwise.

7 years agosizerequestcache: Directly initialize some locals
Timm Bäder [Sat, 21 Apr 2018 17:01:06 +0000 (19:01 +0200)]
sizerequestcache: Directly initialize some locals

Declaring them and initializing them in the same block of code without
an empty line in between is really just confusing.

7 years agoUse inlined gtk_widget_get_display version in a few places
Timm Bäder [Sat, 21 Apr 2018 15:04:41 +0000 (17:04 +0200)]
Use inlined gtk_widget_get_display version in a few places

We can safely do this whenever we already made sure that the given
pointer is a valid GtkWidget.

7 years agowidget: Add static inline version of gtk_widget_display()
Timm Bäder [Sat, 21 Apr 2018 15:03:31 +0000 (17:03 +0200)]
widget: Add static inline version of gtk_widget_display()

Due to the few type checks in gtk_widget_get_display(), it was the
slowest part of a call to gtk_widget_query_size_for_orientation if the
in case of a cache hit.

7 years agotextview: Remove handling_key_event flag
Timm Bäder [Sat, 21 Apr 2018 13:45:47 +0000 (15:45 +0200)]
textview: Remove handling_key_event flag

It's not used anymore.

7 years agogsk: Make gsk_text_node_new_with_bounds private
Timm Bäder [Sat, 21 Apr 2018 09:20:15 +0000 (11:20 +0200)]
gsk: Make gsk_text_node_new_with_bounds private

We pulled out the bounds calculation for performance reasons, but the
caller can't know how to properly compute them. Inside gtk+, we can do
that but it's not good enough for public API.

7 years agogl renderer: Rename texture_id parameter to fbo_id
Timm Bäder [Sat, 21 Apr 2018 08:13:16 +0000 (10:13 +0200)]
gl renderer: Rename texture_id parameter to fbo_id

So this makes sense again.

7 years agowidget: Use get_instance_private more often
Timm Bäder [Sat, 21 Apr 2018 08:05:39 +0000 (10:05 +0200)]
widget: Use get_instance_private more often

To be more consistent with newer code. We can also save a few lines here
and there by pulling the priv initialization before the precondition
checks.

7 years agosizerequestcache: Constify some locals
Timm Bäder [Sat, 21 Apr 2018 07:33:48 +0000 (09:33 +0200)]
sizerequestcache: Constify some locals

Make it clear that we only use them for lookups here.

7 years agosizerequestcache: Use int instead of gint
Timm Bäder [Sat, 21 Apr 2018 07:22:59 +0000 (09:22 +0200)]
sizerequestcache: Use int instead of gint

7 years agosizerequest: Pull locals in closest scope
Timm Bäder [Sat, 21 Apr 2018 07:14:48 +0000 (09:14 +0200)]
sizerequest: Pull locals in closest scope

7 years agosnapshot: Fix some documentation problems
Timm Bäder [Fri, 20 Apr 2018 18:35:00 +0000 (20:35 +0200)]
snapshot: Fix some documentation problems

7 years agoviewport: Remove useless import
Timm Bäder [Sun, 15 Apr 2018 19:16:12 +0000 (21:16 +0200)]
viewport: Remove useless import

Just a debugging remnant

7 years agoviewport: Remove outdated comment
Timm Bäder [Sun, 15 Apr 2018 18:57:58 +0000 (20:57 +0200)]
viewport: Remove outdated comment

7 years agogl renderer: Fix fallback node scaling
Timm Bäder [Sun, 15 Apr 2018 16:20:52 +0000 (18:20 +0200)]
gl renderer: Fix fallback node scaling

7 years agoMerge branch 'print-deserialize' into 'master'
Matthias Clasen [Fri, 20 Apr 2018 21:37:13 +0000 (21:37 +0000)]
Merge branch 'print-deserialize' into 'master'

printing: Be more careful when deserializing

See merge request GNOME/gtk!121

7 years agoprinting: Be more careful when deserializing
Matthias Clasen [Fri, 20 Apr 2018 20:56:28 +0000 (16:56 -0400)]
printing: Be more careful when deserializing

The GVariant we are getting here might not be coming
from GTK+, but rather from some other source. Best to
be forgiving and deal with missing data without crashing.

This was causing the GTK+ portal backends to crash on
print requests from Qt.

7 years agoUpdated Spanish translation
Daniel Mustieles [Fri, 20 Apr 2018 09:42:22 +0000 (11:42 +0200)]
Updated Spanish translation

7 years agoRevert "Update Spanish translation"
Daniel Mustieles [Thu, 19 Apr 2018 14:13:15 +0000 (16:13 +0200)]
Revert "Update Spanish translation"

This reverts commit 8570d33e08a72abf9004a92784663a3aeba86c00.

7 years agostack: protect set_visible_child_name from NULL stack
Marco Trevisan (Treviño) [Thu, 19 Apr 2018 01:58:57 +0000 (20:58 -0500)]
stack: protect set_visible_child_name from NULL stack

Return with error if gtk_stack_set_visible_child_name is called
with NULL parameter

(cherry picked from commit 2ee5aee4a9f01cce3dda7dff877070b62c3e2880)

7 years agoMerge branch 'gtkplacesview-finalization-fixes-master' into 'master'
Emmanuele Bassi [Thu, 19 Apr 2018 08:24:49 +0000 (08:24 +0000)]
Merge branch 'gtkplacesview-finalization-fixes-master' into 'master'

Gtkplacesview finalization fixes

See merge request GNOME/gtk!119

7 years agogtkplacesview: disconnect from server list monitor changes on destroy
Marco Trevisan (Treviño) [Thu, 19 Apr 2018 07:47:30 +0000 (02:47 -0500)]
gtkplacesview: disconnect from server list monitor changes on destroy

It might happen otherwise that a change is recorded in between the
widget dispose and finalization, causing a crash when setting
the visible name for the GtkStack (as that will be NULL at that point)

7 years agogtkplacesview: unset entry_pulse_timeout_id before removing it
Marco Trevisan (Treviño) [Thu, 19 Apr 2018 07:46:40 +0000 (02:46 -0500)]
gtkplacesview: unset entry_pulse_timeout_id before removing it

Fixes a warning on widget finalize, when trying to remove an invalid
source.

7 years agoScale: Document new optional classes on value node
Daniel Boles [Wed, 18 Apr 2018 21:57:02 +0000 (22:57 +0100)]
Scale: Document new optional classes on value node

7 years agoRange: Make down/up keys act like down/up scrolls
Daniel Boles [Mon, 1 Jan 2018 14:31:56 +0000 (14:31 +0000)]
Range: Make down/up keys act like down/up scrolls

Before now, down/up keys on H Ranges would increase/decrease value resp,
which is unintuitive & worse, contradicts what we already do for scrolls

Fix simply by moving to the new should_invert_move() as scrolls just did
– which also gets us the other benefits explained in the last 2 commits.

https://bugzilla.gnome.org/show_bug.cgi?id=407242
https://bugzilla.gnome.org/show_bug.cgi?id=791802

7 years agoRange: Use should_invert_move() to scroll value
Daniel Boles [Mon, 1 Jan 2018 14:28:16 +0000 (14:28 +0000)]
Range: Use should_invert_move() to scroll value

This fixes RTL and/or :inverted Ranges responding to a horizontal scroll
by moving the value/slider button in the opposite direction... See prev.

https://bugzilla.gnome.org/show_bug.cgi?id=791802

7 years agoRange: Add should_invert_move() for scrolls & keys
Daniel Boles [Tue, 17 Apr 2018 20:44:16 +0000 (21:44 +0100)]
Range: Add should_invert_move() for scrolls & keys

This will be used in subsequent commits to fix the sign by which the
value is changed in response to directional scroll or keypress events.

The idea is: you have a movement to make – in the form of a delta that
follows widget directions, i.e. −1 means left or up, +1 means right or
down – and you want to know whether that delta needs to be inverted in
order to produce the intuitively expected directional change of :value.

The existing should_invert() is not sufficient: it just determines
whether to invert visually, but we need more nuance than that for input.

To answer that – while not doubling up the work for scrolls and keys – I
add a helper should_invert_move(), which considers other relevant state:

 • A parallel movement on priv->orientation should just use the existing
   should_invert(), which already worked OK for this case (not others).

 • Movements on the other orientation now depend on priv->orientation:

    ◦ For a horizontal Range, always invert, so up (i.e. −ve in terms of
      widget coords) always means increase value & vice-versa. This was
      done in get_wheel_delta(), but move it here for use with keys too.

    ◦ For a vertical Range, ignore :invert as it’s only relevant to the
      parallel orientation. Do not care about text direction here either
      as RTL locales do not invert number lines, Cartesian plots, etc.

This returns TRUE if the delta should be inverted before applying to the
value, and we can now use this function in both scroll and key handlers.

https://bugzilla.gnome.org/show_bug.cgi?id=407242
https://bugzilla.gnome.org/show_bug.cgi?id=791802

7 years agosnapshot: Don't handle clip anymore
Benjamin Otte [Sun, 15 Apr 2018 12:07:25 +0000 (14:07 +0200)]
snapshot: Don't handle clip anymore

If widgets want to clip things, they now need to do it themselves.

By not taking care of clip, we avoid the need to track clip. And by not
tracking clip, we can avoid all unnecessary cache invalidations that we
were doing for render nodes whenever the clip changed.

And when you are scrolling, the clip changes *a lot*.

7 years agoMenuShell: Avoid compiler warning re un/signed cmp
Daniel Boles [Tue, 17 Apr 2018 19:50:04 +0000 (20:50 +0100)]
MenuShell: Avoid compiler warning re un/signed cmp

priv->button is a guint, but we assigned it to a local gint.

gtk/gtkmenushell.c:734:37: warning: comparison between signed and
  unsigned integer expressions [-Wsign-compare]
           if (button && (new_button != button) && priv->parent_menu_shell)
                                     ^