Commit Graph

1629 Commits

Author SHA1 Message Date
Timm Bäder
08c1c584b3 Remove GtkModifierStyle 2016-10-16 18:17:21 +02:00
Timm Bäder
9a388690f4 widget: Remove gtk_widget_override* API 2016-10-16 18:17:21 +02:00
Timm Bäder
b1d35a594e widget: Remove text-handle-width/height style properties 2016-10-16 18:17:21 +02:00
Timm Bäder
999d45b4e8 Remove various unused style properties 2016-10-16 18:17:21 +02:00
Timm Bäder
2455bd0857 widget: Remove visibility-notify-event 2016-10-16 18:17:21 +02:00
Timm Bäder
878f2e4107 widget: Remove deprecated margin-left/right properties 2016-10-16 18:17:21 +02:00
Timm Bäder
d34b7d98b2 widget: Remove gtk_widget_{s,g}et_composite_name 2016-10-16 18:17:21 +02:00
Timm Bäder
80ab5ea942 widget: Remove gtk_widget_get_requisition 2016-10-16 18:17:21 +02:00
Timm Bäder
16b0906b4a widget: Remove gtk_widget_send_expose 2016-10-16 18:17:21 +02:00
Timm Bäder
bc0cef27a2 widget: Remove gtk_widget_{s,g}et_state 2016-10-16 18:17:21 +02:00
Timm Bäder
4a2c087a1e widget: Remove gtk_widget_region_intersect 2016-10-16 18:17:21 +02:00
Timm Bäder
a80a1cf8a6 widget: Remove gtk_widget_get_child_requisition 2016-10-16 18:17:21 +02:00
Timm Bäder
b3bd5fefb1 widget: Remove gtk_widget_size_request 2016-10-16 18:17:21 +02:00
Timm Bäder
4c10807e24 widget: Remove state-changed signal 2016-10-16 18:17:21 +02:00
Timm Bäder
96d9abded8 widget: Remove deprecated style properties 2016-10-16 18:17:21 +02:00
Benjamin Otte
0df388051d API: Remove GtkStyle
All the remaining gtkrc.c stuff like GtkRcStyle goes with it.
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
021fe010b6 API: Remove GtkPlug, GtkSocket and GtkWin32EmbedWidget 2016-10-16 18:17:21 +02:00
Benjamin Otte
89f2e17f91 API: Remove gdk_window_set_composited()
And the related call gdk_display_supports_composite().
2016-10-16 18:17:21 +02:00
Benjamin Otte
fec8069e7b API: screen: Stop storing font options
font options are only ever set by the GtkSettings object and only ever
used inside GTK, so just store them there.
2016-10-16 18:17:21 +02:00
Benjamin Otte
d09e48cec1 API: Remove -gtk_widget_get_root_window() 2016-10-16 18:17:21 +02:00
Christoph Reiter
ae8ffc775d widget: Don't print underallocation warnings by default
See similar changes:
    https://git.gnome.org/browse/gtk+/commit/?id=1b15588732f2c4e3c59994a59613d4e5c963e283
    https://git.gnome.org/browse/gtk+/commit/?id=54fdcb3ffac3383432b379f3e16e8cb0086b8101

https://bugzilla.gnome.org/show_bug.cgi?id=770388
2016-09-30 14:41:01 -04:00
Timm Bäder
54fdcb3ffa widget: Don't print missing allocation warning by default
This was meant to be silenced unless expicitly requested but
G_ENABLE_DEBUG is defined by default unless --disable-debug is passed to
configure, so use G_ENABLE_CONSISTENCY_CHECKS instead which is only
defined if --enable-debug is explicitly passed.
2016-09-22 09:01:06 +02:00
Emmanuele Bassi
bb705837bc Ensure drawing context is set
If somebody decides to use gtk_widget_set_double_buffered() in the
middle of a draw() then there's the risk of calling end_draw_frame()
with an invalid pointer.

Some overeager compilers may warn about the double_buffered bit field
changing values and leading to a potentially uninitialized variable.

In order to avoid compiler warnings or crashes, we can simply store the
value of the double_buffered bit field at the beginning of the rendering
and use that instead of the actual bit field.

https://bugzilla.gnome.org/show_bug.cgi?id=771463
2016-09-15 10:17:24 +01:00
Timm Bäder
5ea69a136b widget: Only warn about missing allocation if G_ENABLE_DEBUG
Not all occurrences of this warning can be fixed today, so put it behind
a G_ENABLE_DEBUG flag since it still shows legitimate problems even if
some of them are false positives.
2016-09-14 18:06:54 -04: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
Carlos Garnacho
3a6d0ff2ab gtk: Add minimal handling of pad events
No real handling is yet performed, to be done through a GdkEventController

https://bugzilla.gnome.org/show_bug.cgi?id=770026
2016-08-23 21:01:44 +02:00
Timm Bäder
50a0c5f242 widget: remove some unneeded function prototypes 2016-08-04 13:09:08 +02:00
Sébastien Wilmet
af5ef152b1 docs: GtkWidget::style-updated vs GtkStyleContext::changed
Explain the difference between those two signals.

Add "Since: 3.0" for GtkStyleContext::changed, since that signal has
been added in commit 9f84e101bf, present
since 2.91.6.

https://bugzilla.gnome.org/show_bug.cgi?id=769047
2016-07-25 09:26:41 -04:00
Sébastien Wilmet
3432587f89 docs: add missing info for gtk_widget_get_style_context()
It is important to know whether the returned object can or cannot
change, for a certain widget. For example to connect to the
GtkStyleContext::changed signal.

https://bugzilla.gnome.org/show_bug.cgi?id=769047
2016-07-25 09:26:41 -04:00
Matthias Clasen
8db8891c66 Use g_clear_object in a few more places 2016-07-25 08:32:08 -04:00
Emmanuele Bassi
8f1fd7d964 docs: Fix typo. 2016-07-12 18:09:20 +01:00
Emmanuele Bassi
c0dae6c146 docs: Attempt a better explanation for gtk_widget_destroy()
Clarify the nature of this function, and the expectations after it's
been called.
2016-07-12 12:44:23 +01:00
Timm Bäder
d52f6ff710 widget: Don't unnecessarily export function
_gtk_widget_get_translation_to_window is only used in gtkwidget.c
2016-06-27 14:43:53 +02:00
Emmanuele Bassi
40ee61a686 gtk: Keep Firefox working in the DrawingContext world
Firefox does a bunch of interesting things with GTK.

If the top-level GtkWindow does not have a "csd" style class associated,
Firefox will happily draw the contents of the container used to render
HTML and XUL directly on the top level's GdkWindow; on the other hand,
if a "csd" style class is found, the MozContainer will create a new
child window, and draw on it.

Then, Firefox will proceed to disable double buffering on both the
top-level window and the MozContainer (unless they are backed by the
same GdkWindow, in which case only the top-level will be
single-buffered) *and* it will add a GDK_EXPOSURE_MASK flag to the
MozContainer events for good measure (even if this is only needed for
GTK+ 2.x).

After landing the GdkDrawingContext API in GdkWindow, GTK enabled
automatic double buffering on all top-level windows backed by a native
surface, ad most users of single buffering rely on child widgets instead
of top-levels, and we'd still like to have the same double buffering
behaviour for all top-levels on all backends. Obviously, with Firefox
disabling double buffering on the top-level window, the change broke
their drawing mechanism.

Ideally, Firefox could be fixed to not disable double buffering on the
top-level window when MozContainer has a separate GdkWindow — i.e. the
CSD case — but since we did introduce a slight change of behaviour in
fringe users of the GTK+ API, let's keep backwards compatibility with
the old code for a little while longer, and create an intermediate Cairo
context unbound from the GdkDrawingContext, like we used to do until
GTK+ 3.20.
2016-06-22 11:41:59 +01:00
Emmanuele Bassi
c3f4fe334d Deprecate gtk_widget_send_expose()
We have various replacements for what this function does, and we are not
calling it internally any more.
2016-06-10 16:13:27 +01:00
Emmanuele Bassi
c5d0522a23 Deprecate the gdk_window_begin/end_paint family of functions
They are replaced by the more appropriate gdk_window_begin_draw_frame()
and gdk_window_end_draw_frame() functions.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
dda6a0d385 Associate the drawing context to the Cairo context
Instead of associating the GdkWindow that created the GdkDrawingContext
we can directly bind the Cairo context to the GDK drawing context.

Cairo contexts created via gdk_cairo_create() go back to not having a
GdkWindow associated to them, like they did before we introduced the
gdk_window_begin_draw_frame() API.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
a7ef37da2a Add GdkDrawingContext
Instead of giving out Cairo contexts, GdkWindow should provide a
"drawing context", which can then create Cairo contexts on demand; this
allows us to future proof the API for when we're going to use a
different rendering pipeline, like OpenGL.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
2c7b21718f Simplify the widget rendering entry point
Now that GDK has the appropriate API, we can simplify the widget drawing
code into a single function.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Benjamin Otte
775e277ab9 widget: Add classes to widget path even if no style context exists yet
This removes leftover code from when classes where added to the style
context.
Now that they get added directly to css nodes, the classes can exist
without a style context.

https://bugzilla.gnome.org/show_bug.cgi?id=767312
2016-06-07 16:12:18 +02:00
Timm Bäder
a961b05200 widget: Avoid a deprecation warning 2016-06-02 21:52:11 +02:00
Matthias Clasen
f168de3ada Add a warning for a broken situation
When we emit ::draw, the widget should not have alloc_needed set
anymore. If this happens, it indicates a broken situation. Add a
warning to help tracking down why this might occur.

See https://bugzilla.gnome.org/show_bug.cgi?id=765410
2016-05-30 16:19:29 -04:00
Matthias Clasen
b90ae2cfbf Add a deprecation note
Mark GtkWidget:style property as deprecated in the docs.
2016-05-23 20:40:03 -04:00
Alban Browaeys
cd305c1970 widget: fix GtkLabelAccessible NULL links.
Fix testsuite/a11y/about.ui GtkAboutDialog :
"CRITICAL **: atk_hyperlink_get_start_index: assertion 'ATK_IS_HYPERLINK (link)' failed"
That is set widget->priv->accessible as soon as accessible object is generated.

When accessible object is created accessible->priv->widget is set,
if widget->priv->accessible is not , then _gtk_label_accessible_update_links
exits early, thus without creating the links on the accessible side.
(This as it checks for the widget to have the accessible set before proceeding).

https://bugzilla.gnome.org/show_bug.cgi?id=766458
2016-05-15 10:24:34 -04:00
Benjamin Otte
ddcf47026d widget: No longer postpone style-updated on unrealized widgets
GTK used to not emit GtkWidget::style-updated on widgets that weren't
realized. This sped up construction of complex widgetry in the early
days of GTK3 where we instantly invalidated on every change.
We don't do that anymore, so in theory (and in my limited testing with
widget-factory) this shouldn't be a prolem anymore.

What is a problem though is that postponing style-updated leads to 2
problems:
(1) Unrealized widgets will not emit style-updated which may cause them
    to not properly update their state and return wrong values from
    get_preferred_width/height() etc
(2) Emitting style-updated during realize can happen too late.
    When a widget is not made child-visible by its parent (common
    examples: notebook, paned) it will also not be realized when the
    parent is initially shown. However, when they get realized later
    (after a resize of the parent), they will emit style-updated (and
    potentially queue a resize) during size-allocate.

https://bugzilla.gnome.org/show_bug.cgi?id=765700
2016-05-14 18:48:22 +02:00
Timm Bäder
7116988bcb widget: Add Since annotation to gtk_widget_queue_allocate 2016-05-10 12:53:42 +02:00
Ray Strode
3cba63b2f8 widget: add missing detail to ::query-tooltip emission
This was an oversight in commit dfb368e29bb58b4313b578f0ce75cfc8ead9a1.
2016-05-06 22:31:45 -04:00
Matthias Clasen
3c09783005 Clean up builder parser data after parsing
No need to have these linger around in qdata.
2016-05-06 16:09:12 -04:00
Matthias Clasen
0f116135f4 Avoid emitting ::style-set by name
GtkStyle is deprecated, but we still emit ::style-set quite
a bit, so lets at least not be slow while doing it.
2016-05-06 10:14:07 -04:00
Matthias Clasen
12dfb368e2 Don't emit ::query-tooltip by name
This signal is emitted quite a bit, and we can easily avoid it.
2016-05-06 10:14:07 -04:00
Matthias Clasen
64710def82 Stop storing has-tooltip in qdata
This is queried quite a bit, and we have room for an extra
bit in GtkWidgetPrivate.
2016-05-06 10:14:07 -04:00
Matthias Clasen
ff3264b4c5 widget: Store accessible in GtkWidgetPrivate
Every widget may have one of these, and they are accessed somewhat
frequently.
2016-05-06 06:44:28 -04:00
Matthias Clasen
46edfaa89c Fix indentation mishap 2016-05-06 06:44:28 -04:00
Matthias Clasen
5b19747ef8 Revert "When creating a widget path, use the widget type"
This reverts commit 0d78b67bca.

As Benjamin points out: that'll break all widgets that query style
properties in their init function.
2016-05-04 13:52:22 -04:00
Matthias Clasen
0d78b67bca When creating a widget path, use the widget type
No need to pull the type out of the css node - its our own type.
This will let us stop setting the type on the css node later on.
2016-05-04 13:42:54 -04:00
Matthias Clasen
3ca9a218ec Set the proper state on the css node
This will almost certainly overwritten before the widget gets
to the screen, but while we are doing this, we might as well
use the same state that we initialize the widgets state to.
2016-05-04 13:42:54 -04:00
Matthias Clasen
7df668f2ac css names are always set
No need to check for it, we set the css name on GtkWidgetClass
ourselves.
2016-05-04 13:42:54 -04:00
Timm Bäder
cb419794f8 widget: Remove useless NULL check
We are checking for allocation != NULL at the beginning of the function
already. This also means that the allocation parameter is not nullable.
2016-05-03 18:21:33 +02:00
Benjamin Otte
2c2c60827e widget: Remove useless comment 2016-05-03 12:59:13 +02: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
d6ac55102e widget: Don't show widget resizes in the inspector
Avoiding this sort of visual debugging in the inspector
is the main reason we have per-display debug flags now.
2016-04-19 23:32:26 -04:00
Matthias Clasen
921c154e38 widget: Use gdk_pango_get_for_display 2016-04-18 07:04:44 -04:00
Mohammed Sadik
3f8313c735 documentation: trivial typo fixes in GtkWidget
https://bugzilla.gnome.org/show_bug.cgi?id=764925
2016-04-11 22:03:48 -04:00
Timm Bäder
84dfda1a2b widget: Always warn when underallocating widgets 2016-04-01 10:04:25 +02:00
Benjamin Otte
71a5f07620 widget: queue a redraw only if resize highlighting is enabled
e8aa9b0440 introduced a new debug mode
that highlights resizes. Unfortunately it has the side effect of
always queueing redraws even when the debug mode is not enabled.
Make the redraw conditional.
2016-03-30 21:44:58 +02:00
Matthias Clasen
7018a41ce9 Correct a deprecation note
The CSS equivalent for focus-padding is outline-offset.
2016-03-15 09:22:23 -04:00
Matthias Clasen
1a5cb41bd9 Use per-display debug flags for visual debugging 2016-03-11 00:22:36 -05:00
Matthias Clasen
9c0e4c174a builder: Allow 'primary' as a modifier value
Support aliases for flags values in GtkBuilder, and use this
to support the special value 'primary' for GdkModifierType
values.

https://bugzilla.gnome.org/show_bug.cgi?id=699891
2016-03-05 23:44:03 -05:00
Benjamin Otte
3e06942847 widget: Add brute force method to propagate clip
When a gtk_widget_queue_allocate() on some widget increases the clip,
widget->parent's clip was not updated. This appraoch naively just
unions widget's new clip with widget->parent's clip.

This of course only works if widget and parent share the same GDK
window. In the cases where they don't we can't do anything and need a
better fix.

Fixes label-text-shadow-changes-modify-clip.ui reftest.
2016-03-03 00:43:59 +01:00
Matthias Clasen
2ee7fb1818 Don't use g_print for debug output
The g_print documentation explicitly says not to do this, since
g_print is meant to be redirected by applications. Instead use
g_message for logging that can be triggered via GTK_DEBUG.
2016-02-28 21:40:23 -05:00
Cosimo Cecchi
8e1368e6de widget: make sure to check all children for allocation needs
GtkWidget uses gtk_container_foreach() to iterate over children and
check whether they need their allocation reset.
However, that leaves out internal children, such as scrollbars of a
GtkScrolledWindow. Use gtk_container_forall() instead.
2016-02-28 12:30:16 -08:00
Matthias Clasen
bbd94b5a9f gtk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Matthias Clasen
a975e733dc fix a typo 2016-02-25 16:17:55 -05:00
Caolán McNamara
85b44a3e20 cannot not -> must
https://bugzilla.gnome.org/show_bug.cgi?id=761826
2016-02-11 22:18:26 -05:00
Benjamin Otte
f7ec9c98ef widget: Set a css name
Now selecting a widget by class name no longer works.

This is probably most relevant for users outside of GTK that want to
style their own widgets. Those widgets should now either add their own
style classes (if they want to adjust existing CSS) or use
gtk_widget_class_set_css_name() themselves (if they want to get rid of
all "upstream" styling).
2016-02-04 17:27:03 +01:00
Matthias Clasen
3756d92367 Move private widget path functions away
We don't put private functions in public headers anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=761339
2016-02-04 15:19:51 +01:00
Timm Bäder
033c6c82d0 widget: Annotate out params of _translate_coordinates as optional 2016-01-31 20:05:52 +01:00
Benjamin Otte
efc899bd2b widget: Improve gtk_cairo_should_draw_window()
Check that non-native window are indeed children of the event window and
only then confirm that they should be drawn.

Fixes Glade thinking that it's okay to have the draw function do
different things depending on what window to draw. (This should really
be fixed in Glade.)
2016-01-22 14:18:15 +01:00
Benjamin Otte
065aa296ed widget: Properly invalidate when CSS font properties change. 2016-01-20 02:19:42 +01:00
Carlos Garnacho
2b703b61cf gtk: Add private gtk_widget_reset_controllers()
This is a one-shot call that can be called on the places we
know we're taking input away.
2016-01-19 14:17:35 +01:00
Benjamin Otte
a50baba160 widget: Call gdk_window_mark_paint_from_clip() again
The proper window to call it is the event window, as the call itself
ignores non-native windows anyway.
2016-01-19 14:12:53 +01:00
Benjamin Otte
ab5dbfd1f1 widget: Add forgotten push_group code
... and remove the also forgotten void function that lingered around
with it.

Fixes opacity=0 parts like inactive spinners or sort indicators in
treeview headers being drawn since last commit.

Oops.
2016-01-19 04:24:32 +01:00
Benjamin Otte
580ea227a6 widget: Redo drawing code
Previously, we had a special cae to draw subwindows of widgets.

This is not necessary as conformant widgets should be able to properly
render themselves when all windows need to be painted.
From now on assume that is the case.

We therefore paint nonnative GDK windows "inline" by just returning TRUE
for gtk_cairo_should_draw_window() for those windows.

This speeds up hilighting different rows in the listbox gtk-demo example
tremendously (by a factor of 10 or more) as the previous code was
O(<number of non-window subwidgets> *
<number of subwindows>) which in the listbox example were ~15,000 and
~2,000 respectively.
2016-01-19 03:45:27 +01:00
Matthias Clasen
ac95bac5b8 Drop a reference to regions
Regions don't work anymore, so don't recommend them in the docs.
2016-01-18 14:31:37 -05:00
Matt Watson
d8bb228d3b widget: remove queue_resize in set_sensitive
Calling gtk_widget_propagate_state is enough to queue a resize if
needed

See da7a4089fe
2016-01-15 11:07:47 -08:00
Carlos Garnacho
0167f7c65c GtkWidget: Fix motion event consumption detection for touch-only gestures
If a GtkGestureSingle is set as touch-only, pointer events would be
discarded without giving an opportunity to the regular GtkGesture
handler to manage those.

Because the pointer events weren't actually managed by the gesture,
gtk_gesture_get_sequence_state() (rather unhelpfully here) will resort
to returning GTK_EVENT_SEQUENCE_NONE, which is in turn interpreted
by _gtk_widget_consumes_motion() as "may be handling the events for
this sequence", because gestures in this state presumably handle
the events, just that it's not "claimed" yet.

Instead, use gtk_gesture_handles_sequence(), which will perform the
expected check on the event sequence being managed, as we expect
here.
2016-01-11 20:16:06 +01:00
Matthias Clasen
9f247e112b Deprecate cursor-color style properties
These have been replaced by CSS properties.
2016-01-08 07:33:20 -05: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
Paolo Borelli
c4996873dc docs: try to clarify widget_get_state_flags vs context_get_state 2016-01-05 18:46:56 +01:00
Christoph Reiter
f66191346c Mention GtkIconSize in all docs where the argument/return is annotated as taking an int instead of GtkIconSize
In https://bugzilla.gnome.org/show_bug.cgi?id=601425 the annotations
were changed to int as they not only take the predefined enum values
but also user defined values registered through gtk_icon_size_register()

As a result the typelib doesn't contain any information about
GtkIconSize for those arguments and the Python docstring only
shows the corresponding Python type "int".

This changes the argument docs to mention the type explicitly
so the Python doc generator can add a link to Gtk.IconSize
which contains the most useful predefined values.

https://bugzilla.gnome.org/show_bug.cgi?id=757411
2016-01-04 11:56:44 +01:00
Cosimo Cecchi
908deb1bdc widget: deprecate separator style properties
They're not used in GTK anymore. Also remove them from the default
theme.
2016-01-03 00:42:51 -08:00
Matthias Clasen
31e97b33e1 Set ID on css node right away
Previously, the ID was only set on the CSS node as a side-effect
of calling gtk_widget_get_style_context. This was showing up
in CSS style tests as nodes lacking their IDs.
2015-12-28 23:18:06 -05:00
Matthias Clasen
b6d287aab5 widget: Be safe against windows losing their frame clock
gdk_widget_get_frame_clock can return NULL. In particular,
this can happen when the drag window is destroyed at the end
of a DND operation. Handle this gracefully when it happens.
2015-12-22 23:57:06 -05:00
Timm Bäder
e8aa9b0440 Add a way to highlight resizing widgets
https://bugzilla.gnome.org/show_bug.cgi?id=759586
2015-12-18 16:20:19 +01:00
Timm Bäder
20a6ee30b7 GtkWidget: Don't mix code and declarations 2015-12-18 16:08:22 +01:00
Carlos Garnacho
0f98f225d1 GtkWidget: Add some ignore deprecation statements
We still need access to floating devices here.
2015-12-16 19:47:07 +01:00
Matthias Clasen
65b056142b Really undo the deprecation of separator style properties
I hit the wrong one in the previous commit. For good measure,
undo depecation for all separator-related style properties.
They are still in use.
2015-12-15 19:45:35 -05:00
Matthias Clasen
db684d853d Undo deprecation of the wide-separators style property
This was premature, as this style property is still used
by GtkTreeView and GtkMenu.
2015-12-15 19:41:05 -05:00
Carlos Garnacho
253bf3fd38 GtkWidget: Avoid gdk_device_manager_get_client_pointer()
It's now deprecated
2015-12-15 23:17:07 +01:00
Matthias Clasen
fcca496734 widget: Deprecate some style properties
Deprecate the ::wide-separators and ::separator-width/height
style properties.
2015-12-15 08:41:16 -05:00
Benjamin Otte
7a05016d93 container: Split out a function
Computing the clip for all children is something I want to do in other
places.
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
Benjamin Otte
d46b67dc79 widget: Don't update pango context in state_flags_changed
It only needs to be updated in style_updated, and we do it there.
2015-12-02 05:04:41 +01:00
Timm Bäder
1551ad4908 GtkWidget: Add some missing nullable annotations 2015-12-01 13:41:35 +01:00
Timm Bäder
5e2aec7cbb GtkWidget: Add some missing nullable annotations 2015-11-24 11:17:10 +01:00
Timm Bäder
2182fe7d9d Don't pass widget state flags to GtkStyleContext API 2015-11-22 17:11:35 +01:00
Carlos Garnacho
4d524ab469 widget: Avoid critical warnings when disconnecting plain GtkEventControllers
This signal is only set on GtkGesture objects, so check it's really there
before disconnecting.
2015-11-05 14:32:37 +01:00
Benjamin Otte
d65ba7cf97 widget: Queue resize on parent, not self
When setting the parent of a widget, queue_resize() on the widget will
be optimized away if the widget already had a resize queued.

Plus, we do not need to resize the widget as its size request is not
going to change.
2015-11-03 22:55:03 +01:00
Benjamin Otte
1f01b8d52a widget: Queue an allocate on hide
This makes sure that hidden widgets always have priv->alloc_needed set
on them.

The constructor sets that flag, so we want to have it back when we
revert to this state.

This fixes GtkWindow skipping a size_allocate() when reshowing a
previously hidden window and thereby not updating its allocation and
clip. And that in turn would lead to draws not happening and us beig
left with a black window.
2015-11-03 18:57:14 +01:00
Florian Müllner
ebdf5f581d widget: Add :focus-on-click property
There are currently three widget that implement such a property, and
there are other widgets for which the behavior can make sense. It
seems like a good time to add the property to GtkWidget itself so
subclasses can choose to respect it without adding their own property.

https://bugzilla.gnome.org/show_bug.cgi?id=757269
2015-11-03 07:44:17 -05:00
Benjamin Otte
e39b8611bd widget: Queue redraw on gtk_widget_queue_allocate()
Mirror the behavior of gtk_widget_queue_resize() and always queue a
redraw. If we ever want to cause allocates without redraws we can add
gtk_widget_queue_allocate_no_redraw() then.

I had initially assumed gtk_widget_size_allocate() would take care of
queueing redraws, but it does not do that when neither size nor position
change. And that is obviously what's happening after
gtk_widget_queue_allocate().

Fixes buttons sometimes not redrawing (the record button in
widget-factory after locking it, all buttons when switching to the dark
theme).
2015-10-30 02:09:17 +01:00
Benjamin Otte
4483636016 widget: Queue resize on parent on show/hide
When gtk_widget_show() or gtk_widget_hide() is called, don't queue a
resize on the widget itself but on the parent.

The widget itself may already be marked as in need of a resize and
the call would be optimized out and never reach the parent.
The parent size will change though because a child widget just changed
its visibility.

Fixes a bunch of issues with menus appearing black, toolbas not hiding
in widget-factory and also various reftests.
2015-10-29 01:03:09 +01:00
Benjamin Otte
cd20ae8fe1 container: Don't keep our own variable trying to track need for resize
Insteaad, introduce gtk_widget_needs_allocate() and use that.
2015-10-28 19:44:29 +01:00
Benjamin Otte
e07ff714b9 widget: Make invisible widgets not propagate resizes
Do not queue a resize on the parent if the widget is not visible.
Invisible widgets do not influence the parents size.
2015-10-28 19:44:29 +01:00
Benjamin Otte
6866d1c06e widget: Make gtk_widget_queue_allocate() not resize
This commit toggles the big switch. We now don't run size_allocate()
from the toplevel up anymore in cases where we don't need to.

Things might be broken in subtle ways as a result of this commit. We'll
have to find them and fix them.
2015-10-28 19:44:28 +01:00
Benjamin Otte
299600a7d4 widget: Track if a child needs an allocation
This is not used so far.
2015-10-28 19:44:28 +01:00
Benjamin Otte
f706891dd3 widget: Refactor function
Turn it from a loop into tail-calling itself.
2015-10-28 19:44:28 +01:00
Benjamin Otte
ab7e901cfd widget: Move resize function into gtkwidget.c
There's no sizegroup specific code left in it, but lots of
widget-specifics.
2015-10-28 19:44:28 +01:00
Benjamin Otte
a4587ef4a0 widget: Warn on calls to queue_resize() during size_allocate()
This happens way too much, so it's disabled unless GTK_DEBUG=geometry is
on.

Also, we can't detect it in the call to queue_resize() yet, only during
size_allocate(), so the warning comes after the signal emission.
2015-10-28 19:44:28 +01:00
Benjamin Otte
4d631a9144 widget: Clear pending resizes after size_allocate()
This catches the cases where widgets call gtk_widget_queue_resize()
in their size_allocate() callback.
2015-10-28 19:44:28 +01:00
Benjamin Otte
3e3f17576e widget: Warn if size-unqueried widgets get allocated
Widgets should have gtk_widget_get_preferred_width/height() called
on them before gtk_widget_size_allocate() gets called.
Add a check for this.
2015-10-28 19:44:28 +01:00
Benjamin Otte
6cc2615b63 widget: Add a resize_needed flag
... and API to set and unset it.

It is set when gtk_widget_queue_resize() is called.
It is unset when gtk_widget_get_preferred_width/height() is called.

So far it is not used.
2015-10-28 19:44:28 +01:00
Benjamin Otte
3ff894c201 widget: Add a function that does actual resize
It's just shuffling code around.
2015-10-28 19:44:28 +01:00
Benjamin Otte
0912a6c2f5 widget: Use gtk_widget_queue_allocate() when clip changes
There's no need to queue a full resize there.
2015-10-28 19:44:27 +01:00
Benjamin Otte
195397e87a API: widget: Add gtk_widget_queue_allocate()
This is so widgets can queue a rerun of their allocation logic, but
without triggering resizes everywhere.

For now, it just calls gtk_widget_queue_resize().
2015-10-28 19:44:27 +01:00
Benjamin Otte
d3d9f52365 API: widget: Add gtk_widget_get_allocated_size()
See docs for what this is.
2015-10-28 19:44:27 +01:00
Benjamin Otte
ab2d236d3d sizegroup: Remove GtkQueueResizeFlags
They were only used with geometry widgets.
2015-10-28 19:44:27 +01:00
Benjamin Otte
5dd2087d19 widget: Remove _gtk_widget_override_size_request()
The function was only used by the geometry widget.
2015-10-28 19:44:27 +01:00
Benjamin Otte
a648afae12 widget: Add name to widget paths
This changes widget paths for widgets with a CSS name to return that CSS
name, now that we have added API for it.
This means that style properties are now matches using the CSS name.

Also fix the theme to use the correct name when matching style properties.
2015-10-27 03:13:42 +01:00
Matthias Clasen
203742b188 widget: Always set the type on css nodes
See the previous commit for why this is necessary.

Also make gtk_widget_class_set_css_name work by looking at
the correct class for the name.

Note for future reference: GTK_WIDGET_GET_CLASS() does not
work in the instance init function.
2015-10-22 21:01:06 -04:00
Matthias Clasen
7cf3eec85b Add since tags to new api
gtk_widget_class_set/get_css_name were missing it.
2015-10-22 19:43:32 -04:00
Benjamin Otte
408920d438 window: Add gtk_widget_class_set_css_name()
This is to replace using class names as CSS names.
2015-10-22 16:42:48 +02:00
Paolo Borelli
4447cf2419 widget: fix typo in warning message 2015-10-19 11:42:39 +02:00
Matthias Clasen
12be4b04f8 Drop some redundant cairo_save calls
Almost all callers of _gtk_widget_draw already did their own
cairo_save/restore, so drop the save/restore calls inside
_gtk_widget_draw and instead fix the last caller, gtk_widget_draw,
to do the same.
2015-09-29 09:43:42 -04:00
Matthias Clasen
ac198a3ce6 Add a few more inlined getters 2015-09-28 06:29:50 -04:00
Matthias Clasen
ff3cb8ac71 Avoid copying lists during draw
We can use gdk_window_peek_children here, instead of copying
the list. Note that we preserve the bottom-to-top ordering by
iterating the list from the end.
gdk_window_get_children_with_user_data was doing a list
reversal while filtering the list.
2015-09-27 00:35:12 -04:00
Matthias Clasen
001ba79dd6 Refactor gtk_widget_add_events_internal_list
Avoid copying the child window lists. It is not necessary.
2015-09-27 00:35:12 -04:00
Matthias Clasen
1cac30b6f3 Refactor gtk_widget_set_device_enabled_internal
Instead of constructing a single list of all windows associated
to a widget, just iterate the children lists recursively, avoiding
allocations.
2015-09-27 00:35:11 -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
c7c1f9ff61 widget: Add a few more inlined getters 2015-09-23 07:01:16 -04:00
Matthias Clasen
da45d29dbc size group: Streamline disposal
Remove widgets from their size groups in dispose, without connecting
to ::destroy. The signal handler is not necessary.
2015-09-23 07:01:16 -04:00
Alexander Larsson
d29c48815c widget: get_widget_windows() don't modify window child lists
We can't modify the lists returned from gdk_window_peek_children,
instead use get_children().
2015-09-21 16:59:51 +02:00
Carlos Garnacho
b323252c14 widget: Make sure we only run controllers on realized widgets
The default event bubbling paths are prone to just running event controllers
even after the widget was potentially unrealized/destroyed in an event
handler callback, so bail out early if that's the case.

https://bugzilla.gnome.org/show_bug.cgi?id=755352
2015-09-21 15:55:33 +02:00
Carlos Garnacho
f860afc92e Revert "gtkwidget: Ensure unrealization during event dispatching cancels gestures"
This reverts commit 13873d2c50.
2015-09-18 12:59:00 +02:00
Carlos Garnacho
bdb854d92c Revert "widget: Fix propagation of gesture cancellation on widget unrealize/destroy"
This reverts commit 3aaf730901.
2015-09-18 12:57:26 +02:00
Carlos Garnacho
9577266d34 Revert "widget: Cancel also denied sequences"
This reverts commit 63e255e7b5.
2015-09-18 12:57:04 +02:00
Carlos Garnacho
63e255e7b5 widget: Cancel also denied sequences
It makes no sense to skip denied sequences here, the gestures are
still carrying out the accounting for these, which must be also put
to an end if we're possibly not receiving any further events from
this sequence.

https://bugzilla.gnome.org/show_bug.cgi?id=754098
2015-09-16 19:16:39 +02:00
Carlos Garnacho
3aaf730901 widget: Fix propagation of gesture cancellation on widget unrealize/destroy
At the time event_check_cancel_sequence_on_hierarchy() is called, the widget
has been already unparented. Given the widget itself is being destroyed,
cancellation on it is impending in one way or another, we still must
propagate cancellation across all parents, so retrieve it early before
possible widget destruction.

https://bugzilla.gnome.org/show_bug.cgi?id=754098
2015-09-16 19:14:10 +02:00
Matthias Clasen
afa60da553 Fix a copy-paste error
We were notifying can-focus when can-default changes.
Unit tests save the day.
2015-09-14 15:20:58 -04:00