Commit Graph

1232 Commits

Author SHA1 Message Date
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
3f5178dc21 selection: Remove the info uint
Instead of allowing people to pass a uint user-data, insist on them
comparing mime types.

The user data was a uint instead of a pointer anyway, so uniqueness
could not be guaranteed and it caused more issues than it was worth.
And that's ignoring the fact that it basically wasn't used.
2017-11-16 22:59:43 +01:00
Benjamin Otte
4c4e914806 gdk: Replace GDK_NONE with NULL 2017-11-15 19:07:17 +01:00
Benjamin Otte
5a1a11bcde dnd: Make GtkDragDest and GtkDragSource use GtkTargetList
This gets rid of GtkTargetEntry in the API and consistently uses
GtkTargetList.
2017-11-15 19:07:17 +01:00
Benjamin Otte
ed1b6a9bed gdkwindow: Remove event_mask arguments from constructors 2017-11-13 23:41:38 +01:00
Benjamin Otte
b968147e0a treeview: Only update vadjustment in size_allocate()
The 2 calls even do different things, but because the one in allocate
always overrides the one here...
2017-11-13 01:53:45 +01:00
Benjamin Otte
f31a51a1c8 treeview: Pass height to allocate as argument
Instead of exporting a function to query it.
2017-11-13 01:28:16 +01:00
Benjamin Otte
6eead8f6a3 treeview: Use gtk_widget_get_width()
... instead of gtk_widget_get_allocated_width() and same for height.

This makes the treeview do the right thing when used with padding.
2017-11-12 05:46:06 +01:00
Benjamin Otte
61ecd10240 treeview: Don't allocate columns outside of size_allocate() 2017-11-12 05:38:58 +01:00
Benjamin Otte
5db1aa5401 treeview: Fix RTL column header allocation 2017-11-12 05:37:06 +01:00
Benjamin Otte
48de0bf741 treeview: width_changed is always true, so remove it
Also, sanitize the RTL correction code that made sure resizing the width
of a treeview would keep the contents glued to the right border instead
of the left border.
2017-11-12 05:31:21 +01: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
dea8233663 widget: Remove stray prototype
gtk_cairo_transform_to_window is gone.
2017-11-02 11:25:41 +01:00
Benjamin Otte
bd6b6ed93c gdk: Remove VisibilityNotify events 2017-11-01 22:00:34 +01:00
Benjamin Otte
07164e098a window: Turn gtk_window_set_screen() into gtk_window_set_display()
And have a priv->display instead of a priv->screen.

Includes turning gtk_menu_set_screen() into gtk_menu_set_display(),
because that function just forwards to its window.
2017-10-31 08:25:37 +01: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
a0de570e47 gtktreeview: Transform cell area to widget coordinates
GtkCellArea uses event coordinates (thus in treeview relative
coordinates), but calculations used to happen in bin window coords.
We can just offset the cell area by the bin window, fixes cell
renderer activation and edition.
2017-10-06 18:26:08 +02:00
Carlos Garnacho
0724fa7f61 treeview: Transform motion event coords to "bin window" coords
The operations rely there on bin window relative coordinates, but we
are receiving GtkTreeView relative coordinates there. Fixes clicking
on treeview expanders, which was offset by visible headers.
2017-10-06 18:23:26 +02:00
Matthias Clasen
0ab20b6253 treeview: Give up on GdkEvent api for now
There's multiple places where events are manually generated
here, this needs more thought.
2017-09-19 18:39:03 +02:00
Carlos Garnacho
14a28224e4 treeview: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
a8a755e5cd widget: Remove gtk_widget_set_redraw_on_alloc
Since gtk+ draws more than the widget and allocates more size to it than
it knows about, this flag doesn't work anymore. Removing it (or setting
it to TRUE for widgets that used to set it to FALSE) fixes drawing
invalidation when these widgets get allocated a new size.
2017-08-09 16:26:26 +02:00
Timm Bäder
2c3ec49535 treeview: Fix row drag icon offsets 2017-07-19 21:27:16 -04:00
Timm Bäder
d836fa5134 treeviewcolumn: Remove input window 2017-07-19 21:27:16 -04: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
a0f3497939 treeview: Remove bin_window 2017-07-19 21:27:15 -04:00
Timm Bäder
2ac8ebe9f7 treeview: default to width_changed = TRUE
Checking the given GtkAllocation against the current allocation insize
::size-allocate doesn't really work anymore. They are only different if
the content allocation (the one passed) and the widget allocation (the
current one) are different, so e.g. when the widget has padding >0
applied.
2017-07-19 21:27:13 -04:00
Timm Bäder
60e053f52a Remove calls to gtk_widget_set_allocation
gtk_widget_size_allocate_with_baselines does it automatically now.
2017-07-19 21:27:12 -04:00
Carlos Garnacho
ace686dba9 gtktreeview: Fix invalidation coordinates
We must account for the widget allocation now that there is no view_window.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
6c47938b00 gtktreeview: Remove header window
It is no longer necessary to overlay the column headers above the
treeview.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
cfd5a76ece gtktreeview: Remove widget window
It can be entirely replaced by setting a proper clip rectangle.
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
Carlos Garnacho
b20f04d18d gtktreeview: Drop gtk_gesture_set_window() API
It is now meaningless and wrong, since GdkWindows aren't used anymore
to determine the event target.
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
9644bea2a5 treeview: insert the column button css node in the right place
Insert the css node before setting a parent widget on the column button,
so the gtk_widget_set_parent won't attempt to add the css node as child
of the parent widget css node.
2017-04-25 20:29:02 +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
75a3d0fab6 treeview: Use gtk_widget_measure to measure widget sizes 2017-03-04 08:44:49 +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
6055028c96 snapshot: Rename append APIs
Instead of having gtk_snapshot_append_foo_node(), just have
gtk_snapshot_append_foo(). Nobody needs to know that this internally
uses nodes.
2017-01-13 04:46:09 +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
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Alexander Larsson
65ad2541d7 Snapshot: Only record names if inspector is recording
Otherwise we do a lot of allocations and vprintf calls which are
not used.
2017-01-11 10:22:40 +01:00
Benjamin Otte
d50b73f66d treeview: Remove gtk_tree_view_get_bin_window()
We don't want to expose GdkWindows in the public API.
2017-01-08 00:48:12 +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
0efeaf9508 treeview: Port rest of stuff to snapshot()
The only thing still drawn with Cairo are grid lines.
2016-12-22 03:37:32 +01:00
Benjamin Otte
f1825f5eff treeview: Partially convert to snapshot()
The big fat scary bin drawing function that actually draws the cell
renderers - that one is still missing.
2016-12-22 03:37:32 +01:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Timm Bäder
5e06701f53 treeview: Remove style properties
Replace them with the Adwaita default values
2016-11-12 08:09:58 +01:00
Benjamin Otte
24d0baec38 API: gdk: Add gdk_window_new_popup()
... and use it.
2016-11-06 23:47:56 +01:00
Timm Bäder
846cf681e8 Remove gtk_widget_set_mapped
Let all the remaining callers chain up.
2016-11-05 11:56:36 +01:00