Commit Graph

367 Commits

Author SHA1 Message Date
Benjamin Otte
0cd2946676 menu: Move enum into only source file using it 2019-04-15 14:38:23 +02:00
Benjamin Otte
44ce36bef5 menubar: Remove pack direction 2019-04-15 14:38:23 +02:00
Matthias Clasen
d2e0553384 Fix menuitem hover
We need to pay attention to details
of enter and leave events.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1795
2019-03-31 21:53:55 -04:00
Matthias Clasen
8650980797 Adapt to motion controller api change
The signature of the enter/leave signals changed.
Adapt all users.
2019-03-18 09:24:42 -04:00
Emmanuele Bassi
25fd230327 gtk: Drop the "plus"
Source names should use "[gtk]" without the plus.
2019-02-05 11:26:20 +01:00
Timm Bäder
359d874ddb Use g_clear_pointer to unparent widgets 2018-11-13 20:53:14 +01:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Timm Bäder
911627fa0b menuitem: Remove duplicate include 2018-08-25 08:06:34 +02:00
Timm Bäder
a822d6fce9 menuitem: Don't redraw unnecessarily
The gtk_widget_(un)set_state_flags calls before will do this if
necessary.
2018-08-05 10:22:10 +02:00
Benjamin Otte
4f3058f195 eventcontrollermotion: Port to new API model 2018-04-26 17:59:42 +02:00
Daniel Boles
95f65da038 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
2018-04-22 21:49:41 +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
Timm Bäder
58aa93be41 menu: Avoid an invalid read 2018-04-06 08:24:19 +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
Timm Bäder
5c66f2ec19 accellabel: Stop saying it's a GtkLabel
And clean up the includes accordingly.
2018-03-27 18:20:52 +02:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +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
Emmanuele Bassi
c655759cef Replace gdk_threads_add_timeout* with g_timeout_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_timeout() and
gdk_threads_add_timeout_full() exist is to allow invoking a callback
with the GDK lock held, in case 3rd party libraries still use the
deprecated gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing timeout callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Matthias Clasen
6acf276a1a menuitem: Use a motion event controller
This lets us replace the ::enter/leave-notify-event handlers.
Not that there is a FIXME here - we currently can't get the
crossing mode from the event controller, so we have to fall
back to gtk_get_current_event().
2018-01-16 14:14:10 -05:00
Timm Bäder
cf9942e3cc menuitem: Make a code snippet compile 2018-01-03 17:11:32 +01:00
Carlos Garnacho
d491e49fd6 gtk: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +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
Timm Bäder
ff6cd8f75e widget: Remove parent-set signal
When a widget unparents its child widget manually in finalize, this can
lead to the parent-set signal being emitted for those child widgets. The
parent already has a ref_count of 0 though, so it can't be used in a
meaningful way. Specifically, emitting the signal will already try to
ref the parent which prints a critical.

Since GtkWidget already has a "parent" property, one can use its notify
signal instead to get notified when the parent widget changes.
2017-10-29 17:24:12 +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
Matthias Clasen
d7ccf36d71 menu item: Use GdkEvent API 2017-09-19 18:39:03 +02:00
Timm Bäder
2cd9f43d2f menuitem: Fix small memory leak in get_label
g_object_get returs a newly allocated string so we can't use it here.
2017-09-01 19:05:30 +02:00
Timm Bäder
308f41487d modelmenuitem: Set label on menu items
We have to add a check for GTK_IS_ACCEL_LABEL too now...
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
34af3d3940 accellabel: Inherit from GtkWidget
Use a box and 2 labels.
2017-07-19 21:27:13 -04:00
Timm Bäder
273aa2be61 menuitem: Replace arrow gadget with GtkIcon 2017-07-19 21:27:12 -04:00
Timm Bäder
0845246fb8 menuitem: Remove gadget
Now that GtkCheckMenuItem isn't using it anymore, we also don't need it.
2017-07-19 21:27:12 -04:00
Timm Bäder
b9fb186f46 menuitem: Stop using gadget
Once again, we can't really delete it yet since other widgets use it...
2017-07-19 21:27:11 -04:00
Carlos Garnacho
40ab7e1c95 gtkmenu*: Simplify event handling
Instead of delegating on the parent shell of a menu item/shell on a variety
of situations, Simplify event handling so:
1) Menu item selection is handled entirely on GtkMenuItem through crossing
   events.
2) The deepmost menu shell handles clicks inside and outside of it.

This avoids the rather hard to follow gtk_widget_event() calls going on all
throughout the handling of crossing and button events, and makes menus work
again.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
ef1e900a53 gtkmenuitem: Remove input window
It's not necessary anymore to receive events.
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
846e6dc0b1 menus: Use gtk_widget_measure to measure widget sizes 2017-03-04 08:44:49 +01:00
Timm Bäder
56a58655fe Remove unnecessary gtk_widget_show calls 2017-01-22 14:38:21 +01:00
Timm Bäder
13b001b77c widget: Remove show_all vfunc 2017-01-20 21:33:38 +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
65e9894450 menu: Implement snapshot() for the menu code 2016-12-20 18:01:11 +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
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
6150ce4484 menuitem: Stop looking at nonexistant child properties 2016-10-20 20:12:05 +02:00
Timm Bäder
8cafd3c5a7 menuitem: Stop implementing GtkActivatable 2016-10-18 00:29:18 +02:00
Timm Bäder
ac72d96a8a menuitem: Remove right-justify 2016-10-18 00:29:17 +02:00
Benjamin Otte
6117f042a8 menuitem: Use 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