Commit Graph

529 Commits

Author SHA1 Message Date
Matthias Clasen
8476fc3fb0 menu: Stop using GdkEventWindowState
These events are going away.
2017-12-14 22:24:06 -05:00
Carlos Garnacho
d491e49fd6 gtk: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +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
dcc2577b97 introspection: Fix build 2017-11-15 19:33:26 +01:00
Matthias Clasen
a3cffa5072 Drop GdkScreen from GdkDevice apis
Returning the screen does not add anything here and
GdkScreen is going away.
2017-10-31 12:30:38 -04: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
1c36c6ed4d widget: Remove gtk_widget_has_screen()
All widgets always have a screen (or display).
2017-10-31 04:33:11 +01:00
Matthias Clasen
f63d01b782 gtk: Stop using gdk_event_get_screen
Use gdk_event_get_display instead.
2017-10-30 22:22:00 -04:00
Benjamin Otte
44614394e6 widget: Turn screen-changed signal into display-changed 2017-10-31 00:43:11 +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
d0e27ba760 gtkmenu: Use scroll event controller 2017-09-19 18:40:49 +02:00
Carlos Garnacho
e023367a8a menu: Update to using GdkEvent API
To some extent, plenty of root coordinate calculations left...
2017-09-19 18:39:02 +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
3dc6d240b3 Fix a few allocation coordinates & sizes 2017-07-19 21:27:15 -04:00
Timm Bäder
bc4c32505a menu: Popup at window coordinates if widget is given
Since widget allocations are now relative to the parent's origin, we
need to pass the window allocation here.
2017-07-19 21:27:14 -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
f50bbb10df menu: Remove bin_window and view_window 2017-07-19 21:27:13 -04:00
Timm Bäder
4f0140fa6c Remove GtkBuiltinIcon
Now unused.
2017-07-19 21:27:13 -04:00
Timm Bäder
7c77fd9e62 menu: Replace arrow gadgets with GtkIcons 2017-07-19 21:27:12 -04:00
Timm Bäder
fb78c3b7e8 checkmenuitem: Replace indicator gadget with GtkIcon 2017-07-19 21:27:12 -04:00
Timm Bäder
2e4df25a1d menu: Stop drawing css background and border
GtkWidget does it now
2017-07-19 21:27:12 -04:00
Timm Bäder
1a1f9fd03c menu: Remove unnecessary queue_draw 2017-07-19 21:27:12 -04:00
Timm Bäder
c35a78110c menu: Stop looking at padding and margin manually 2017-07-19 21:27:12 -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
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
846e6dc0b1 menus: Use gtk_widget_measure to measure widget sizes 2017-03-04 08:44:49 +01:00
Timm Bäder
13b001b77c widget: Remove show_all vfunc 2017-01-20 21:33:38 +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
Benjamin Otte
65e9894450 menu: Implement snapshot() for the menu code 2016-12-20 18:01:11 +01:00
Timm Bäder
1aa1676d9d menu: Replace button-press-handler with gesture 2016-12-07 18:06:37 +01:00
Matthias Clasen
3414f10bad Drop the GDK_PRIVATE_CALL mechanism
We don't need to do this extra complication anymore, since
we're now living inside a single shared library.
2016-11-23 19:31:16 -05:00
Matthias Clasen
3a947fa318 menu: Don't leak check menu items
Pointed out in
https://bugzilla.gnome.org/show_bug.cgi?id=774686
2016-11-23 14:48:17 -05:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Matthias Clasen
8afb655347 Document gtk_menu_place_on_monitor 2016-11-19 13:51:50 -05:00
Benjamin Otte
3b93773add API: gdk: Add gdk_window_new_temp()
Your one stop shop for all those nasty hidden input-only windows.
2016-11-07 01:03:17 +01:00
Timm Bäder
a5b967ed31 menu: Properly clip child menuitems
Now that GtkMenu isn't a windowed widget anymore, we have to
differentiate between the (0, 0) of the cairo_t and the position of
priv0->view_window.
2016-11-05 13:39:41 +01:00
Benjamin Otte
b9955cfff1 API: gdk: Remove override_redirect flag from GdkWindowAttr
When you want an override-redirect window, you create it that way by
creating a GDK_WINDOW_TEMP window.
2016-11-05 03:32:27 +01:00
Benjamin Otte
bb8b24da47 menu: Don't set widget->window
Instead, create an input window for the menubar and omit the window for
the menu itself.
2016-11-02 22:00:29 +01:00
Benjamin Otte
8202d3fe89 menu: Remove unneeded invalidations
The gadgets should take care of those themselves
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
Jonas Ådahl
11b5cfbc50 GtkMenu: Try using gdk_window_move_to_rect() more often
With best-effort, try to use gdk_window_move_to_rect() more often, when
all pieces fit together. For the non-legacy paths to be triggered for
when gtk_menu_popup_for_device() or gtk_menu_popup() were used, the
following conditions must be met:

 1) There is no custom positioning function specified
 2) The menu is attached to a widget (using gtk_menu_attach_to_widget())
 3) There is a associated grab device

https://bugzilla.gnome.org/show_bug.cgi?id=772922
2016-10-21 11:54:54 -04:00
Timm Bäder
7d84f744c2 menu: Remove vertical/horizontal-offset style properties 2016-10-18 00:29:16 +02:00
Benjamin Otte
c599f6b9cb menu: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Benjamin Otte
6c7b6f9654 menu: Modernize code
No functional changes, just don't call valist functions anymore.
2016-10-16 18:18:58 +02:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +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
999d45b4e8 Remove various unused style properties 2016-10-16 18:17:21 +02:00