Commit Graph

547 Commits

Author SHA1 Message Date
Benjamin Otte
54c8a4b3b7 widget: Add gtk_widget_get_clipboard()
... and gtk_widget_get_primary_clipboard().

They both give out the new GdkClipboard.
2017-12-03 05:46:47 +01:00
Benjamin Otte
a59572f96d widget: gtk_widget_get_clipboard => gtk_widget_get_old_clipboard
Just rename the function, so the previous one can be used for the
new clipboard.
2017-12-03 05:46:47 +01:00
Benjamin Otte
3f5178dc21 selection: Remove the info uint
Instead of allowing people to pass a uint user-data, insist on them
comparing mime types.

The user data was a uint instead of a pointer anyway, so uniqueness
could not be guaranteed and it caused more issues than it was worth.
And that's ignoring the fact that it basically wasn't used.
2017-11-16 22:59:43 +01:00
Benjamin Otte
9d56cee622 widget: Remove gtk_widget_set_device_enabled()
Nobody is using it.
2017-11-13 23:41:37 +01:00
Benjamin Otte
cf2d549e92 widget: Implement gtk_widget_pick()
... and use it.
2017-11-05 05:13:17 +01:00
Benjamin Otte
b38a4cb824 widget: Export gtk_widget_set_cursor()
Widgets can now set their favorite cursor using public API.

This is very necessary because all cursor-setting APIs are still
setting it on their GdkWindow, which by now is the toplevel - oops.
2017-11-04 01:00:27 +01:00
Timm Bäder
8f55647fbb widget: Add get_width() and get_height() 2017-11-02 11:54:06 +01:00
Timm Bäder
dea8233663 widget: Remove stray prototype
gtk_cairo_transform_to_window is gone.
2017-11-02 11:25:41 +01:00
Benjamin Otte
d88c441764 widget: Add gtk_widget_contains() 2017-11-01 19:46:59 +01:00
Timm Bäder
f576002e9e widget: Improve get_request_mode vfunc docs 2017-10-31 10:10:53 +01:00
Benjamin Otte
648d040395 widget: Remove gtk_widget_get_screen()
Replace the remaining users with "correct" code that does not need that
function anymore.
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
Benjamin Otte
44614394e6 widget: Turn screen-changed signal into display-changed 2017-10-31 00:43:11 +01: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
Timm Bäder
a8a755e5cd widget: Remove gtk_widget_set_redraw_on_alloc
Since gtk+ draws more than the widget and allocates more size to it than
it knows about, this flag doesn't work anymore. Removing it (or setting
it to TRUE for widgets that used to set it to FALSE) fixes drawing
invalidation when these widgets get allocated a new size.
2017-08-09 16:26:26 +02:00
Timm Bäder
5720f2a845 widget: Make _set_clip private
We don't need this anymore since clips are now reported in
size-allocate.
2017-07-19 21:27:16 -04:00
Timm Bäder
5116ce19b7 widget: Remove queue_draw_region vfunc
Unused
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
c4f6cea111 fix a few documentation problems 2017-07-19 21:27:15 -04:00
Timm Bäder
e36ddfec17 Remove all widget style property code 2017-07-19 21:27:14 -04:00
Timm Bäder
ec6184c2af widget: Remove queue_draw_child vfunc 2017-07-19 21:27:13 -04:00
Timm Bäder
2cedf1be9c widget: Remove gtk_widget_set_allocation 2017-07-19 21:27:12 -04:00
Timm Bäder
a0016758a8 widget: Copy event in gtk_widget_event and _captured_event
To ensure that we never translate the coordinates to widget coordinates
twice.
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
Carlos Garnacho
9c97bf0c02 GtkWidget: Add ::pick vmethod
The default implementation iterates through all children, so should suffice
for most widgets.
2017-05-25 16:25:58 +02:00
Timm Bäder
3d21128dbb Remove gtk_widget_get_preferred_*
They are unnecessary now that we have gtk_widget_measure.
2017-05-05 11:18:25 +02:00
Timm Bäder
ba363fbb71 widget: Add gtk_widget_insert_before/after
To insert a widget into the widget tree before or after a child widget
of the soon-to-be parent.
2017-04-25 20:29:02 +02:00
Timm Bäder
f860ff8647 widget: Remove get_valign_with_baseline
This only existed for backwards compat reasons which aren't interesting
for gtk4.
2017-03-05 15:18:32 +01:00
Timm Bäder
6c6ed7496c widget: Remove gtk_widget_class_list_style_properties
Unused.
2017-01-30 18:11:00 +01:00
Timm Bäder
f4341ee9f7 widget: Remove show-all property
Doesn't make sense anymore now that gtk_widget_show_all is gone.
2017-01-20 21:37:07 +01:00
Timm Bäder
ea897c6df4 Remove gtk_widget_show_all 2017-01-20 21:37:04 +01:00
Timm Bäder
13b001b77c widget: Remove show_all vfunc 2017-01-20 21:33:38 +01:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Timm Bäder
5f98597a0c Add gtk_widget_set_focus_child
With a very useful implementation, but at least now we don't get runtime
warnings.
2017-01-07 17:19:30 +01:00
Timm Bäder
5ab2377afa widget: Remove gtk_widget_style_get_property 2017-01-07 17:19:30 +01:00
Timm Bäder
1e031cba99 widget: Add children and sibling pointers
and a (private) way to access them. We will later use these pointers to
manage children of non-container widgets and containers alike.
2017-01-07 16:44:00 +01:00
Timm Bäder
489aee5d00 widget: Remove unused adjust_* vfuncs
Expose them privately to gtksizerequest.c using normal functions
instead.
2016-12-07 18:12:54 +01:00
Timm Bäder
36377e9964 Remove gtk_widget_get_preferred_height_and_baseline_for_width
It's just a wrapper around gtk_widget_measure nowadays.
2016-12-03 13:19:25 +01:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Benjamin Otte
2745c2502f snapshot: Move GtkSnapshot declaration to gtypes.h 2016-11-19 20:58:36 +01:00
Matthias Clasen
3dc53dab69 Document ::snapshot vfunc 2016-11-19 12:37:19 -05:00
Benjamin Otte
b8710d8962 widget: Remove get_render_node() vfunc 2016-11-15 17:49:19 +01:00
Benjamin Otte
d1fec79c00 snapshot: Completely reengineer API
We now try to emulate cairo_t:

We keep a stack of nodes via push/pop and a transform matrix.

So whenever a new node is added to the snapshot, we transform it
by the current transform matrix and append it to the current node.
2016-11-15 17:48:45 +01:00
Benjamin Otte
b1154be1c4 widget: Add GtkWidgetClass.snapshot() vfunc
Does the same thing as the render vfunc, only that it uses a different
prototype.
2016-11-15 17:48:45 +01:00
Timm Bäder
846cf681e8 Remove gtk_widget_set_mapped
Let all the remaining callers chain up.
2016-11-05 11:56:36 +01:00
Benjamin Otte
a178258a2a docs: Remove vfunc that doesn't exist anymore 2016-11-03 20:33:33 +01:00
Timm Bäder
a7efe10ef8 widget: Remove unused visibility-notify-event 2016-11-02 18:40:00 +01:00
Timm Bäder
773c16076b widget: Remove state-flags leftovers 2016-11-02 18:40:00 +01:00
Timm Bäder
c261d890ad widget: Remove damage-event 2016-10-31 19:28:28 +01:00
Timm Bäder
c25a5606d1 widget: remove show-help 2016-10-31 19:28:28 +01:00
Timm Bäder
5071206d60 widget: Remove app-paintable 2016-10-31 19:28:28 +01:00
Benjamin Otte
73cd739e19 API: widget: Remove gtk_widget_is_composited()
We don't need to clutter our API with functions that are easily
available elsewhere and effectively unused.
2016-10-29 04:49:47 +02:00
Benjamin Otte
a334316d5e API: widget: Remove GtkWidget::composited-changed signal
Nobody uses it.

If you need the functionality, listen to display changes on
your widget and then connect to the display's notify::composited.
2016-10-29 04:49:47 +02:00
Benjamin Otte
27ab75250c widget: Redo how gtk_widget_queue_draw() works
Before, we would immediately invalidate the GdkWindow of the widget, now
we call the parent's GtkWidgetClass.queue_draw_child() function.
This allows the parent to track redraw queueing of children.

By default GtkWidgetClass.queue_draw_child() will again chain up to its
parent while respecting the GdkWindow hierarchy for clipping.
GtkWindow is then the only widget actually invalidating the GdkWindow.

This essentially moves redraw queueing from GDK to GTK.
2016-10-27 05:07:23 +02:00
Timm Bäder
ab467317a1 widget: Add docs for ::measure 2016-10-22 21:40:04 +02:00
Timm Bäder
a50587b9ec widget: Really remove get_preferred_xxx vfuncs 2016-10-22 19:40:57 +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
Emmanuele Bassi
b997f4c575 gtk: Use GskRenderNode to render widgets
We need a virtual function to retrieve the GskRenderNode for each
widget, which is supposed to attach its own children's GskRenderNodes.
Additionally, we want to maintain the existing GtkWidget::draw mechanism
for widgets that do not implement get_render_node() — as well as widgets
that have handlers connected to the ::draw signal.
2016-10-18 11:49:06 +01:00
Timm Bäder
dd3c3b683f widget: Remove push/pop_composite_child
as well as the composite-child property
2016-10-18 00:29:18 +02:00
Timm Bäder
2ae996e242 widget: Remove gtk_widget_get_pointer 2016-10-18 00:29:18 +02:00
Timm Bäder
5da7a824ff widget: Remove docs for style-set 2016-10-18 00:29:18 +02:00
Timm Bäder
a4368a73a5 widget: Remove gtk_widget_reparent 2016-10-18 00:29:17 +02:00
Benjamin Otte
4a95f8802c widget: Remove gtk_widget_set_double_buffered()
Everything is always double-buffered.
2016-10-16 18:18:58 +02:00
Timm Bäder
ed184b3935 Remove GtkIconFactory
Move the icon size lookup API into gtkicontheme.c
2016-10-16 18:17:21 +02:00
Timm Bäder
ccd3ff7fba gtkwidget: Remove gtk_widget_class_install_style_property_parser...
... from public API
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
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
d09e48cec1 API: Remove -gtk_widget_get_root_window() 2016-10-16 18:17:21 +02: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
9ebe95f4a9 Remove introspection scanner guards around autocleanups
They are not needed.
2015-11-11 12:02:43 +00:00
Emmanuele Bassi
93369788c9 Start recursively moving autocleanups macros to their headers
* Cover letter

Having a single header file for all autocleanups definitions was a
reasonable stop-gap measure, but now GTK+ is starting to use G_DECLARE_*
macros. This means that every class using a G_DECLARE_* macro will need
to include "gtk.h" to avoid compiler warnings, which is not acceptable.

By moving the G_DEFINE_AUTO* use to the header that defines the type we
allow using the G_DECLARE_* macros without sacrificing the ability to
include only the needed files when deriving from a class.

* Commit

This commit changes all includes relative to GtkWindow to define their
own autocleanup macros.
2015-11-10 13:59:36 +00: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
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
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
Matthias Clasen
f1414a125f Move GtkWidgetAuxInfo struct to private headers
There's no API returning such a struct, it is entirely internal.
Therefore, don't expose it in public headers.
2015-09-12 18:36:32 -04:00
Timm Bäder
56051b0bd8 GtkWidget: Fix set_font_map docs
A typo and non-matching parameter names.
2015-07-23 17:59:17 +02:00
Matthias Clasen
e7fe194b2d GtkWidget: Add custom font map support
This allows to use a custom font map for parts of the widget
hierarchy - this can be used for application-specific fonts.

https://bugzilla.gnome.org/show_bug.cgi?id=751812
2015-07-19 16:58:43 -04:00
Arc Riley
15c73a2b1a Add gtk_widget_set_font_options and gtk_widget_get_font_options
This allows a widget to override global font_options, such as hinting and
subpixel order. The widget's PangoContext is updated when this is set.

Some update code from gtk_widget_update_pango_context was moved to
update_pango_context so that gtk_widget_update_pango_context runs it.

http://bugzilla.gnome.org/show_bug.cgi?id=751677
2015-07-01 07:34:32 -07:00
Christian Hergert
661da5558c widget: add helpers to resolve GActionGroups available to GtkWidget
These functions, while added for use by the GTK inspector, are generally
useful to applications that need to resolve what action groups are
available to a particular GtkWidget.

https://bugzilla.gnome.org/show_bug.cgi?id=741386
2014-12-11 15:25:41 -08:00
Matthias Clasen
63efdca223 Deprecate GtkWidget override APIs
This is better done with css and style classes nowadays.
2014-09-30 00:08:59 -04:00
Jasper St. Pierre
f4c2c4c667 gtkwidget: Actually mark set_double_buffered as deprecated 2014-06-23 17:53:48 -04:00
Matthias Clasen
e4680d64a0 Documentation fixes
Add a few missing symbols, and match up parameters in headers
and doc comments.
2014-05-27 14:33:32 -04:00
Benjamin Otte
4f89eb05cf API: widget: Add gtk_widget_set_clip() API
And handle the fact that drawing bounds are now handled by this API and
the corresponding gtk_widget_get_clip().

Also add _gtk_widget_supports_clip() function to check if a widget has
been ported to the new world.
2014-05-24 16:12:20 +02:00
Matthias Clasen
4928d5e401 Drop an unneeded include
There's no GtkGesture in gtkwidget.h anymore. We do need an include
in gtkwidgetprivate.h though.
2014-05-23 20:09:50 -04:00
Carlos Garnacho
5369c77029 gesture: Simplify gesture/widget interaction public API
The propagation phase property/methods in GtkEventController are gone,
This is now set directly on the GtkWidget add/remove controller API,
which has been made private.

The only public bit now are the new functions gtk_gesture_attach() and
gtk_gesture_detach() that will use the private API underneath.

All callers have been updated.
2014-05-23 19:54:29 +02:00
Carlos Garnacho
7a71c16317 widget: refactor gesture integration
Listen for notify::sequence-state-changed on the controller, so the
only way to manipulate a sequence state are gtk_gesture_set_sequence_state()
and gtk_gesture_set_state().

Also, make use of gesture groups, so the sequence state is set at once
on all gestures pertaining to a single group. Within a widget, if a sequence
is claimed on one group, it is made to be denied on every other group.
2014-05-23 19:54:25 +02:00
Carlos Garnacho
38e40a55f4 widget: Add gtk_widget_set_gesture_state()
This helper function ensures the state is propagated for
all the active sequences in the given gesture.
2014-05-23 19:54:24 +02:00