Commit Graph

274 Commits

Author SHA1 Message Date
Matthias Clasen
e7ed7c1913 paned: Grab during the drag
This is necessary to ensure we get the right cursor.
2017-12-08 21:09:24 -05:00
Timm Bäder
49e624bbe9 paned: Restrict picking to allocation
Same reason as GtkViewport does it: We might allocate child widgets
outside of the paned's content allocation. For drawing, we add a clip
node.

This was causing the "Record" button in the inspector recorder to ignore
pointer events since the treeview column header label in the GtkPaned
was swallowing it.
2017-12-06 08:23:03 +01:00
Timm Bäder
93df23d962 Remove some more gtk_widget_get_content_size uses 2017-12-04 12:42:52 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
a409320cda gtk: Use gtk_widget_set_cursor()
... and gtk_widget_set_cursor_from_name() instead of setting cursors on
GdkWindows.
2017-11-04 01:37:03 +01:00
Benjamin Otte
9323d098a6 gdk: Cursors no longer have a display
Change constructors to reflect that.

While doing so, also add a fallback argument to the cursor constructors,
so it is now possible to create cursors with fallback.
2017-11-04 00:07:13 +01:00
Timm Bäder
657983cfda Don't try to snapshot invisible icons
These spew criticals when width == 0 || height == 0.
2017-10-10 09:49:35 +02:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
e6349c940e paned: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
5f859a1f24 widget: Remove gtk_widget_get_content_allocation
Replace it where we still need something similar, e.g. in
gtk_widget_translate_coordinates
2017-08-14 12:22:39 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
6f7387cd25 paned: Fix clip node coordinates 2017-07-19 21:27:15 -04:00
Timm Bäder
a9f10a2d56 paned: Remove assertion in get_child_property
Passing the third child (the pane separator) is possible and shouldn't
cause the process to abort.
2017-07-19 21:27:14 -04:00
Timm Bäder
e501bc6028 paned: Draw handle separator at the right location 2017-07-19 21:27:14 -04:00
Timm Bäder
5228e018b6 paned: Make sure we set the correct clips
They are still too big, i.e. clipped-off children enlarge the paned's
clip but at least redrawing works and smaller clips are just an
optimization.
2017-07-19 21:27:14 -04:00
Timm Bäder
fa97b270f1 paned: Remove useless queue_resize calls
This is done by gtk_widget_unparent nowadays
2017-07-19 21:27:13 -04:00
Timm Bäder
4a4897a9b6 paned: Reimplement handle dragging 2017-07-19 21:27:13 -04:00
Timm Bäder
ac1d3cb396 paned: Replace handle gadget with widget 2017-07-19 21:27:13 -04:00
Timm Bäder
49476053e3 paned: Remove gadget 2017-07-19 21:27:12 -04:00
Timm Bäder
dc9ac96b39 paned: Remove css box drawing 2017-07-19 21:27:11 -04:00
Carlos Garnacho
94094611bc gtkpaned: Remove per-child windows
Those are no longer necessary for clipping nor receiving events, so just
remove them.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Timm Bäder
f053a63d74 container: Remove include_internals parameter from forall
with include_internals=TRUE, this is the same as the (still private)
gtk_widget_forall, or just using the children/sibling accessors in a
loop.
2017-04-25 20:30:37 +02:00
Timm Bäder
ccdc50e540 paned: Fix typo 2017-04-24 15:16:15 +02:00
Timm Bäder
43cdeee3c4 widget: Save pointer to focus child
Do the same thing GtkContainer does.
2017-03-31 09:50:39 +02:00
Timm Bäder
8165b641cd paned: Use gtk_widget_measure to measure widget sizes 2017-02-17 18:23:10 +01:00
Benjamin Otte
87497ca2e1 snapshot: Rename gtk_snapshot_translate_2d()
It's now called gtk_snapshot_offset().
2017-01-13 14:37:48 +01:00
Benjamin Otte
b58de2d16c snapshot: Redo pop() API
gtk_snapshot_pop() => removed
gtk_snapshot_pop_and_append() => gtk_snapshot_pop()

So now there is no way to get a rendernode out of the snapshotting API
until you gtk_snapshot_finish().
2017-01-13 03:38:36 +01:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Benjamin Otte
e492a63e4c paned: Implement snapshot() 2016-12-20 18:01:11 +01:00
Piotr Drąg
a2da4ddceb Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2016-12-19 15:08:10 -05:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Benjamin Otte
a2b1aef6bd Revert "paned: Convert to indirect rendering"
This reverts commit ba9193fc81.

Paneds can do indirect rendering yet as we need clipping support first.
2016-11-15 17:49:19 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Benjamin Otte
32a5729d18 gtk: Chain up in realize()
... instead of copy/paste from gtk_widget_real_realize.
2016-11-02 07:16:08 +01:00
Timm Bäder
ba9193fc81 paned: Convert to indirect rendering 2016-10-31 19:29:35 +01:00
Timm Bäder
acbdd5c8f2 Fix clip position of windowed widgets 2016-10-28 17:56:51 +02:00
Benjamin Otte
bf64b6aec4 paned: Use gtk_widget_queue_draw() 2016-10-27 05:07:23 +02:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
5cadbc7084 paned: Don't check handle-size style property 2016-10-22 16:59:47 +02:00
Benjamin Otte
978684cf29 paned: Use gdk_window_new_child() and gdk_window_new_input() 2016-10-18 00:22:35 +02:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Timm Bäder
601839c825 Remove various sizing related style properties 2016-10-16 18:17:21 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Benjamin Otte
fcbd480c76 API: Remove GDK_WA_CURSOR
The cursor was set using gdk_window_set_cursor() even in
gdk_window_new().

So instead of having yet another flag, just make the users of that flag
call gdk_window_set_cursor() directly after the window was created.
2016-10-16 18:17:21 +02:00
Matthias Clasen
6181ff2552 paned: quietly handle missing cursors
The row-/col-resize cursors should really be present, but if they
aren't we don't need to crash.

https://bugzilla.gnome.org/show_bug.cgi?id=771963
2016-09-27 14:55:13 -04:00
Matthias Clasen
9a03fc906a Fix gtk_paned_set_position to set position_set consistently
As pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=765676,
we were failing to set position_set if the position did not change.
2016-05-02 07:42:06 -04:00
Matthias Clasen
bbd94b5a9f gtk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Benjamin Otte
6edb420e51 paned: Fix drawing
Clip children to their window's size. That way no overdraw happens for
these widgets. But don't clip the handle.

We might in the future consider not clipping un-shrinkable children.

https://bugzilla.gnome.org/show_bug.cgi?id=762021
2016-02-14 16:10:07 +01:00