Commit Graph

30574 Commits

Author SHA1 Message Date
Benjamin Otte
2db43edbd6 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*.
2018-04-17 23:21:37 +02:00
Daniel Boles
3b2a03367c 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)
                                     ^
2018-04-17 20:53:48 +01:00
Daniel Boles
d13e78831b Menu|Item: Fix FIXME re non-const interned strings
These are members of the private struct, so it hurts no one to fix this.
2018-04-17 20:53:48 +01:00
Daniel Boles
4fae962a03 Menu: Remove redundant typecheck in private func
Everything that calls this already ensured we are a valid GtkMenu.
2018-04-17 20:40:21 +01:00
Daniel Boles
8fd0ee96a6 Menu: Update @accel_path annotation/description 2018-04-17 20:40:21 +01:00
Daniel Boles
48472a4b04 Menu: Typecheck AccelGroup passed via public API 2018-04-17 20:40:21 +01:00
Daniel Boles
24953ab1be Menu: Typecheck before dereferencing to get ->priv 2018-04-17 20:40:21 +01:00
Daniel Boles
2a7e5d5137 MenuShell: Sanitise take_focus bool via public API
We store in priv then compare it later, so better make sure it’s 0 or 1.
2018-04-17 20:40:21 +01:00
Daniel Boles
f6ba206d07 MenuShell: Typecheck the instance @ select_first()
since this is public API and therefore might get junk passed to it.
2018-04-17 20:21:05 +01:00
Daniel Boles
331f9762cc CellRenderer: Link to CellEditable.start_editing()
...from CellRenderer::start-editing, to point people in the direction of
info about the lifecycle of the Editable and how to do generic setup.

https://gitlab.gnome.org/GNOME/gtk/issues/154
2018-04-17 19:07:39 +01:00
Daniel Boles
aaf2e30a48 CellRenderer: Clarify doc of .start_editing()
Drop the line copied from .activate(), replace it with a description of
what this method actually does, and explain what a NULL result means.

https://gitlab.gnome.org/GNOME/gtk/issues/154
2018-04-17 19:07:39 +01:00
Daniel Boles
50feed4c28 CellRenderer: Entry is not the only CellEditable
so link to GtkCellEditable and note that GtkEntry is just one example.
2018-04-17 19:07:39 +01:00
Daniel Boles
0fd9362e91 CellRenderer|Editable: Don't @See_also subclasses
The documentation knows that from the inheritance hierarchy, without us
having to manually duplicate that info here. Link to each other instead.
2018-04-17 19:07:39 +01:00
Daniel Boles
bdb7815b0c CellEditable: Clarify doc on lifecycle of editable
* Note in the intro that we're really thinking about temporary widgets
* Mention a gotcha regarding GtkEntry and how ::focus-out stops editing
* Give some examples of what you'd want to do in ::editing-done
* Be a bit more precise about what ::remove-widget represents
* Summarise the lifecycle between Renderer/Editable in .start_editing()
* Emphasise again there that this should be viewed as a temporary widget

https://gitlab.gnome.org/GNOME/gtk/issues/154
2018-04-17 19:07:39 +01:00
Daniel Boles
59a8ffd35e CellEditable: Move arg description to right place
Move it from the body to the argument line, and while there, update
the deprecated (allow-none) to (nullable).
2018-04-17 19:07:39 +01:00
Daniel Boles
44682256a9 CellEditable: Fix grammar error in doc synopsis 2018-04-17 19:07:39 +01:00
Marek Kasik
0abf8efd2f TextView: Don't access already disposed text mark
Instead of asking of TextMark for its buffer,
let's reference also the buffer in the SelectionData.

Closes #169
2018-04-17 16:01:54 +02:00
Matthias Clasen
3e9a68be83 No need to clear GTK_MODULES anymore
Not a variable we care about nowadays.
2018-04-15 22:03:50 -04:00
Timm Bäder
b0e9dc4723 tooltip: Ignore events with pressed buttons
We dont' want to show tooltips in those cases.
2018-04-15 17:12:01 +02:00
Timm Bäder
172b0e7ea0 frame: Use underscores in widgets ids in the docs
They will work in composite widget templates this way.
2018-04-15 17:12:01 +02:00
Timm Bäder
bf08537885 frame: Remove priv pointer 2018-04-15 17:12:01 +02:00
Timm Bäder
be77e0d500 frame: Stop saving label and child allocation
We don't use them for anything anymore.
2018-04-15 17:12:01 +02:00
Timm Bäder
2f95b4dd70 Remove gtk_render_icon_surface
As part of removing all the cairo_surace_t usage. There's still
gtk_render_icon for the same purpose that takes a GdkTexture*
2018-04-15 17:12:01 +02:00
Timm Bäder
4b02982e1c widget: Use _set_has_tooltip everywhere
real_set_has_tooltip sounds like it's a vfunc implementation, but it
wasn't. The force parameter was also useless so just remove that.
2018-04-15 17:12:01 +02:00
Timm Bäder
914656b8b6 widget: Use priv pointer directly 2018-04-15 17:12:01 +02:00
Timm Bäder
5f02caf09b widget: Update docs to mention ::draw less 2018-04-15 17:12:01 +02:00
Matthias Clasen
d48084dad9 font chooser: Allow tweaking fractions
This makes some sense, and frac is meant to be set globally.
2018-04-14 20:28:27 -04:00
Timm Bäder
1db1a30339 flowbox: Remove unnecessary queue_draw call 2018-04-14 12:50:17 +02:00
Timm Bäder
1195bb3872 paned: Remove outdated comment
The cursor is not updated in state_flags_changed these days.
2018-04-14 12:50:17 +02:00
Timm Bäder
c18219c5a8 snapshot: don't create offset nodes inside offset nodes
It's pretty easy to make that one offset node.
2018-04-14 11:47:02 +02:00
Timm Bäder
3a995b41d7 widget: Avoid a dead assignment 2018-04-14 11:47:02 +02:00
Timm Bäder
497d2f8c50 tooltip: Avoid some possibly uninitialized values 2018-04-14 11:47:02 +02:00
Timm Bäder
0965812e37 scrolledwindow: Fix indicator revealing
We need to increase the scrollbar bounds size.
2018-04-11 19:14:55 +02:00
Руслан Ижбулатов
8c3ee6a38d Link libgtk to libintl
GTK does use libintl directly (in gtkmain.c, for example) and thus
needs to be linked to it (if found and/or needed).

Previously we most likely were getting libintl from glib, but
that stopped for some reason. Either way, explicit linking is
the right thing to do here.
2018-04-11 16:49:18 +00:00
Emmanuele Bassi
a2a99d27c9 Simplify the Wayland code generation
Instead of going through an ancillary script to strip away the
`WL_EXPORT` annotation from the generated code, we should bump up the
required version of Wayland, and use the `private-code` argument for
wayland-scanner, which does the right thing for us.
2018-04-11 15:06:43 +01:00
Benjamin Otte
2dd37e9624 widget: Not all toplevels are containers
Guard against GtkInvisible.
2018-04-11 04:04:37 +02:00
Benjamin Otte
b79c138100 widget: Only start/stop idle sizers for toplevels
They are the only widgets that have idle sizers.
2018-04-11 03:16:34 +02:00
Benjamin Otte
2abf082231 widget: Move frame clock handling to vfunc
Instead of connecting to / disconnecting from the frame clock, do it
inside the vfuncs next to changing the priv->realized boolean.

This removes a race between those 2 cases that could cause child
widgets' unrealize handlers to reconnect this widget to the frame clock
because it was still marked as realize when the widget had already
disconnected from the frame clock.

Fixes #168
2018-04-11 03:16:34 +02:00
Benjamin Otte
7ef8cb652b widget: Remove gtk_widget_set_realized()
Everybody chains up now.
2018-04-11 03:16:34 +02:00
Benjamin Otte
5abc4749de gtk: Chain up in toplevels' realize
Don't call set_realized() manually.
2018-04-11 03:16:34 +02:00
Benjamin Otte
5c51a302a4 widget: Make gtk_widget_real_realize() stricter
But in turn, also allow it to work on widgets with their own surface.

This way, we can chain up from everywhere and won't have to export
gtk_widget_set_realized().
2018-04-11 03:16:34 +02:00
Benjamin Otte
0af5316f00 widget: Assert unrealizing
Instead of just setting the flag, assert that it was set.
2018-04-11 03:16:34 +02:00
Benjamin Otte
2862ee7682 widget: Remove unused member 2018-04-11 03:16:34 +02:00
Benjamin Otte
3ee2aa1b22 container: Remove gtk_container_maybe_start_idle_sizer()
Fold it into gtk_container_start_idle_sizer()
2018-04-11 03:16:34 +02:00
Benjamin Otte
21f15094fb container: Remove gtk_container_queue_resize_handler()
It's the same as gtk_container_maybe_start_idle_sizer()
2018-04-11 03:16:34 +02:00
Benjamin Otte
3df94fe099 container: Use maybe_start_idle_sizer()
That way, we don't accidentally start an idle sizer for unrealized
widgets.
2018-04-11 03:16:34 +02:00
Benjamin Otte
e0415fccd7 window: Don't queue resize handler
It's not needed, because the queue_allocate() call right above it does
this work.
2018-04-11 03:16:34 +02:00
Benjamin Otte
b591d7bc20 widget: Don't queue resize handler twice
We already queue it when we set_alloc_needed(), so there's no need to do
it again.
2018-04-11 03:16:34 +02:00
Benjamin Otte
d6477d0894 container: Don't store the resize clock
Use gtk_widget_get_frame_clock() instead
2018-04-11 03:16:34 +02:00
Benjamin Otte
e44bbeb558 filechooserbutton: Fix reserved pointers
So gcc stops complaining about unnecessary parenthesis.
2018-04-10 15:13:38 +02:00
Timm Bäder
3db4f805ee widgetfocus: Use gtk_widget_compute_bounds
Instead of gtk_widget_get_allocation.
2018-04-10 09:44:14 +02:00
Timm Bäder
3ce6355bf4 widget: Remove _get_own_allocation
Replace all usages of it with _compute_bounds
2018-04-10 09:43:47 +02:00
Timm Bäder
3a5b2f54ea widget: Remove gtk_widget_get_own_allocation
Use compute_bounds everywhere.
2018-04-10 09:43:47 +02:00
Timm Bäder
5d1f93796e widget: Remove get_own_allocation usages 2018-04-10 09:43:47 +02:00
Timm Bäder
b29ee2dc46 notebook: Use compute_bounds 2018-04-10 09:43:47 +02:00
Timm Bäder
d49d391fcd popover: Use gtk_widget_compute_bounds
Instead of the private get_own_allocation
2018-04-10 09:43:47 +02:00
Timm Bäder
3593fd2a29 toolbar: Avoid a get_own_allocation call
We want the content allocation here since we are allocation child
widgets.
2018-04-10 09:43:47 +02:00
Timm Bäder
44390c16b2 widget: Fix typo in compute_bounds docs 2018-04-10 09:43:47 +02:00
Daniel Boles
b7291ce533 AccelGroup: Remove @See_also of deleted function
gtk_item_factory_new() is not a thing that exists.

Also, maybe the lack of space after the colon was what stopped the link
from rendering.
2018-04-09 19:45:10 +01:00
Benjamin Otte
0afdd84a2a css: Clipping changes don't need a queue_allocate() anymore
Now that queue_draw() isn't restricted to clip anymore, we don't need to
care about clip in the CSS engine either.

We do keep GTK_CSS_AFFECTS_CLIP around though because GtkWindow does
care for the window's size.
2018-04-09 20:20:55 +02:00
Benjamin Otte
78a9b5d1ed entry: Stop being activatable
Activating entries does not do anything.

Activate the default widget instead.
2018-04-09 20:20:55 +02:00
Benjamin Otte
e8fef1147f widget: Don't do a 0-size check before snapshotting
Even widgets with an empty allocation may still want to draw stuff.
Examples include shadows or child widgets with negative margins.

Fixes GtkEntry's progressbar not showing up anymore.
2018-04-09 01:00:31 +02:00
Daniel Boles
53a66c0f41 ModelButton: Use WARN_INVALID_PROPERTY, not assert
Do the same thing we do everywhere else for invalid properties.
2018-04-08 18:48:16 +01:00
Daniel Boles
7fd0d3ec51 ModelButton: Fix type Wether => Whether 2018-04-08 18:48:16 +01:00
Daniel Boles
57c58f880b ModelButton: Protect against nonsensical gbooleans
the same way we do normally.
2018-04-08 13:17:18 +01:00
Mohammed Sadiq
5ad31616e8 listbox: Fix signal name in documentation 2018-04-08 11:02:23 +05:30
Rico Tzschichholz
ff738269b6 Fix some g-i annotation warnings 2018-04-06 16:26:17 +02:00
Timm Bäder
58aa93be41 menu: Avoid an invalid read 2018-04-06 08:24:19 +02:00
Timm Bäder
d4e4904604 lockbutton: Remove priv pointer 2018-04-06 08:24:19 +02:00
Benjamin Otte
3eddbdc191 video: Add autoplay and loop boolean properties 2018-04-06 00:44:18 +02:00
Carlos Garnacho
acb950ffb5 gtkmenushell: Port to using GtkEventControllerKey 2018-04-05 19:26:55 +02:00
Carlos Garnacho
9a80b9e382 gtkcellrendereraccel: Port to using GtkEventControllerKey 2018-04-05 19:26:55 +02:00
Carlos Garnacho
362a6ca469 gtkentry: Use key controller to track focus changes 2018-04-05 19:26:55 +02:00
Carlos Garnacho
73fe140b10 gtkcalendar: Use key controller to track focus changes 2018-04-05 19:26:55 +02:00
Carlos Garnacho
b0cd5cd7c8 gtktextview: Use key controller for focus changes 2018-04-05 19:26:55 +02:00
Carlos Garnacho
3361fe1e62 gtkeventcontrollerkey: Add ::focus-in/out signals
And handle GDK_FOCUS_CHANGE events in order to emit those.
2018-04-05 19:26:55 +02:00
Carlos Garnacho
5a34d0f816 gtkeventcontrollerkey: Add get_group() call
Callers can use this function on a key-pressed/released signal
to find out the key event group, useful in a few places.
2018-04-05 19:26:55 +02:00
Carlos Garnacho
d724506abe gtkmenu: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:55 +02:00
Carlos Garnacho
d5e826a660 gtkiconview: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:55 +02:00
Carlos Garnacho
f291541769 gtkcellrendererspin: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:55 +02:00
Carlos Garnacho
1fa6239509 appchoooserdialog: use search bar key capture API 2018-04-05 19:26:54 +02:00
Carlos Garnacho
0b3b81a8bf inspector: Use search bar API to capture key events from the toplevel 2018-04-05 19:26:54 +02:00
Carlos Garnacho
20c1e24b60 gtksearchbar/entry: Add [gs]et_key_capture_widget() API calls
This lets these widgets actively pull events from a widget, instead
of passively being fed events.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
ad5f0a63a3 gtkwindow: Perform key activation in gtk_main_do_event()
In a similar spirit to the previous commit, make window shortcut
activation happen by default on toplevels, without relying on
legacy controllers.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
6892b5c5ba gtkwidget: Activate key bindings through run_controllers()
Deferring a bit further making those a standalone controller, make
binding activation happen on run_controllers(), so it happens by
default on widgets (unless the key event was consumed earlier)
without the need of a legacy event controller.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
d74ecfb02e gtkwidget: Break early if non-gesture controllers handle the event
Non gesture controllers have no means to collaborate with other
controllers, thus should be considered standalone entities. It makes
no sense to propagate any further if scroll/key controllers handled
the event.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
695549d5a7 eventcontrollerkey: Add function to forward stuff elsewhere 2018-04-05 19:26:54 +02:00
Carlos Garnacho
b55696e551 gtkmain: Don't use special paths for key event propagation
Set the event_widget to the window focus, and let event capture/bubble
handling do the rest.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
385fa18c27 gtkrange: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
cfdf4f650f gtkcellrendereraccel: simplify grabbing code 2018-04-05 19:26:54 +02:00
Matthias Clasen
df386f29ab combo box: Stop using ::key-press-event
Switch to using ::event.
2018-04-05 19:26:54 +02:00
Matthias Clasen
ec84fb90bf app chooser: Stop using ::key-press-event
For now, just switch to using ::event.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
80c3ebe3a0 gtkentrycompletion: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
585aafc2df gtkplacessidebar: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
87b4dc4c67 gtktextview: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
5118f9817a gtkflowbox: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
568054a034 gtkentry: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:53 +02:00
Carlos Garnacho
0d884d22fb gtkcolorswatch: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:53 +02:00
Carlos Garnacho
6f4107c8de gtkcolorplane: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:53 +02:00
Carlos Garnacho
5081472d97 gtkcalendar: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:53 +02:00
Matthias Clasen
f231ac6541 Shortcuts window: stop using ::key-press-event
Use a key event controller instead.
2018-04-05 19:26:53 +02:00
Matthias Clasen
c971ca7c34 color editor: Stop using ::key-press-event
Use key event controllers instead.
2018-04-05 19:26:53 +02:00
Matthias Clasen
4990842981 about dialog: Stop using ::key-press-event
Use a key event controller instead.
2018-04-05 19:26:53 +02:00
Matthias Clasen
6d1b21a028 places view: Stop using ::key-press-event 2018-04-05 19:26:53 +02:00
Matthias Clasen
c2bd7fcf35 inspector: Stop using ::key-press-event 2018-04-05 19:26:53 +02:00
Matthias Clasen
2cc85df62b docs: Modernize an example
The signals that are showcased here are going away.
2018-04-05 19:26:53 +02:00
Matthias Clasen
19bd57ed1f file chooser: Use a key event controller
We want to get rid of ::key-press-event.
2018-04-05 19:26:53 +02:00
Carlos Garnacho
f0c8e9de4f gtk: Add GtkGestureStylus
This is a GtkGesture done to deal with stylus events from drawing tablets.
Those have a special number of characteristics that extend a regular
pointer, so it makes sense to wrap that.
2018-04-05 19:26:53 +02:00
Carlos Garnacho
58eaf5ca16 gtkwindow: Unset focus grab_widget if it ends up unmapped
This may result on the later emission of crossing events, with one of the
sides being already unmapped/unrealized. The widget being unmapped will
result on repick and emission of a set of crossing events anyway.
2018-04-05 19:26:04 +02:00
Carlos Garnacho
1ce79b29e3 gtk: Add GtkEventControllerKey
This event controller is meant to replace usage from key-press/release-event
handlers all through. Optionally it can be set a GtkIMContext, so interaction
is carried by the controller.
2018-04-05 19:26:04 +02:00
Benjamin Otte
47ea3a9452 snapshot: Don't cause invalid reads
1. Pass clip rectangles to gtk_snapshot_push_state() that point into
   the state array.
2. g_array_set_size(len+1) the state array
3. Make that function realloc() the state array.
4. The clip rectangle now points into invalid memory
5. Use the clip array

This patch fixes things by moving step 5 to before step 2.
2018-04-05 18:41:34 +02:00
Benjamin Otte
ebea84474d widget: Fix variable names
Stop docs build from complaining
2018-04-05 17:09:52 +02:00
Benjamin Otte
374467c11c a11y: Fix headers
We were getting a gcc warning before.
2018-04-05 17:05:21 +02:00
Benjamin Otte
8cb0df7554 Merge branch 'window-activate' into 'master'
a11y: restore window:activate/deactivate emission

Closes #127

See merge request GNOME/gtk!77
2018-04-05 14:36:13 +00:00
Samuel Thibault
62f31015fc a11y: restore window:activate/deactivate emission
1b9aa1b708 ('a11y: drop the focus tracker') removed a bit too much.  We
still have to emit window:activate/deactivate events.  They are easy to
emit anyway.

Fixes #127
2018-04-05 15:19:04 +02:00
Benjamin Otte
a5cb6aa365 inspector: Add an fps overlay 2018-04-05 14:58:43 +02:00
Benjamin Otte
6de4c63a67 inspector: Bring back debug updates
This time, they are implemented as an overlay, so they require a running
inspector and can't be enabled via env variable anymore.
2018-04-05 14:58:42 +02:00
Benjamin Otte
2699c15a99 widget: Remove draw signal
The only remaining user is the text handle, but the text handle doesn't
draw anything anyway currently, so whoever fixes it can make it use
snapshots.
2018-04-05 14:57:10 +02:00
Benjamin Otte
de990614d7 inspector: Introduce so-called "overlays"
Overlays are drawings that get rendered on top of the inspected window.

The only overlay in existence so far is the highlight overlay, which is
used to highlight widgets and replaces the "draw" signal handler used
previously.
2018-04-05 14:57:10 +02:00
Benjamin Otte
cbf26fbd02 widget: Add gtk_widget_compute_bounds()
The first in a set of functions intended to query widget coordinates
from another widget's coordinate system.
2018-04-05 14:57:10 +02:00
Benjamin Otte
6c55096933 inspector: Change semantics of inspector render node notify
Instead of just notifying the inspector of what is going to be rendered,
allow the inspector to modify it.

This way, the inspector can overlay information it deems relevant over
the render node while still having access to what the actual widget
(without the inspector) would paint.
2018-04-05 14:57:10 +02:00
Benjamin Otte
0ea8395c03 image: Actually report a request mode
This makes height-for-width actually work for GtkImage.

I'm kinda ashamed I didn't notice it not working before.
2018-04-05 14:57:10 +02:00
Benjamin Otte
7a4e76ae15 treeview: Remove invalidation tracking code 2018-04-05 14:57:10 +02:00
Benjamin Otte
56e018b91c widget: Remove GtkWidget.draw vfunc
Widgets are exclusively snapshot now.

The draw signal still exists.
2018-04-05 14:57:10 +02:00
Benjamin Otte
c06a790694 widget: Remove gtk_widget_draw()
If you want to draw a widget to cairo today, you create a widget
paintable, snapshot it to a render node and then draw the render node to
cairo.

And yes, this is that complicated on purpose. Don't draw widgets to
Cairo.
2018-04-05 14:56:39 +02:00
Benjamin Otte
f974b48503 widgetpaintable: Implement get_current_image()
Now that snapshot and empty paintables exist, this is rather trivial.
2018-04-05 14:56:39 +02:00
Benjamin Otte
ffc7b2bb0a snapshot: Allow passing the bounds of the created paintable
This allows being more specific about the size.
It's useful in particular when the resulting render nodes might be
too small for the size, not only when they are too large. For the
latter case, using a clip node would be enough.

It also requires adding a clip node when rendering the resulting
paintable, but that should be optimized out by GtkSnapshot when not
necessary.
2018-04-05 14:56:39 +02:00
Benjamin Otte
12fedca726 widgetpaintable: Protect against too many signals
This is actually not just a mechnaism to protect against too many
signals, but it's also a method to getting those signals at the wrong
time.

For every size/content change, a widget needs to invalidate twice:
Once when it queues a resize/redraw (going valid => invalid) and once
when the new size/content is actually assigned (going invalid => valid).

However, one of those invalidations might be inconvenient for the
listener. GtkImage for example does not like receiving
invalidate-contents signals when new contents are assigned, but is fine
with them when the old ones go invalid. And it will not try to draw the
paintable in between anyway.

So by bypassing the 2nd emission if nothing was changed, we can make
GtkImage happy.
2018-04-05 14:56:39 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Benjamin Otte
fc6de135fe widget: Don't keep track of clip anymore.
It's not used anywhere, so why would we need it?
2018-04-05 14:56:38 +02:00
Benjamin Otte
a36b0f8bae widget: Don't clip widgets anymore when snapshotting
This is the first step in removing clips.

It's seperate to allow bisecting to this commit when analyzing
performance problems.
2018-04-05 14:56:38 +02:00
Benjamin Otte
4bf90633ea widget: Cache clip from creating render node
When the clip changes that is passed to a snapshot function, we need to
create eventual cached render nodes because they might not have drawn
their whole area before.

Fixes issues with redrawing when scrolling.
2018-04-05 14:56:38 +02:00
Benjamin Otte
278ab3c4de snapshot: Track clip as a rect only 2018-04-05 14:56:38 +02:00
Benjamin Otte
e3a717363b snapshot: Remove clip argument from gtk_snapshot_new()
It's not used anymore. And anybody who wants to have a clip on a
newly created snapshot can achieve that using gtk_snapshot_push_clip().
2018-04-05 14:56:38 +02:00
Benjamin Otte
73650c6da2 gtk: Remove gtk_widget_queue_draw_region()
... and gtk_widget_queue_draw_area().

They don't doi anything anymore.
2018-04-05 14:56:38 +02:00
Benjamin Otte
a468714849 widget: Stop tracking invalidations
Instead of calling gdk_surface_invalidate_region(), just
gdk_surface_queue_expose() and rely on the renderer computing the diff
from the previous rendering.
2018-04-05 14:56:38 +02:00
Benjamin Otte
7e078cd940 gtk: Remove debug updates
With the soon-to-arrive automatic updates (aka computing invalid region
from render nodes), this will no longer be necessary.
2018-04-05 14:56:38 +02:00
Benjamin Otte
d0873c7dec gsk: Fold gsk_renderer_begin_draw_frame() into renderer
It doesn't need to be exported anymore.

As a side effect, the inspector no longer has any information about the
render region, so remove the code that was taking care of that.
2018-04-05 14:56:38 +02:00
Benjamin Otte
b19d7630ae widget: Reorder gtk_widget_render()
Now that we don't clip the created render nodes anymore, we don't have
to compute the clip region beforehand.

So snapshot the render nodes before initializing the renderer.
2018-04-05 14:56:38 +02:00
Benjamin Otte
c0db4091cf magnifier: Redo with GtkWidgetPaintable 2018-04-05 14:56:38 +02:00
Benjamin Otte
2d10c2568c gtk: Add GtkWidgetPaintable
A GtkWidgetPaintable is a paintable that observes a given GtkWidget and
renders that widget into a paintable.
2018-04-05 14:56:38 +02:00
Benjamin Otte
29111a16d4 widget: Cache the render node
This requires a bunch of refactorings:

1. Don't pass the current clip region to gtk_widget_snapshot()
   so we don't create full widget contents
3. Have a widget->priv->draw_needed that we invalidate on every
   queue_draw() call and set on every snapshot()
2. In queue_draw(), walk the widget chain to invalidate the
   render nodes of all parents
2018-04-05 14:56:38 +02:00
Matthias Clasen
dcdd95bbc8 font button: fix compiler warnings
A PangoLanguage is not a string.
2018-04-05 06:23:14 -04:00
Benjamin Otte
7c60f939ee Merge branch 'text-changed-delete-4' into 'master'
gtkentryaccessible: Fix text-changed::delete length

See merge request GNOME/gtk!100
2018-04-04 18:19:08 +00:00
Samuel Thibault
a1f206b802 gtktextviewaccessible: update cursor position after text suppression
delete_range_cb is set to be called before the text suppression done by
the gtktextlayout (otherwise it does not work properly). But at that
point the cursor position is not yet up to date.  We thus need to move
the accessibility cursor notification to after the actual text
suppression, by using another callback.

This fixes cursor position in brltty screen reading.

(cherry picked from commit fa6994d033)
2018-04-04 18:26:55 +02:00
Samuel Thibault
8c8cb2bb12 gtkentryaccessible: Fix text-changed::delete length
The second parameter of the text-changed::delete event is to be the length,
not the end position.  This fixes spurious text removals in brltty
screen reading.

(cherry picked from commit 209f908a03)
2018-04-04 17:59:31 +02:00
Daniel Boles
67360c9d00 GLArea: Remove wrong transfer annotation on new()
Like other widgets, this returns a floating reference, so
(transfer full) is wrong. Just omit the annotation as others do,
thus implying (transfer none).

Close https://gitlab.gnome.org/GNOME/gtk/issues/156
2018-04-04 12:02:21 +01:00
Lionel Landwerlin
faceaec20a imwayland: destroy objects only if it matches our manager object
Should fix one of the crash from #129.
2018-04-03 19:11:09 +02:00
Matthias Clasen
bd9debe048 font chooser: Remove some dead code
This is leftover code from already removed debug spew.
2018-04-02 17:46:41 -04:00
Matthias Clasen
ec66c32def font button: Fix a crash
Since we are now storing the language as a PangoLanguage,
we must not free it anymore.
2018-04-02 17:45:48 -04:00