Commit Graph

485 Commits

Author SHA1 Message Date
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
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
4ed9452e90 API: menu: Remove tearoff support 2016-10-16 18:17:21 +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
Matthias Clasen
2de6b0800d menu: Fix up new properties
The new positioning-related properties had some quality of
implementation issues, such as incorrect initial values and
excessive change notification. This broke the notify test.
2016-08-02 23:57:37 -04:00
William Hua
b03361366a gtkmenu: add gtk_menu_popup_at_* ()
Adds the following functions:

gtk_menu_popup_at_rect ()
gtk_menu_popup_at_widget ()
gtk_menu_popup_at_pointer ()

https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-07-19 09:38:54 -04:00
Matthias Clasen
eff09fabfa menu: Free gadgets in finalize
This is the right place to do this.
2016-06-05 20:00:43 -04:00
Matthias Clasen
0f476590fb Make gdk_event_get_pointer_emulated public
There is not strong reason to keep the getter private.
At the same time, strip _-prefixes from a few other GdkEvent
APIs. Update all callers.
2016-05-10 15:16:45 -04:00
Olivier Fourdan
126156e820 gtkmenu: ignore left/right scroll events
Menus are placed vertically by definition, it does not make much sense
to support horizontal axis for scrolling.

Use GDK_EVENT_STOP/GDK_EVENT_PROPAGATE instead of TRUE/FALSE and add a
default case to return GDK_EVENT_PROPAGATE for unhandled events.

https://bugzilla.gnome.org/show_bug.cgi?id=765939
2016-05-10 15:58:02 +02:00
Olivier Fourdan
c134d52dd7 gtkmenu: ignore emulated scroll events
On X11, we get both smooth and emulated scroll events, whereas other
backends such as wayland will give smooth events only with touchpad
scrolling.

Discard emulated scroll events so that we get consistent behaviours
between backends.

Allow for both horizontal and vertical smooth events for scrolling so
that horizontal scrolling still works without emulated scroll events as
well, again for consistency between gdk backends.

https://bugzilla.gnome.org/show_bug.cgi?id=765939
2016-05-10 15:58:02 +02:00
Matthias Clasen
1b7d7c857f menu: Add new monitor api
This will work better with the new monitor api in gdk.
2016-04-27 23:18:16 -04:00
Benjamin Otte
cd78fa15ed menu: Clip children to view window
Don't overdraw the arrow allocations.

https://bugzilla.gnome.org/show_bug.cgi?id=764118
2016-03-24 20:25:49 +01:00
Matthias Clasen
ea4cff1ea4 Use convenience API that was introduced recently
Use gtk_css_gadget_set_state in all the places where we previously
were getting a node from a gadget, just to call gtk_css_node_set_state.
2016-01-13 00:19:31 -05:00
Cosimo Cecchi
485c28d300 menu: port arrow rendering to use a GtkBuiltinIcon
At the same time, remove one spurious background/frame rendering, and
simplify the code a great deal.
2015-12-21 09:22:16 -08:00
Cosimo Cecchi
655132b87c menu: deprecate double-arrows style property
It does not sound like a good idea anymore to have a style property
change the layout of the menu this drastically.
2015-12-21 09:22:16 -08:00
Cosimo Cecchi
b664ba50c0 menu: deprecate arrow-placement style property
It does not sound like a good idea anymore to have a style property
change the layout of the menu this drastically.
2015-12-21 09:22:16 -08:00
Cosimo Cecchi
5a87b5bbce menuitem: deprecate toggle-spacing style property
We can move this to just use the actual GtkCssGadget of the menu item.
2015-12-19 21:21:16 -08:00
Carlos Garnacho
04d7bd49d0 GtkMenu: Avoid GdkDeviceManager API
We used to pick a master pointer "at random", use the default seat pointer
instead.
2015-12-16 19:47:07 +01:00
Matthias Clasen
2f544655f9 Revise CSS node documentation
Clarify the use of brackets in the CSS node diagrams:
[] means optional nodes or classes, <> means child widgets.
2015-12-16 10:58:47 -05:00
Carlos Garnacho
d54f208d29 GtkMenu: Use gdk_seat_grab()
https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-15 00:32:55 +01:00
Benjamin Otte
971a277419 cssnode: Change style-changed signal
Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.

This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
2015-12-12 02:16:04 +01:00
Timm Bäder
2182fe7d9d Don't pass widget state flags to GtkStyleContext API 2015-11-22 17:11:35 +01:00
Matthias Clasen
8e5c7ac028 menu: Add diagrams to CSS documentation 2015-11-03 14:27:35 -05:00
Matthias Clasen
2ba957364d menu: Fix up CSS node ordering
Keep the bottom arrow node at the end, where it belongs.
2015-11-02 21:49:10 -05:00
Matthias Clasen
25e01a3937 menu: Document CSS nodes 2015-11-02 21:40:40 -05:00
Matthias Clasen
0b52b29dfc menu: Port to use css nodes
Use the element name menu for the main node, and use two subnodes
with name arrow and style classes .top and .bottom for the arrows
of scrolling menus.
2015-11-02 20:47:55 -05:00
Alexander Larsson
d5f1754981 gtk: Stop setting GDK_EXPOSURE_MASK on random widgets
These days exposure happens only on the native windows (generally the
toplevel window) and is propagated down recursively. The expose event
is only useful for backwards compat, and in fact, for double buffered
widgets we totally ignore the event (and non-double buffering breaks
on wayland).

So, by not setting the mask we avoid emitting these events and then
later ignoring them.

We still keep it on eventbox, fixed and layout as these are used
in weird ways that want backwards compat.
2015-09-14 11:01:13 +02:00
Jonas Ådahl
955c1c7734 GtkMenu: Properly detach menu when the window is detached
Without properly cleaning up GtkMenu private attach state
(GtkMenuAttachData) when the attached widget is freed, we would end up
with an invalid pointer to a freed widget. Trying to detach from that
widget would cause a segmentation fault.

https://bugzilla.gnome.org/show_bug.cgi?id=752761
2015-07-26 01:57:26 -04:00
Cosimo Cecchi
828db3eca9 menu: don't call gtk_style_context_set_background() 2015-07-01 16:09:22 -07:00
Matthias Clasen
e367c4baa0 Deal with events from wrong display
GtkInspector is opening a separate display connection, which makes
it more likely that gtk_get_current_event() returns an event from
the "wrong" display.
2015-06-15 19:50:02 -04:00
Matthias Clasen
a0dddbbafa menu: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Alberts Muktupāvels
bdaef1f88d gtkmenu: fix unnecessary scroll buttons
Don't change menu height if menu is out of monitor only by shadow
width.

https://bugzilla.gnome.org/show_bug.cgi?id=738321
2014-11-02 22:11:03 -05:00
Benjamin Otte
f4e44e9e6e menu: Respect borders properly for scroll arrows 2014-10-12 00:25:23 +02:00
Matthias Clasen
dcf80f3df5 Add top/bottom style classes to scroll arrows 2014-10-10 07:44:03 -04:00
Marek Kasik
8b5d30d439 Remove redundant checks for NULL
Remove checks for NULL before g_free() and g_clear_object().
Merge check for NULL, freeing of pointer and its setting
to NULL by g_clear_pointer().

https://bugzilla.gnome.org/show_bug.cgi?id=733157
2014-10-02 19:06:03 +02:00
Matthias Clasen
c0685c0f58 Fix comment typo 2014-09-24 20:31:11 -04:00
Volker Sobek
a80e77ff95 GtkMenu: Don't subtract shadow from requisition
This was causing menus to show up in the wrong position in case the menu
popped up towards the top and/or left.

The change to the requisition was in error; it is the allocated size
of the menu, not the toplevel, and doesn't include the shadow.

https://bugzilla.gnome.org/show_bug.cgi?id=591258
2014-07-16 23:29:35 -04:00
Matthias Clasen
e97cf2fd0b Add GTK_STYLE_CLASS_POPUP to the docs 2014-06-12 09:22:06 -04:00
Matthias Clasen
dae252e3d2 Request csd for menus
Use the new private GtkWindow api to request
client-side decorations for menus.

https://bugzilla.gnome.org/show_bug.cgi?id=731187
2014-06-09 14:15:24 -04:00
Matthias Clasen
3cf916be8a GtkMenu: Add a separate style class to the toplevel of menus
This is necessary in order to use .window-frame.csd.popup for
styling csd menus.

https://bugzilla.gnome.org/show_bug.cgi?id=731187
2014-06-09 14:14:48 -04:00
Matthias Clasen
e9ed210b0b GtkMenu: take csd shadows into account for placement
When placing menus, we don't want the shadow to influence
our choice.

https://bugzilla.gnome.org/show_bug.cgi?id=731187
2014-06-09 14:01:42 -04:00
Matthias Clasen
60fbb2bb89 GtkMenu: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:05 -04:00
Benjamin Otte
2a99584c68 API: Deprecate gtk_widget_reparent() 2014-05-17 23:36:57 +02:00
Jasper St. Pierre
75ecdf50a3 wayland: Fix GtkMenuButton popups in a terrible, hacky way
Since you can't take grabs on unmapped windows, GtkMenu takes a grab on
the menu in a convoluted way: it first grabs another window, shows the
menu window, and then transfers the grab over to the GtkMenu widget.

For normal menubars, this is perfectly fine, as the first window it grabs
is our toplevel, and that gets picked up in our transient path.  For
GtkMenuButton or other spurious uses of gtk_menu_popup, it creates a new
temporary input-only window which it takes the grab on, known as the "grab
transfer window". Since this window isn't a transient-for of our new menu
widget window, the grab isn't noticed when we go to show it, and thus the
menu ends up as a new toplevel.

Add a special hack to GtkMenu and the Wayland backend which lets us notice
this "grab transfer window", and include it in our grab finding path.

It's sort of terrible to have to hack up the widgets instead of just the
backend, but the alternative would be an entirely new window type which is
managed correctly by GDK. I don't want to write that.
2014-05-15 18:02:45 -04:00