Commit Graph

596 Commits

Author SHA1 Message Date
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
Timm Bäder
2397d76137 label: Remove some unneeded conditionals
We are never passing NULL here.
2016-01-14 16:02:12 +01: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
Florian Müllner
e20826fe03 label: Deny drag gesture when not selectable
We don't actually do anything when the label is not selectable
except for consuming the event, which breaks for instance titlebar
drags with labels that contain links. Simply deny the gesture in
that case to allow the event to bubble up normally.

https://bugzilla.gnome.org/show_bug.cgi?id=759798
2015-12-23 14:07:00 +01:00
Matthias Clasen
f54e0a283b label: Allocate gadget before using it
Move the gtk_css_gadget_allocate call before the
gtk_label_update_layout_width call. This fixes the
statusbar label in widget-factory page 2 coming
up fully ellipsized.
2015-12-19 00:33:20 -05:00
Benjamin Otte
dd90e020a2 label: Don't use _gtk_mis_get_padding_and_border()
The function takes into account CSS padding and border, which these days
is handled by the gadget code. Use gtk_misc_get_padding() instead.
2015-12-19 06:13:56 +01:00
Benjamin Otte
197e42efd8 label: Position the text properly
The PangoLayout needs to be positioned according to the content
allocation of the gadget, not the widget's allocation.
2015-12-16 20:39:51 +01:00
Matthias Clasen
a81267c28e label: Convert to gadgets
This removes some hairy code handling with borders and padding,
which may or may not be correct. The examples in testheightforwidth
all continue to work, and min-width now works for labels.
2015-12-15 08:41:16 -05:00
Benjamin Otte
5cbbc62026 widget: Pass a GtkCssStyleChange instead of a bitmask 2015-12-13 04:11:58 +01:00
Timm Bäder
1db5ed0aae GtkLabel: Create gestures only when needed
And move them into the GtkLabelSelectionInfo struct.
2015-11-20 16:45:17 +01:00
Matthias Clasen
3811eb4f32 label: Use css nodes for links
Use a subnode with name link for links in labels. These subnodes
carry the :link or :visited state.
2015-11-15 01:04:27 -05:00
Matthias Clasen
fafa75ac19 label: Use a CSS node for selection rendering
This adds new possibilities for themes to render the selection
in fancy ways.
2015-11-10 20:28:10 -05:00
Matthias Clasen
953aa45c04 label docs: Mention common style classes
Mention some of the style classes that are commonly used
with labels.
2015-10-26 07:23:07 -04:00
Matthias Clasen
7d98c7f1ae label: Use the element name label
Set the element name on the CSS node, and drop the .label style
class.
2015-10-22 23:27:43 -04:00
Matthias Clasen
3c54fbd3ac Use stupid quotes instead of dumb quotes
Following a similar change in GLib a while ago.

'bla' may by stupid, but it looks less dumb than `bla'.
2015-09-23 07:01:16 -04:00
Matthias Clasen
1bb86c2056 label: Avoid recalculation in some cases
Avoid recalculation the entire label layout when nothing changed.
2015-09-23 07:01:15 -04:00