Commit Graph

45825 Commits

Author SHA1 Message Date
Carlos Garnacho
1045dda035 wayland: Implement DnD actions as per wl_data_device v3
Implement as a managed GdkDragContext, which actually fits nicely
with the drag-and-drop model in wayland.
2016-01-19 14:17:36 +01:00
Carlos Garnacho
0747a60129 wayland: Add internal gdk_wayland_seat_set_global_cursor()
This can be used for cases (like DnD) where there isn't necessarily
a grab, but we want a global pointer cursor.
2016-01-19 14:17:36 +01:00
Carlos Garnacho
8d47617623 gtkdnd: Reset widget controllers when starting DnD.
Otherwise there's no full guarantees that this will happen.
2016-01-19 14:17:36 +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
Carlos Garnacho
e4f5e31b8b gtkdnd: Optionally use gdk_drag_context_manage_dnd()
When this is in use, there's essentially a bunch of dead code here.
When all backends are ported, we'll be able to remove grab/cursor
management plus a bunch of source-side event handlers.
2016-01-19 14:17:35 +01:00
Carlos Garnacho
bfee45e6f9 x11: Implement gdk_drag_context_manage_dnd()
This includes managing input events and source-side DND events,
as well as setting the appropriate cursor and emitting the signals
that are expected in this mode of operation.
2016-01-19 14:17:35 +01:00
Carlos Garnacho
ed5da43afb gdk: Add gdk_drag_get_cursor()
This function (most similar to gtk_drag_get_cursor() helps figure out
the right cursor that applies to a given action. To be used by the
various backends.
2016-01-19 14:17:35 +01:00
Carlos Garnacho
f6b8fb5a6b gdk: Run DnD internal handlers before the main event handler
We'll be stealing those to GTK+, if the GdkDragContext manages
the DnD operation.
2016-01-19 14:17:35 +01:00
Carlos Garnacho
edc4374a63 gdk: Allow internal management of source-side DnD
We've traditionally left GTK+ to handle the input side of things,
letting GDK only manage the windowing-specific messaging. This
way of splitting responsibilities is not compatible however with
some backends, we must fold then input management at the DnD stage
into GDK (and backends) domain.

The gdk_drag_context_manage_dnd() call is meant to be the entry
point for this mode of operation, if the drag and drop operation
becomes managed, the caller (i.e. gtkdnd.c) doesn't need to perform
grabs, nor manage input events itself.

As a consequence of this, different aspects now belong to the
backend GdkDragContext implementation:
- Because the caller doesn't see keyboard events anymore,
  keyboard navigation must be managed in GDK, so is the decision
  of the current action based on modifiers/button pressed.
- Because the caller won't see input events in general, the lifetime
  of the drag and drop operation is now communicated through the
  ::drop-performed, ::dnd-finished and ::cancel events
- Because the caller doesn't participate anymore on the action
  being chosen, the pointer cursor must be set by the backend.
  The caller is rather notified of the final action through the
  ::action signal.

The caller is still responsible of dealing with the corresponding
GdkSelection, ensuring its ownership and communicating the supported
mimetypes.
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
Marek Černocký
f64bb38aa7 Fixed typo childen->children 2016-01-19 12:52:58 +01:00
Matthias Clasen
3fea7f296e gtk-demo: Add a progress bar to foreigndrawing
This is another commonly requested widget.
2016-01-18 23:40:38 -05:00
Benjamin Otte
409760babf container: Properly reorder no-window children
... that are setup with gtk_widget_set_parent_window().

Fixes scrollbars not being drawn in GtkScrolledWindow.
2016-01-19 04:33:09 +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
Benjamin Otte
402cecf9a2 actionbar: Don't forall() widgets twice
When using forall(), only list the revealer, which lists the box
containing all the children. When using foreach(), bypass revealer and
box and list all children added to the box.
2016-01-19 03:45:26 +01:00
Matthias Clasen
575dfb4075 Updates 2016-01-18 20:20:32 -05:00
Matthias Clasen
1821c2df60 text view: Expose cursor blink control
Derived classes like GtkSourceView with their own ::key-event
handler need access to this, in order to make their keynav
as nice as the builtin one, wrt to caret visibility.

https://bugzilla.gnome.org/show_bug.cgi?id=760748
2016-01-18 16:27:43 -05:00
Carlos Garnacho
f8b8e4eaf8 x11: Set event->scroll.is_stop
We still figure this out from 0/0 scroll events. This method is
not intended to last forever, but it's something we can cling to
so far.

https://bugzilla.gnome.org/show_bug.cgi?id=756729
2016-01-18 21:36:23 +01:00
Peter Hutterer
48aa1bb08f wayland: add gdk_event_is_scroll_stop_event()
And use it to handle kinetic scrolling in the GtkScrolledWindow.

However, dropping the delta check causes the X11-based kinetic
scroll to break since we don't have the stop event here. Correct handling of
xf86-input-libinput-based scroll events is still being discussed.

https://bugzilla.gnome.org/show_bug.cgi?id=756729
2016-01-18 21:36:23 +01:00
Peter Hutterer
3fca36169a wayland: add support for wl_pointer frame/axis_source/axis_discrete/axis_stop
This adds support for the new wl_pointer events available in v5.

The wl_pointer.axis_source events can be ignored for the purposes here, the
main reason they exist is so that the combination of axis_source=finger and
axis_stop triggers kinetic scrolling. We don't need to care about the source,
axis_stop is enough for us to tell us when we're scrolling.

The wl_pointer.frame events group events together and is intended as a
mechanism to coalesce events together. This for example allows us to now
send a single GTK scroll event for a diagonal scroll. Previously, the two
wl_pointer.axis events had to be handled separately.

The wl_pointer.axis_discrete event sends mouse wheel clicks where
appropriate, and is translated into up/down/left/right scroll events.

https://bugzilla.gnome.org/show_bug.cgi?id=756729
2016-01-18 21:36:23 +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
Matthias Clasen
b3b048906c im context simple: Protect shared data structures
Since a41f02f9b1, GtkIMContextSimple
uses threads to load X Compose files. It does that every time a new
im context object is initialized, so we can easily end up with multiple
threads accessing the shared global_tables list at the same time.

Use a lock to prevent that.

https://bugzilla.redhat.com/show_bug.cgi?id=1276432
2016-01-18 13:57:39 -05:00
Benjamin Otte
e150ea85bb cssnode: Don't leak the style cache on destruction 2016-01-18 18:06:41 +01:00
Timm Bäder
af958b86cb gdkdisplay-x11: Plug memory leak 2016-01-18 17:34:29 +01:00
Matthias Clasen
ff5d14f1a8 text view: Update selection node visibility
Make the node invisible if we don't have a selection.
2016-01-18 11:05:53 -05:00
Matthias Clasen
b08fe985cc entry: Expand the css node docs
Mention the context menu.
2016-01-18 10:52:26 -05:00
Matthias Clasen
07eda5920f text view: Expand CSS node docs
Mention the selection node, and the context menu.
2016-01-18 10:51:54 -05:00
Matthias Clasen
c24c56a143 Forgotten file 2016-01-18 09:41:46 -05:00
Benjamin Otte
3281d1a284 notebook: Don't crash when dnd'ing tabs out
https://bugzilla.gnome.org/show_bug.cgi?id=760754
2016-01-18 15:39:02 +01:00
Benjamin Otte
eca1b3cba3 accellabel: Remove unused variable 2016-01-18 15:39:02 +01:00
Matthias Clasen
6f3cff16af gdk: Clarify docs about scale
Explicitly state where we return application pixels as opposed
to device pixels.
2016-01-18 08:54:35 -05:00
Matthias Clasen
bbc08d08a9 Trivial typo fix 2016-01-18 08:36:53 -05:00
Matthias Clasen
65ae48d707 Add more CSS node tests for notebooks 2016-01-18 07:41:33 -05:00
Timm Bäder
d73f6b8c50 entry: Deprecate shadow-type
Things like that should be handled using css. Also, the property value
is unused inside GtkEntry.
2016-01-18 12:53:53 +01:00
Руслан Ижбулатов
f74f81f06b W32: Detect ticks wraparound
https://bugzilla.gnome.org/show_bug.cgi?id=748327
2016-01-18 09:23:44 +00:00
Matthias Clasen
83eb36a896 Add CSS node tests for checkbutton rtl flipping 2016-01-18 00:29:29 -05:00
Matthias Clasen
121aec6de8 Add css node tests for expander rtl flipping 2016-01-18 00:24:53 -05:00
Matthias Clasen
2a665715b6 expander: Flip the alignment of the vertical box
To ensure that the title moves to the other side as expected
in RTL, use GTK_ALIGN_START/END instead of GTK_ALIGN_FILL
when packing the title gadget into the vertical box, and
flip the alignment when the text direction changes.
2016-01-18 00:19:31 -05:00
Matthias Clasen
296f80a580 expander: Handle rtl changes again
Now that the box gadget has api for it, use it here to
change the order of the gadgets for right-to-left.
2016-01-18 00:11:54 -05:00
Matthias Clasen
a32b39c60f checkbutton: Handle rtl changes again
Now that the box gadget has api for it, use it here to
change the order of the gadgets for right-to-left.
2016-01-18 00:11:50 -05:00
Matthias Clasen
5265db5dd6 box gadget: Add a function to reverse children
This can be used to handle text direction changes.
2016-01-18 00:03:39 -05:00
Benjamin Otte
f6757e0c0c reftests: Fix up for easy CSS changes
This is mostly search and replace ala
  GtkButton => button
  GtkWindow => window
  .button => button
or removing style properties that aren't used anymore like
  -GtkButton-default-border: 0
2016-01-18 05:05:35 +01:00
Benjamin Otte
b7f32ed451 reftests: Remove test
We no longer match subtypes, so remove the test for it.
2016-01-18 05:05:35 +01:00
Matthias Clasen
7859f8ee91 checkbutton: Use a box gadget
Now that builtin icons have a baseline, we can just use
a box gadget with baseline alignment for the indicator
and the label.
2016-01-17 21:16:33 -05:00
Matthias Clasen
da30858ee4 builtin icon: set a baseline
Most uses of builtin icons (check and radio buttons,
expanders, etc) are placed next to labels, so they should
be properly positioned wrt to the baseline. Lacking anything
better, give the builtin icons a baseline that places the
center of the icon at the strikethrough position.
2016-01-17 21:02:18 -05:00
Matthias Clasen
9c3907dab0 box gadget: Deal with optional arguments
The baseline arguments to the preferred size callback can
be NULL. Don't crash if they are.
2016-01-17 19:48:40 -05:00
Matthias Clasen
44d94a4aeb Trivial formatting fix 2016-01-17 15:35:14 -05:00
Matthias Clasen
a7387e2641 Document restrictions on gtk_style_context_get
This makes it official that passing a different state
is not generally supported in the getters for CSS properties.
2016-01-17 15:31:37 -05:00
Matthias Clasen
6bf9715ce4 notebook: show tabs when asked to
gtk_notebook_set_show_tabs must make the header gadget
visible when show_tabs is TRUE, not the other way around.

https://bugzilla.gnome.org/show_bug.cgi?id=760596
2016-01-17 14:35:58 -05:00