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
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
3c901d6376
Remove a few more 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
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
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
b5fb9ae3b7
gtk: Port to new monitor api
...
Use the GdkDisplay monitor api instead of the GdkScreen one.
2016-04-27 23:18:16 -04:00
Matthias Clasen
96f0ed9ec5
menuitem: Fix some possible problems with arrow_gadget
...
https://bugzilla.gnome.org/show_bug.cgi?id=765134 shows
a stacktrace where we end up with arrow_gadget being NULL
despite the conditions for its presence being satisfied.
This commit makes sure we call update_arrow_gadget() whenever
any of the conditions changes. This should fix the reported
crash.
2016-04-17 01:09:32 -04:00
Alberto Ruiz
496f0892fc
introspection: This patch fixes nullable return values fixes for the following symbols in gtk
...
gtk_accel_group_query
gtk_accel_group_from_accel_closure
gtk_accel_label_get_accel_widget
gtk_accessible_get_widget
gtk_actionable_get_action_name
gtk_app_chooser_get_app_info
gtk_app_chooser_button_get_heading
gtk_app_chooser_dialog_get_heading
gtk_application_get_window_by_id
gtk_assistant_get_nth_page
gtk_binding_set_find
gtk_builder_get_object
gtk_builder_lookup_callback_symbol
gtk_builder_get_application
gtk_button_get_image
gtk_cell_area_get_focus_from_sibling
gtk_cell_renderer_start_editing
gtk_cell_view_get_model
gtk_cell_view_get_displayed_row
gtk_clipboard_get_owner
gtk_container_get_focus_child
gtk_container_get_focus_vadjustment
gtk_container_get_focus_hadjustment
gtk_dialog_get_widget_for_response
gtk_drag_get_source_widget
gtk_drag_dest_get_target_list
gtk_drag_source_get_target_list
gtk_entry_completion_get_model
gtk_entry_completion_compute_prefix
gtk_expander_get_label_widget
gtk_file_chooser_get_filename
gtk_file_chooser_get_current_folder
gtk_file_chooser_get_uri
gtk_file_chooser_get_current_folder_uri
gtk_file_chooser_get_preview_widget
gtk_file_chooser_get_preview_file
gtk_file_chooser_get_preview_filename
gtk_file_chooser_get_preview_uri
gtk_file_chooser_get_extra_widget
gtk_file_chooser_get_filter
gtk_file_chooser_native_get_accept_label
gtk_file_chooser_native_get_cancel_label
gtk_file_filter_get_name
gtk_font_chooser_get_font_family
gtk_font_chooser_get_font_face
gtk_font_chooser_get_font
gtk_font_chooser_get_font_desc
gtk_font_chooser_get_font_map
gtk_frame_get_label
gtk_gesture_get_device
gtk_gesture_get_window
gtk_gl_area_get_error
gtk_header_bar_get_title
gtk_header_bar_get_subtitle
gtk_header_bar_get_custom_title
gtk_icon_info_get_filename
gtk_icon_view_get_path_at_pos
gtk_icon_view_get_model
gtk_image_get_pixbuf
gtk_image_get_animation
gtk_label_get_mnemonic_widget
gtk_label_get_attributes
gtk_check_version
gtk_menu_button_get_popup
gtk_menu_button_get_menu_model
gtk_menu_button_get_align_widget
gtk_menu_button_get_popover
gtk_menu_item_get_submenu
gtk_menu_item_get_accel_path
gtk_native_dialog_get_title
gtk_native_dialog_get_transient_for
gtk_notebook_get_nth_page
gtk_notebook_get_tab_label_text
gtk_notebook_get_menu_label
gtk_notebook_get_menu_label_text
gtk_notebook_get_group_name
gtk_notebook_get_action_widget
gtk_offscreen_window_get_surface
gtk_offscreen_window_get_pixbuf
gtk_paned_get_child1
gtk_paned_get_child2
gtk_places_sidebar_get_location
gtk_places_sidebar_get_nth_bookmark
gtk_plug_get_socket_window
gtk_popover_get_default_widget
gtk_progress_bar_get_text
gtk_recent_filter_get_name
gtk_recent_manager_lookup_item
gtk_settings_get_default
gtk_socket_get_plug_window
gtk_stack_sidebar_get_stack
gtk_stack_switcher_get_stack
gtk_style_context_get_section
gtk_style_context_get_parent
gtk_style_context_get_frame_clock
gtk_test_find_widget
gtk_text_buffer_get_mark
gtk_text_tag_table_lookup
gtk_text_view_get_tabs
gtk_text_view_toggle_cursor_visible
gtk_text_view_get_window
gtk_toolbar_get_nth_item
gtk_tool_button_get_label
gtk_tool_button_get_icon_name
gtk_tool_button_get_label_widget
gtk_tool_button_get_icon_widget
gtk_tool_palette_get_drop_item
gtk_tool_palette_get_drop_group
gtk_tree_model_filter_convert_child_path_to_path
gtk_tree_model_filter_convert_path_to_child_path
gtk_tree_model_sort_convert_child_path_to_path
gtk_tree_model_sort_convert_path_to_child_path
gtk_tree_view_get_column
gtk_tree_view_get_bin_window
gtk_tree_view_column_get_widget
gtk_tree_view_column_get_tree_view
gtk_widget_get_frame_clock
gtk_window_group_get_current_device_grab
GtkTextBufferSerializeFunc
2016-01-08 12:18:23 +00:00
Cosimo Cecchi
0740f23c77
menuitem: don't read wide-separators or separator-height
...
Separators inside menus are working completely through CSS since
GtkMenuItem has been ported to use a gadget.
Remove this unused code from here.
2016-01-03 00:42:51 -08:00
Cosimo Cecchi
664bbe12ba
menuitem: move chaining up to draw inside gadget
...
This is more consistent with what other widgets do.
2016-01-02 15:31:21 -08:00
Cosimo Cecchi
354eb5678b
menuitem: fix a crash when reserve_indicator is TRUE
...
In that case, code expects an arrow gadget to be present but we're not
creating it in every occurrence.
Fix it by ensuring there will be an arrow gadget when reserve_indicator
is TRUE.
2015-12-29 18:31:10 -08:00
Cosimo Cecchi
efb8e5bd43
menuitem: don't use content allocation to resize the GdkWindow
...
This is a fallout from the gadget conversion.
2015-12-22 15:36:00 -08:00
Matthias Clasen
164e8ed6bd
menuitem: Simplify separators
...
For regular separators, we just rely on standard CSS background
rendering nowadays. Do the same for separators in menus.
https://bugzilla.gnome.org/show_bug.cgi?id=759765
2015-12-22 10:30:51 -05:00
Cosimo Cecchi
729801c2a1
menuitem: trivial doc improvement
2015-12-21 09:22:16 -08:00
Cosimo Cecchi
ce6cd49475
menuitem: port arrow gadget to GtkBuiltinIcon
...
Saves a lot of code.
2015-12-19 21:22:37 -08:00
Cosimo Cecchi
22ec899f23
menuitem: simplify code
...
Only cast once.
2015-12-19 21:22:37 -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
Cosimo Cecchi
3af5c83cd3
checkmenuitem: use a gadget for the check indicator
...
This will make margins and other CSS properties work correctly on the
indicator.
2015-12-19 21:21:16 -08:00
Cosimo Cecchi
b602dc2eed
menuitem: trivial cleanup
2015-12-19 21:21:16 -08:00
Cosimo Cecchi
7959c3fb6e
menuitem: deprecate arrow-scaling style property
...
With this, we can also remove the custom measure function of the arrow
gadget.
2015-12-19 21:21:16 -08:00
Cosimo Cecchi
2d5d7d8cf2
menuitem: convert arrow rendering to GtkCssGadget
...
This also deprecates the arrow-spacing style property, which can be now
replaced with a simple margin.
2015-12-19 21:21:16 -08:00