Commit Graph

34288 Commits

Author SHA1 Message Date
Timm Bäder
596be280c9 menusectionbox: Avoid a gtk_widget_destroy() call 2020-02-25 11:08:25 +01:00
Timm Bäder
b1d4d24c7b pathbar: Inherit from GtkWidget 2020-02-25 11:08:25 +01:00
Timm Bäder
1baae1f288 colorchooser: Fix typo in checkerboard color 2020-02-25 11:08:25 +01:00
Timm Bäder
dae06d82ae inspector: Remove double borders in recorder 2020-02-25 11:08:25 +01:00
Timm Bäder
549a3a81ae headerbar: Replace gtk_widget_destroy() call 2020-02-25 11:08:25 +01:00
Timm Bäder
ff4a33b69b headerbar: Remove size request on icon button
Doesn't make sense that we force this one button to be this big.
2020-02-25 11:08:25 +01:00
Timm Bäder
68b4c061cf shortcutlabel: Remove unnecessary includes 2020-02-25 11:08:25 +01:00
Timm Bäder
dbd1180ce4 stackswitcher: Avoid calling gtk_widget_destroy() 2020-02-25 11:08:25 +01:00
Timm Bäder
df3b88483d modelbutton: Fix wrong function name in doc comment 2020-02-25 11:08:25 +01:00
Timm Bäder
60d2813247 placessidebar: Convert popover menu to proper GtkPopoverMenu 2020-02-25 11:08:23 +01:00
Timm Bäder
995277f57d placessidebar: Avoid calling gtk_widget_destroy() 2020-02-25 10:43:15 +01:00
Timm Bäder
e1ca83ddbd pathbar: Avoid calling gtk_widget_destroy() 2020-02-25 10:43:15 +01:00
Timm Bäder
f4202c5075 headerbar: Avoid calling gtk_widget_destroy() 2020-02-25 10:43:15 +01:00
Timm Bäder
103b6a9205 popovermenubar: Avoid calling gtk_widget_destroy() 2020-02-25 10:43:15 +01:00
Timm Bäder
ceabe70a42 emojichooser: Avoid using gtk_widget_destroy() 2020-02-25 10:43:15 +01:00
Timm Bäder
73faa9c84a popovermenu: Avoid a gtk_widget_destroy() call 2020-02-25 10:43:15 +01:00
Timm Bäder
1b278b0636 colorchooserwidget: Get rid of a gtk_widget_destroy() call 2020-02-25 10:43:15 +01:00
Matthias Clasen
9d80db29de Merge branch 'spinning-spinner' into 'master'
Rename GtkSpinner::active to ::spinning

See merge request GNOME/gtk!1475
2020-02-25 04:04:46 +00:00
Matthias Clasen
e73a40733f Rename GtkSpinner::active to ::spinning
And add a setter and getter. The old name was
confusing with the widget state of the same
name. 'Active' is just too overloaded.
2020-02-24 22:37:02 -05:00
Matthias Clasen
00f6d1c24b Merge branch 'kill-rtl-media-icons' into 'master'
Drop rtl variants of media-playback-start

See merge request GNOME/gtk!1474
2020-02-25 02:09:52 +00:00
Matthias Clasen
8628c573b5 Drop rtl variants of media-playback-start
According to #2469, they are unwanted.
2020-02-24 20:49:10 -05:00
Matthias Clasen
a43d13aa74 popover: Drop ::relative-to
It is enough to just set the parent (and make the parent
call gtk_native_check_resize in size_allocate).

This commit removes the relative_to argument to the
constructors of GtkPopover and GtkPopoverMenu, and
updates all callers.
2020-02-24 20:46:41 -05:00
Matthias Clasen
7a39f2d49d Replace gdk_surface_is_visible by _get_mapped
The property  is called ::mapped, and we want to get
to standard getter naming.
2020-02-24 19:07:03 -05:00
Matthias Clasen
7f46b25c04 Merge branch 'wip/ebassi/filechooser-new' into 'master'
Clean up the GtkFileChooser API

Closes #2455

See merge request GNOME/gtk!1454
2020-02-24 00:32:23 +00:00
Benjamin Otte
6c61c7bf0b Don't use GdkAtom where const char * is used
Those are all forgotten transitions while updating code to new APIs.
2020-02-23 01:59:19 +01:00
Benjamin Otte
a62d78bf70 selection: Remove GtkSelectionData 2020-02-23 01:59:00 +01:00
Benjamin Otte
a4f7e2ca09 droptarget: Remove selectiondata read functions
They are unused now.
2020-02-23 01:59:00 +01:00
Benjamin Otte
a19066b17c filechooserwidget: Stop using selection data
Use gdk_drop_read_async()
2020-02-23 01:59:00 +01:00
Benjamin Otte
b0f6996892 gdk: Remove gdk_surface_register_dnd()
All surfaces are expected to be DND surfaces from creation.
2020-02-23 01:59:00 +01:00
Matthias Clasen
ddd126740e Fix a hard-to-spot typo
The symptom caused by this was scales in
popovers not reacting to dragging.
2020-02-22 13:49:12 -05:00
Emmanuele Bassi
ff6772fd98 Remove preview widget from GtkFileChooser
The preview widget harks from a platform before time, when we didn't
have GIO, or a thumbnail specification.

Very few applications use it correctly, if at all; it has an horrid hack
to deal with the ownership of the widget's instance when accessed
through the getter function; it messes up the layout of the widget and
its label is less than useful when it comes to file names longer than a
dozen characters; it's a poor substitute for a proper thumbnail view.
2020-02-22 16:39:01 +00:00
Emmanuele Bassi
e5ef26efa8 Remove GtkFileChooserEntry:local-only
We don't use it any more in GtkFileChooserWidget.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
ebd23737c0 Remove GtkPlacesSidebar:local-only
We don't use it any more in GtkFileChooserWidget.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
6e699e3f04 Remove GtkPlacesView:local-only
We don't use it any more from the file chooser widget.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
4a3742979d Remove GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
We don't need a whole separate action, now that the file chooser widget
can create folders; we can create use SELECT_FOLDER and create one.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
b09e7df81b Remove GtkFileChooser:local-only
Now that the whole API goes through GFile we don't have the weird split
between local-only and non-local-only modes.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
516eab5c43 Remove GtkFileChooser:show-hidden
This is a user setting and a user action, not something that ought to be
programmatically set via the file selection API.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
063ad28b1a Remove overwrite confirmation machinery from GtkFileChooser
Overwrite confirmation should not be optional, and it should not loop
into application code to create their own dialog and user response.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
d505573ee6 Drop GtkFileChooser:extra-widget
We have "choices" as a more rational (and portable) API; additionally,
the ownership semantics of the extra widget property getter are a hack.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
5f070ff233 Remove filename/URI API from GtkFileChooser
GtkFileChooser's API predates GIO by a few years, so it started off with
filenames and URI as character arrays. After introducing GIO as a
dependency, the API included GFile-based entry points.

It's much more appropriate to use GFile everywhere, as we want to
encourage people to use GIO instead of passing random bytes to low level
POSIX API.

See: #2455
2020-02-22 15:22:06 +00:00
Benjamin Otte
9d915ff431 treeviewcolumn: Inline variable into return_if_fail() 2020-02-22 07:44:52 +01:00
Benjamin Otte
d9e3eaaec8 treeview: Guard code by right compiler macros 2020-02-22 07:33:41 +01:00
Benjamin Otte
0c4c88b449 scrolledwindow: Inline variable into return_if_fail() 2020-02-22 07:33:41 +01:00
Benjamin Otte
2cb0007b89 iconview: Inline variables into return_if_fail() 2020-02-22 07:33:41 +01:00
Benjamin Otte
eb70173646 levelbar: Guard function by right compiler macros 2020-02-22 07:33:41 +01:00
Benjamin Otte
2e941acb29 filesystemmodel: Guard variable with correct compiler flags 2020-02-22 07:33:41 +01:00
Benjamin Otte
42d71f1016 combobox: Inline variables into return_if_fail() 2020-02-22 07:33:41 +01:00
Benjamin Otte
99fc31865a comboboxtext: Inline functions into return_if_fail() 2020-02-22 07:33:40 +01:00
Benjamin Otte
a12e563cd2 main: Don't synthesize crossing events when nothing changed
This was especially bad because it was confusing the event controllers
so much, they'd emit leave + enter events every time the mouse moved.
2020-02-22 07:33:40 +01:00
Benjamin Otte
a5e2275a72 stackswitcher: Use GdkDropControllerMotion
... and use one controller per button instead of using it on the
switcher and then going through lots of pain attempting to find the
right button for the location under the mouse.
2020-02-22 07:33:40 +01:00
Benjamin Otte
d680e2e344 Port simple cases to GtkDropControllerMotion 2020-02-22 07:33:40 +01:00
Benjamin Otte
34e5f36fdf Add GtkDropControllerMotion 2020-02-22 07:33:40 +01:00
Benjamin Otte
9223d1ee04 eventcontrollermotion: Fix docs 2020-02-22 07:33:40 +01:00
Benjamin Otte
fc43ec0bbc gtk: Bubble drag events like motion events
Emit crossing events - with a new GTK_CROSSING_DROP type - like we do
for motion events. There is no more special casing for them.

Note that the gesture has not been updated yet, so some obscure behavior
may occur.
2020-02-22 07:33:40 +01:00
Benjamin Otte
6f73a750a7 widget: Simplify adjust_allocation()
And in particular, only do it if the widget doesn't use ALIGN_FILL.

This avoids lots of measuring in the common case and speeds up
size_allocate() by about 25%.

And because size_allocate() is the bottleneck in the fishbowl, this also
gets ~25% more fishies.
2020-02-22 07:33:40 +01:00
Benjamin Otte
4128ee88b0 widget: Pull margin computation out of adjust_allocation
It's way cheaper to just do it.

Also simplifies adjust_size_allocation a lot.
2020-02-22 07:33:23 +01:00
Benjamin Otte
418bdc87ef sizerequest: Stop clamping for_size to natural size
Widgets should be given the actual size they will be allocated, so they
can do something with it.

If they want to clamp themselves to their natural size, nothing's
stopping them, they know their natural size after all.
2020-02-22 07:33:23 +01:00
Benjamin Otte
612ba7ec15 widget: Don't check for natives
It's the native's job to request a 1px x 1px size, not the job of
gtk_widget_size_allocate()

Also saves 10% of size_allocate() time because checking for an interface
is really expensive.
2020-02-22 05:50:07 +01:00
Benjamin Otte
f656cbdc5b Ensure all natives request at least a 1px wide surface
FIXME: Is this necessary?

Could the surfaces just clamp to 1x1 themselves?
We recently declared that surfaces can decide on whatever size they want
so natives need to inspect the size they requested anyway.
2020-02-22 05:50:07 +01:00
Matthias Clasen
9fa7a47081 color chooser: Fix fallout from floatification
We are using (dddd) variants to store colors in variants,
which is dangerous now that GdkRGBA members are just floats.

Avoid passsing the GdkRGBA members directly to any varargs
functions.
2020-02-21 19:56:44 -05:00
Benjamin Otte
5577cfa40c surface: Don't take a display argument in gdk_surface_new_popup()
The display can be taken from the surface, it must not be different.
2020-02-21 21:13:09 +01:00
Benjamin Otte
808961564c gdk: Make DRAG_ENTER event take x/y coordinates
Make it mirror the behavior of ENTER/LEAVE events.
2020-02-21 18:19:16 +01:00
Matthias Clasen
5ebe5be225 Stop exporting gtk_get_event_widget
This is non-essential convenience API, and we
don't really expose events to applications anymore.
2020-02-21 00:51:03 -05:00
Matthias Clasen
b2226ea1e3 gtk: Stop using GtkEventButton
Same as the previous commit. All events are
just GdkEvents now.
2020-02-21 00:51:03 -05:00
Matthias Clasen
8823882f97 gtk: Stop using GdkEventKey
We should just use GdkEvent, instead of taking
a GdkEventKey, and then cast it everywhere.
2020-02-21 00:51:03 -05:00
Matthias Clasen
9e415ad017 a11y: drop unused code
We are no longer using key snoopers.
2020-02-21 00:51:03 -05:00
Matthias Clasen
e062137b2c motion controller: Match focus event propagation
Make the crossing event generation for pointer events
match what we do for focus now.
2020-02-21 00:51:03 -05:00
Matthias Clasen
77aed615e8 Keep more event controller api private
We don't want to expose the GtkCrossingData struct, and manually
feeding events to event controllers is not something we want to
encourage, going forward.
2020-02-21 00:51:03 -05:00
Matthias Clasen
0c96b2d8f7 Bring back im context focus-in/out
The key controller still needs to track focus,
in order to emit these signals when required.
2020-02-21 00:51:03 -05:00
Matthias Clasen
cadeca74e2 Go back to ::enter/::leave for pointer changes
These signals are behaving a little differently from
what ::focus-in/::focus-out used to do.
2020-02-21 00:51:03 -05:00
Matthias Clasen
5a2f829a40 Split off GtkEventControllerFocus
Split the focus tracking into a separate
GtkEventControllerFocus, and change the API one more time.
We are back to having ::focus-in and ::focus-out signals.

Update all users.
2020-02-21 00:51:03 -05:00
Matthias Clasen
89c3a7ab24 wip: Add more information to crossing events
Add fields for direct descendents to GtkCrossingData,
and populate them when emitting focus change events.

Also add accessors for these fields to GtkEventControllerKey,
and verify that they are set properly in the focus test.

Not done yet: Do the same for pointer crossing events.
2020-02-21 00:51:03 -05:00
Matthias Clasen
7bb6abb1d4 win32: Remove some leftover event struct access
And leftover old event api calls.
2020-02-21 00:51:03 -05:00
Matthias Clasen
0fc2505ed6 Drop gtk_widget_event from API
We don't want events to be injected randomly from
the outside. Plus, there's no way to create such
events from the outside now.
2020-02-21 00:51:03 -05:00
Matthias Clasen
b1eaa502df events: reorganize getters
Restructure the getters for event fields to
be more targeted at particular event types.

Update all callers, and replace all direct
event struct access with getters.

As a side-effect, this drops some unused getters.
2020-02-21 00:51:03 -05:00
Matthias Clasen
31bf9da63a Strip const from GdkEvent
Events are refcounted structs, and we generally don't
pass these as const.
2020-02-21 00:51:02 -05:00
Matthias Clasen
e5223b1cee main: Stop calling gdk_event_set_target
GTK is no longer relying on this.
2020-02-21 00:51:02 -05:00
Matthias Clasen
2416b4e2a0 Stop using gdk_event_get_target
We can now get the target widget from the gesture
that we are using to find the event in the first
place.
2020-02-21 00:51:02 -05:00
Matthias Clasen
2bac066a63 gesture: Keep the target widget for events
We already store the events; keep the target widget
in addition. This is a step towards getting rid of
gdk_event_get_target.
2020-02-21 00:51:02 -05:00
Matthias Clasen
cd601ffb9e eventcontroller: Make the target widget available
Make it possible for event controllers to obtain
the target widget during handle_event.
2020-02-21 00:51:02 -05:00
Matthias Clasen
e54e48f6d1 Explicitly pass the target to handle_event
Pass the event propagation target explicitly down to
the event controllers. This is a step towards getting
rid of gdk_event_set_target.
2020-02-21 00:51:02 -05:00
Matthias Clasen
b38869b3aa Stop looking at the related target for filtering
We are now sending crossing events (which are the only ones
where a related target makes sense) via handle_crossing.
2020-02-21 00:51:02 -05:00
Matthias Clasen
d063b6b6cc Reinstate filtering for crossing events
The event propagation limit should apply to crossing events
as well.
2020-02-21 00:51:02 -05:00
Matthias Clasen
e3158a1bfb Make crossing events handled the same way 2020-02-21 00:50:59 -05:00
Matthias Clasen
23c67f8c67 New focus change handling
Instead of relying on gdk's antiquated crossing events,
create a new GtkCrossingData struct that contains the
actual widgets, and a new event controller vfunc that
expects this struct. This also saves us from making sense
of X's crossing modes and details, and makes for a
generally simpler api.

The ::focus-in and ::focus-out signals of GtkEventControllerKey
have been replaced by a single ::focus-change signal that
takes GtkCrossingData as an argument. All callers have
been updated.
2020-02-21 00:47:53 -05:00
Matthias Clasen
9402e335d0 wip: scrolledwindow stop using targets 2020-02-21 00:47:53 -05:00
Matthias Clasen
64b9c6aaaa main: Drop gtk_get_event_target
This is no longer used.
2020-02-21 00:47:53 -05:00
Matthias Clasen
61c32f3651 tooltip: stop using gtk_get_event_target 2020-02-21 00:47:53 -05:00
Matthias Clasen
1b2289ad9b Stop using gtk_get_event_target
This is just a thin wrapper around gdk_event_get_target,
so use that directly.
2020-02-21 00:47:53 -05:00
Matthias Clasen
dd251d85c4 Pass translated coordinates outside the event
We want to make events readonly, so stop translating
their coordinates and instead pass the translated
coordinates separately, when propagating events.
2020-02-21 00:47:53 -05:00
Matthias Clasen
cd2b58574d Drop GDK_NOTHING
Events of type GDK_NOTHING are good for nothing.
2020-02-21 00:47:53 -05:00
Matthias Clasen
c343031a0e Stop using g_object_ref/unref on events
Use gdk_event_ref/unref instead of g_object_ref/unref.
Events will stop being object soon.
2020-02-21 00:47:53 -05:00
Matthias Clasen
9a1497f582 events: Drop GDK_DESTROY
No backend is emitting GDK_DESTROY events anymore, so no
need to carry this around.
2020-02-21 00:40:52 -05:00
Matthias Clasen
7db8be93f4 gtk: Stop handling GDK_DESTROY differently from GDK_DELETE
We don't have child windows anymore, so there is no difference.
2020-02-21 00:40:52 -05:00
Matthias Clasen
c4a2cf03b2 textview: Stop using gdk_event_copy 2020-02-21 00:40:52 -05:00
Matthias Clasen
495de0b78b main: Use constructors instead of gdk_event_copy + rewriting 2020-02-21 00:40:52 -05:00
Matthias Clasen
dac61b3cce imcontextsimple: Use event constructors 2020-02-21 00:40:52 -05:00
Matthias Clasen
080e5de786 widget: Port emulation code to constructors
Use the new event constructors when generating events
for emulating presses.
2020-02-21 00:40:52 -05:00
Matthias Clasen
374c9dd880 window: Use event constructors 2020-02-21 00:40:52 -05:00
Matthias Clasen
a5f58e8d28 main: Use event constructors
At the same time, stop setting child_surface in
crossing events. Nothing in GTK looks at it.
2020-02-21 00:40:52 -05:00
Timm Bäder
018870643a scale: Remove useless extra local variable 2020-02-20 10:30:14 +01:00
Timm Bäder
aa53fef39c scale: Remove unused member 2020-02-20 10:23:09 +01:00
Timm Bäder
faddbb18d3 emojichooser: Add style class to emoji toolbar
Closes #1013
2020-02-20 10:23:09 +01:00
Timm Bäder
f14978c68f filechooserwidget: Fold function into only caller 2020-02-20 10:23:09 +01:00
Timm Bäder
c0de02520c filechooserwidget: Use a proper GtkPopoverMenu
Instead of a fake one where we add .menu to a normal popover. This makes
the menu look like other context menus.
2020-02-20 10:23:09 +01:00
Timm Bäder
b58f9e2aa2 filechoosererrorstack: Set a layout manager
Otherwise it doesn't know what to do with its child widget.
2020-02-20 10:23:09 +01:00
Timm Bäder
b8a752c751 filechooserwidget: Allow typing a location in recent mode
This is triggered by typing / or hitting Ctrl+L. Since we don't have a
visual indicator for this mode right now anyway, the reason for not
allowing it in recent mode cited in the comment just above the
early-exit is irrelevant.

Closes #2178
2020-02-20 10:23:09 +01:00
Timm Bäder
194039c749 filechooserwidget: Remove unused constants 2020-02-20 10:23:09 +01:00
Timm Bäder
64d0f848bc text: Remove gtk_text_get_im_context()
Unused.
2020-02-20 10:23:09 +01:00
Timm Bäder
e18a159f16 spinbutton: Remove manual queue_draw() calls
Everything is automatically redrawn when changing the value, etc.
2020-02-20 10:23:09 +01:00
Timm Bäder
a1bc3ae2c8 popvermenu: Clarify css node docs
We add the .menu css class to the popover main node, not its contents
node.
2020-02-20 10:23:09 +01:00
Timm Bäder
2ad6c045b4 aboutdialog: Clarify docs and fix preconditions 2020-02-20 10:23:09 +01:00
Timm Bäder
ec6d5839bd modelbutton: Un-select on mouse leave
This brings us closer to the old GtkMenuItem behavior and also makes
more sense.
2020-02-20 10:23:09 +01:00
Timm Bäder
2bf9a5bd29 aboutdialog: Replace visited_links GList with GPtrArray 2020-02-20 10:23:09 +01:00
Timm Bäder
b5d4815eb7 aboutdialog: Use new GtkStackPage API 2020-02-20 10:23:09 +01:00
Timm Bäder
188f00e05a stack: Add GtkStackPage:visible accessors 2020-02-20 10:23:09 +01:00
Benjamin Otte
9660ae5556 Merge branch 'wip/xdg-popup-async-relayout' into 'master'
Synchronous popup layout

See merge request GNOME/gtk!1241
2020-02-19 18:57:14 +00:00
Jonas Ådahl
ca71119a40 gdk/surface: Replace move_to_rect() with GdkPopupLayout based API
Replace the gdk_surface_move_to_rect() API with a new GdkSurface
method called gdk_surface_present_popup() taking a new GdkPopupLayout
object describing how they should be laid out on screen.

The layout properties provided are the same as the ones used with
gdk_surface_move_to_rect(), except they are now set up using
GdkPopupLayout.

Calling gdk_surface_present_popup() will either show the popup at the
position described using the popup layout object and a new unconstrained
size, or reposition it accordingly.

In some situations, such as when a popup is set to autohide, presenting
may immediately fail, in case the grab was not granted by the display
server.

After a successful present, the result of the layout can be queried
using the following methods:

 * gdk_surface_get_position() - to get the position relative to its
   parent
 * gdk_surface_get_width() - to get the current width
 * gdk_surface_get_height() - to get the current height
 * gdk_surface_get_rect_anchor() - to get the anchor point on the anchor
   rectangle the popup was effectively positioned against given
   constraints defined by the environment and the layout rules provided
   via GdkPopupLayout.
 * gdk_surface_get_surface_anchor() - the same as the one above but for
   the surface anchor.

A new signal replaces the old "moved-to-rect" one -
"popup-layout-changed". However, it is only intended to be emitted when
the layout changes implicitly by the windowing system, for example if
the monitor resolution changed, or the parent window moved.
2020-02-19 09:47:18 +01:00
Jonas Ådahl
f43717a42e popover: Unrealize when autohide prop changes
Changing the autohide property means the popover needs to be remapped.
Remapping may need user interaction, so lets just unrealize the popover
if the property changes, forcing the application to remap it should it
be shown again.
2020-02-19 09:47:18 +01:00
Timm Bäder
5097c1defc Merge branch 'file-filter-name-property' into 'master'
GtkFileFilter: Add a GObject property for the name

See merge request GNOME/gtk!376
2020-02-19 07:43:51 +00:00
Matthias Clasen
66307f00f1 icontheme: Update the api
Add properties, and use string arrays instead of lists.

Among other things, this renames gtk_icon_theme_list_icons
to gtk_icon_theme_get_icon_names.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2410
2020-02-18 20:32:17 -05:00
Benjamin Otte
732716ba95 debug: When debug-printing, treat NULL as the default display
Otherwise we lose debug prints from all code that allows NULL displays.
2020-02-19 01:21:33 +01:00
Matthias Clasen
03ee4229f2 Merge branch 'wip/otte/dnd' into 'master'
More DND rework

See merge request GNOME/gtk!1445
2020-02-18 22:15:56 +00:00
Sebastian Dröge
8378eb22a3 GtkDialog: Add type Gtk.HeaderBar annotation to headerbar getter return value 2020-02-18 10:55:31 +02:00
Benjamin Otte
0d4d4e9a8c colorbutton: Fix drag source
By running it in the capture phase, it will not be starved for events by
the button's click source and make drags actually start a color drag
operation.
2020-02-18 02:58:58 +01:00
Benjamin Otte
b8cf7ea1c6 dnd: Port the TreeModel machinery to GValue DND 2020-02-18 02:40:00 +01:00
Benjamin Otte
1145da3ea5 placessidebar: Modernize DND
No more shooting pointers through pipes
2020-02-17 21:56:16 +01:00
Benjamin Otte
27d7aa1407 notebook: Use proper DND
Actually use GValues for the DND operation instead of sending GBytes of
pointer addresses through pipes.

This is a bit complicated because we need to special-case rootwindow
drops, because they're handled on the source side, so we need a custom
ContentProvider.
2020-02-17 21:56:16 +01:00
Benjamin Otte
9703fcc605 notebook: Move dnd scrolling via arrows to own drop target
This removes excess code from the tab dnd machinery
2020-02-17 21:56:16 +01:00
Benjamin Otte
e25bfa6a61 dragdest: Handle NULL content formats everywhere
NULL means we don't do content formats checks and accept everything.

We use this for notebook arrows or expanders that react to ongoing
drags.
2020-02-17 21:56:16 +01:00
Matthias Clasen
a838a54dca text: Treat Emoji insertion like clipboard
Enter the Emoji inseration in the undo history.
Also, stop stashing away the selection when we
pop up the Emoji chooser, and use the selection
as-is when we insert the Emoji.
2020-02-17 15:05:09 -05:00
Benjamin Otte
f5e3584b5b placessidebar: Don't claim to support text dnd
Because you don't. And never did.
2020-02-17 04:04:21 +01:00
Benjamin Otte
80ba7fd682 dragdest: Make gtk_drop_target_new() args be transfer full
Saves tons of code.
2020-02-17 04:04:21 +01:00
Benjamin Otte
91d91a29e8 colorbutton, colorswatch: Simplify DND
- Use GDK_TYPE_RGBA and let GDK do the conversion from
  application-x-color
- Don't do extra mime type checks when accept() does that for us already
2020-02-17 04:04:21 +01:00
Benjamin Otte
3a7e3cf90d dragdest: Simplify function
Make it obvious that the functions checks one condition and then the
other.
2020-02-17 04:04:21 +01:00
Benjamin Otte
e1f8c1430f dnd: simplify code
The old code did mimetype checks everywhere when type compatibility has
since been moved to the GtkDropTarget::accept signal.

So the code can now just assume a compatible mime type exists.
2020-02-17 04:04:21 +01:00
Benjamin Otte
da83457a60 dnd: Remove gdk_content_provider_new_with_callback()
Content providers are meant to be immutable, apart from very special
cases, but in those cases they need to emit
gdk_content_provider_content_changed().

Having a constructor that just uses a get_func invites abuse of this
by not making developers aware of those requirments.
In fact, all users in GTK failed to do this.

Instead, code should use the GtkDragSource::prepare signal to create
content providers when needed.

The same problem exists with gdk_content_provider_new_with_formats(),
but this commit doesn't touch that.
2020-02-16 20:10:31 +01:00
Benjamin Otte
8d2ed36a1b contentprovider: Add gdk_content_provider_new_typed()
Gets around the boilerplate required to create and initialize a GValue
by having this function doing it via G_VALUE_COLLECT().
2020-02-16 20:10:30 +01:00
Benjamin Otte
410dbdf671 widget: Fix namespacing problem
In Vala and JS at least, gtk_widget_get_css_name() and
gtk_widget_class_get_css_name() are resolved to
GtkWidget.get_css_name().

To avoid this problem, we rename the class version.
2020-02-16 20:05:05 +01:00
Benjamin Otte
43b8aff62c widget: Fix typos for css-clases property 2020-02-16 19:57:45 +01:00
Benjamin Otte
47c8026e38 Merge branch 'wip/otte/dnd' into 'master'
some DND fixes

See merge request GNOME/gtk!1440
2020-02-15 23:45:25 +00:00
Benjamin Otte
894ac6c126 dragdest: Use format matching APIs 2020-02-15 21:04:33 +01:00
Timm Bäder
08501c9510 calendar: Emit {next,prev}-{month,year} signals
Fixes #833
2020-02-15 17:18:27 +01:00
Timm Bäder
a4ecfd8f33 widget: Use get_css_name() in get_property()
Instead of reimplementing it there.
2020-02-15 17:18:27 +01:00
Timm Bäder
28482e52be Adwaita: Add focus outlines back to scale troughs
Fixes #189
2020-02-15 17:18:27 +01:00
Timm Bäder
bf839dbb88 coloreditor: Scale h value to 360
Fixes #1321
2020-02-15 17:18:27 +01:00
Timm Bäder
2529464e21 range: Avoid rounding errors when allocating highlight
Fixes #2438
2020-02-15 17:18:26 +01:00
Timm Bäder
7e43034068 widget: Add css-classes property
Mirroring the values added and removed via {add,remove}_css_class().
2020-02-15 17:18:26 +01:00
Timm Bäder
52979a0e93 infobar: Remove _get_{action,content}_area()
Accessors like these are weird to have and we can add widgets to the
content area via gtk_container_add() as well as add widgets to the
action area via gtk_info_bar_add_action_widget().
2020-02-15 17:18:26 +01:00
Timm Bäder
a7de8e6b2f infobar: Don't store close button visibility separately
We can already set and query that value via
gtk_widget_{get,set}_visible() on the close button.
2020-02-15 17:18:26 +01:00