Benjamin Otte
f08bc40fbb
a11y: Don't include gtk.h
...
Also add missing includes and sort them for all the widgets that relied
on that before.
2018-02-08 15:25:53 +01:00
Matthias Clasen
4c150d8eb5
The big versioning cleanup
...
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Timm Bäder
12be5ccbb7
label: Update layout width directly form allocation
...
For the one update_layout_width call in size_allocate, we can just use
the passed-in allocation width instead of a separate (relatively slow)
gtk_widget_get_width call.
2018-01-17 21:57:19 +01:00
Matthias Clasen
36e09f3ad9
label: Properly handle multi-line selections
...
They were rendered as a single rectangle, which is not
what is expected. Same for multi-line links.
2018-01-05 15:54:49 -05:00
Matthias Clasen
98da7730ea
label: Plug a memory leak
...
We were sometimes leaking the content serializer object.
2018-01-04 22:24:43 -05:00
Matthias Clasen
06ad134876
Add an unrealize function to GtkLabel
...
We need to drpo the primary clipboard when the label
is getting unrealized while holding it. This fixes
a crash in the accessibility-dump test.
2017-12-26 23:33:39 -05:00
Matthias Clasen
e92c0e85ec
Replace gdk_keymap_get_for_display by gdk_display_get_keymap
...
Replace all uses of the old function by the new one.
No functional change.
2017-12-15 07:44:58 -05:00
Matthias Clasen
ecdf8c64fe
label: Use GtkEventControllerMotion
...
This lets us avoid legacy event signals here.
2017-12-12 09:42:05 -05:00
Benjamin Otte
04ac4c66ae
dnd: Pass device, not event
...
You don't start a dnd operation with a device, you start it with an
event.
2017-12-12 00:31:49 +01:00
Benjamin Otte
756b276070
dnd: Remove button argument from drag_begin()
...
It was unused.
2017-12-12 00:29:51 +01:00
Matthias Clasen
072f06abf7
Fix fallout from g_object_ref change
...
g_object_ref now returns the type of the object that was
passed. Introduce cast as necessary to avoid warnings due
to this.
2017-12-08 17:48:47 -05:00
Timm Bäder
93df23d962
Remove some more gtk_widget_get_content_size uses
2017-12-04 12:42:52 +01:00
Benjamin Otte
5632d0eabb
label: Port to new clipboard
2017-12-03 05:46:48 +01:00
Benjamin Otte
a59572f96d
widget: gtk_widget_get_clipboard => gtk_widget_get_old_clipboard
...
Just rename the function, so the previous one can be used for the
new clipboard.
2017-12-03 05:46:47 +01:00
Benjamin Otte
fc2ce5a925
gdk: Make GdkContentFormats immutable
2017-11-20 23:13:10 +01:00
Benjamin Otte
9a6ec4e959
contentformats: Rename GtkTargetList
...
It's now called GdkContentsFormat
2017-11-20 23:12:33 +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
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
7efc5a1558
clipboard: Consistently use GtkTargetList
...
Some code was using GtkTargetList, some used GtkTargetEntry and some
GtkTargetPair.
2017-11-15 19:07:16 +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
Matthias Clasen
fa5e3ee54e
label: Stop using gdk_cursor_new_for_display
...
We prefer to use the name-based api for cursors nowadays.
2017-11-01 21:19:31 -04:00
Benjamin Otte
1c36c6ed4d
widget: Remove gtk_widget_has_screen()
...
All widgets always have a screen (or display).
2017-10-31 04:33:11 +01:00
Benjamin Otte
44614394e6
widget: Turn screen-changed signal into display-changed
2017-10-31 00:43:11 +01:00
Timm Bäder
8ff713840b
label: Make all code snippets properly compile
2017-10-11 12:18:22 +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
Timm Bäder
edaa2c42ee
label: Remove priv pointer
2017-10-01 09:19:09 +02:00
Daniel Boles
00f8a11aec
Label: Replace allow-none with nullable/optional
2017-09-24 19:32:19 +01:00
Matthias Clasen
6bdebd1570
label: Don't leak clip regions
...
This was introduced in the conversion to gsk.
2017-09-01 15:34:13 -04:00
Matthias Clasen
745a9426b0
Remove an unused variable
2017-09-01 12:56:22 -04:00
Matthias Clasen
10ddd3112a
label: Port active link drawing to gsk
...
We don't need to fall back to cairo fro this anymore.
2017-09-01 12:29:11 -04:00
Matthias Clasen
47f717d4ae
label: Port selection drawing to gsk
...
We don't need to fall back to cairo for this anymore.
2017-09-01 12:04:20 -04:00
Carlos Garnacho
2d3882c7eb
gtklabel: Fix touch link handling under wayland
...
Refactor the code updating the active link under the current coordinates
into a separate function, and call it on GtkGestureMultiPress::pressed
so the link is updated on GDK_TOUCH_BEGIN. Based on a patch by
Jan-Michael Brummer <jan.brummer@tabos.org>.
https://bugzilla.gnome.org/show_bug.cgi?id=776903
2017-07-26 13:20:56 +02:00
Timm Bäder
ed5192497f
label: Remove GtkEventBox mention from docs
...
Packing the label inside a GtkEventBox is not necessary anymore for it
to receive events.
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
e276f1e844
label: Fix get_layout_index
...
Properly translate the given coordinates to layout coordinates. Fixes
clicking links and selecting text.
2017-07-19 21:27:15 -04:00
Timm Bäder
26e1491c70
label: Use the correct size in snapshot()
2017-07-19 21:27:15 -04:00
Timm Bäder
c2abb698be
Replace a few get_content_allocation calls with get_content_size
...
The position of the content allocation is almost never relevant since
it's 0/0 for measure, size_allocate and snapshot.
2017-07-19 21:27:14 -04:00
Timm Bäder
25034b6f87
label: Fix layout snapshot coordinates
...
No need to convert anything to "window coordinates" anymore.
2017-07-19 21:27:14 -04:00
Timm Bäder
34af3d3940
accellabel: Inherit from GtkWidget
...
Use a box and 2 labels.
2017-07-19 21:27:13 -04:00
Timm Bäder
bf118eca80
label: Don't chain up in size_allocate
...
It's unnecessary now.
2017-07-19 21:27:12 -04:00
Timm Bäder
5532b9a1b3
label: Fix clipping
...
We were using an uninitialized value here.
2017-07-19 21:27:11 -04:00
Timm Bäder
aad7e2d509
label: Remove gadget
2017-07-19 21:27:11 -04:00
Timm Bäder
06950bcf8a
label: Remove css box drawing
2017-07-19 21:27:10 -04:00
Daniel Boles
29ff3c072c
label: Remove extra quote in code example
2017-07-07 08:15:05 +01:00
Matthias Clasen
77f34d01ad
label: Provide a baseline in all cases
...
The label measuring code was only determining baselines
when the label was set to wrap, which does not seem right.
Non-wrapping labels have a meaningful baseline as well,
report it back.
2017-06-11 10:35:06 -04:00
Carlos Garnacho
d6023e9d45
label: Remove selection window
...
It's no longer needed to receive events while the label is selectable.
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
80fe1dfe02
label: Remove dead ternary operator
2017-04-28 11:27:09 +02:00
Timm Bäder
db4b1d28f5
label: Remove angle property
2017-04-25 20:30:37 +02:00
Timm Bäder
cb80b32ee8
label: Move if statement where it makes sense
...
In the else branch of the if statement before this one, we're assigning
*smallest = *widest anyway, so this if statement is never true. Move it
to the if block before instead, where it can apply.
2017-04-25 20:30:37 +02:00
Timm Bäder
4e0f10955a
label: Remove useless if statements
...
We never pass nullable pointers into get_size_for_allocation.
2017-04-25 20:30:37 +02:00
Timm Bäder
2fc92db25c
label: Remove useless if statement
...
The if before this one already makes sure priv->wrap is TRUE.
2017-04-25 20:30:37 +02:00
Timm Bäder
29f7bde023
label: Don't use gtk_widget_set_simple_clip
...
The clip returned by gtk_css_gadget_allocate already includes the
box-shadow size and we manually care about the text-shadow size.
2017-04-25 20:30:37 +02:00
Timm Bäder
0b48bb23b2
label: Fix focus implementation
...
Don't return TRUE if we didn't actually focus anything.
2017-03-31 09:50:39 +02:00
Timm Bäder
c371a86f54
label: Properly calculate half the height
...
Since we compare it to a double anyway, might as well divide by 2.0.
2017-03-20 17:20:12 +01:00
Emmanuele Bassi
51010da740
Use gtk_show_uri_on_window() in GtkLabel
...
Avoid the deprecated gtk_show_uri(), and allow activating link in
sandboxed applications.
https://bugzilla.gnome.org/show_bug.cgi?id=778726
2017-02-16 16:37:55 +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
Alexander Larsson
7bee22bcb6
Avoid some more type checks for internal calls
2017-01-11 15:27:51 +01:00
Matthias Clasen
5fa1b14a96
Revert "Use CSS for styling links in labels"
...
This reverts commit 60a8769e7f0c952fdc8090b1ecd96cca00123ad9.
This needs more work to work properly.
2017-01-05 20:57:42 -05:00
Matthias Clasen
4170f79eea
Use CSS for styling links in labels
...
This was implemented only halfway, and was hardcoding the
underline. We don't need to do that anymore.
2017-01-05 20:57:42 -05:00
Matthias Clasen
f3779b42c5
Make it possible to set style classes for label links
...
This makes it possible to style links in labels differently
in certain situations.
2017-01-05 16:55:45 -05:00
Matthias Clasen
7e6820415d
Avoid a possible crash in ::activate-url handlers
...
If the signal handler ends up changing the label text,
the link is no longer around to update the css node.
Check for this possibility to avoid a crash here.
2016-12-29 11:09:20 -05: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
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
Emmanuele Bassi
4cbe079767
Use Graphene init macros for compound literals
...
The Graphene init macros can now be used for compound literals, which
means we need to update our mixed uses.
2016-11-21 16:21:38 +00:00
Benjamin Otte
349f55f2fe
snapshot: Convert GtkLabel and GtkAccelLabel
...
Also adds gtk_snapshot_render_insertion_cursor().
2016-11-15 17:48:45 +01:00
Benjamin Otte
da207c9fdd
snapshot: Add a snapshot function to GtkCssCustomGadget
2016-11-15 17:48:45 +01:00
Benjamin Otte
a0e63b8a07
rendernode: Require passing a renderer to get_draw_context()
...
This is in preparation of making render nodes independent of the
renderer, so that they can be rendered multiple times with different
renderers.
2016-11-01 16:32:26 +01: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
Matthias Clasen
be0de54237
Convert GtkLabel to indirect rendering
...
Warning! This breaks GtkAccelLabel. It will be fixed in the next
commit.
2016-10-18 11:49:15 +01:00
Emmanuele Bassi
3fb413beea
label: Avoid shadowing variables
2016-10-18 11:29:34 +01:00
Timm Bäder
a9367b705e
Stop checking GtkSettings:gtk-enable-mnemonics
2016-10-18 00:29:18 +02:00
Timm Bäder
203cf0d120
label: Stop using GdkColor
2016-10-18 00:29:17 +02:00
Benjamin Otte
360301a774
label: Use gdk_window_new_input()
2016-10-18 00:22:35 +02:00
Benjamin Otte
1518fe0a8f
API: stylecontext: Remove state argument from getters
...
The argument must always be the current state.
2016-10-16 18:18:58 +02:00
Timm Bäder
116cb9fc0c
label: Remove now unneeded deprecation markers
2016-10-16 18:17:21 +02:00
Timm Bäder
9d43644153
label,image: Remove GtkMisc usage
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
953b82a584
label: take padding into account when measuring
...
When doing height-for-width measurements, we need to take
padding into account. This was causing various allocation
errors.
https://bugzilla.gnome.org/show_bug.cgi?id=770849
2016-09-04 15:41:11 -04:00
Matthias Clasen
61e8c69460
label: Fix indentation
...
Trivial, but annoying.
2016-09-04 15:41:11 -04:00
Arnaud Bonatti
533de822ba
Use 'focused' everywhere.
...
https://bugzilla.gnome.org/show_bug.cgi?id=770624
2016-09-01 07:14:30 +02:00
Benjamin Otte
e1a03ead7a
Use NULL for generic marshallers in g_signal_new()
...
glib will use the correct marshaller automatically. And as a side
effect, we also get all glib optimizations, like a va marshaller.
2016-08-29 16:20:54 +02:00
Timm Bäder
57ef631216
label: Remove some useless casts
...
These were casts of a const GdkEvent* to GdkEvent* even though the
function they are passed to takes a const GdkEvent*.
2016-08-10 16:37:17 +02:00
Timm Bäder
41c8446631
label: Destroy the popup menu on unmap
2016-08-04 13:07:23 +02:00
William Hua
8701e34f74
port to new gtk_menu_popup_at_* () functions
...
https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-07-19 09:38:54 -04:00
Matthias Clasen
3f3a226090
Update GtkLabel::angle docs
...
We can have wrapped or ellipsized labels at an angle nowadays.
Still no selections though.
2016-06-07 23:40:32 -04:00
Timm Bäder
301652de1f
Remove useless casts from gdk_event_triggers_context_menu calls
2016-05-12 20:39:51 +02:00
Timm Bäder
df38db70a0
label: Also initialize text
...
So gtk_label_get_text returns the default value of "". Broke the
GtkModelButton default value test.
2016-05-05 11:31:41 +02:00
Timm Bäder
944f9d4f28
label: don't use set_text in gtk_label_new
...
It would just set up lots of things with the default values, but a
common case is that a few gtk_label_set_* calls follow.
2016-05-03 19:26:43 -04:00
Timm Bäder
4ae6f10ae9
label: minimum/natural size parameters are not nullable
...
Stop comparing them to NULL.
2016-05-03 16:25:57 -04:00
Timm Bäder
e75894da13
label: Don't set out parameters twice
...
We set them later again when we calculate the vertical size, so just
move the general assignment to -1 into the horizontal branch.
2016-05-03 16:25:57 -04:00
Matthias Clasen
29396a1e5e
label: Stop using screen width/height
...
Popups should always be placed relative to a monitor.
2016-04-27 23:18:16 -04:00
Timm Bäder
1951642c0e
GtkLabel: Use g_clear_object
...
https://bugzilla.gnome.org/show_bug.cgi?id=765496
2016-04-25 20:37:56 -04:00
Timm Bäder
be5a105f2e
GtkLabel: Don't manually iterate over link list
...
There are various functions to access links based on their index for
a11y. We can spare quite a few lines of code by just using
g_list_nth_data instead of iterating over the list ourselves.
https://bugzilla.gnome.org/show_bug.cgi?id=765496
2016-04-25 20:37:56 -04:00
Timm Bäder
0213815d2f
Move .keycap docs from GtkFrame to GtkLabel
...
That's where .keycap is used nowadays.
2016-02-25 20:45:33 +01:00
Timm Bäder
c5369356e8
Various documentation fixes
...
Always have Since: annotations at the very bottom, use the correct
ClassName::signal-name/ClassName:property-name syntax, fix a few typos
in type names, wrong function names, non-existing type names, etc.
2016-02-08 22:56:52 +01:00
Matthias Clasen
a99c69fd6b
label: fix a case of misleading indentation
...
gcc 6 complains aobut things like this.
2016-01-28 20:50:50 -05:00
Christoph Reiter
27263f2387
label: use GtkMisc padding again
...
this was lost in the gadget conversion in a81267c28e
https://bugzilla.gnome.org/show_bug.cgi?id=760522
2016-01-28 11:04:48 +01:00
Matthias Clasen
9e2a1685c5
accel label: Fix RTL handling
...
The 'mad hack' that GtkAccelLabel used to affect the GtkLabel
draw function broke with the introduction of gadgets, since
the positioning is no longer relative to the widgets' allocation
at the time of the call, but rather to the gadgets allocation.
Instead of coming up with an even madder hack to keep this
working, give the GtkLabel draw function knowledge about accel
labels.
https://bugzilla.gnome.org/show_bug.cgi?id=760663
2016-01-17 14:08:22 -05:00