Commit Graph

3227 Commits

Author SHA1 Message Date
Christian Hergert
5e341210a1 texthistory: add GtkTextHistory helper
The GtkTextHistory helper provides the fundamental undo/redo stack that
can be integrated with other text widgets. It allows coalescing related
actions to reduce both the number of undo actions to the user as well as
the memory overhead.

A new istring helper is used by GtkTextHistory to allow for "inline
strings" that gracefully grow to using allocations with g_realloc(). This
ensure that most undo operations require no additional allocations other
than the struct for the action itself.

A queue of undoable and redoable actions are maintained and the link for
the queue is embedded in the undo action union. This allows again, for
reducing the number of allocations involved for undo operations.
2019-11-05 09:34:29 -08:00
Matthias Clasen
dbbb7eef15 testicontheme: Remove useless function
Contexts in icon themes are not useful for anything,
so drop this function from testicontheme.
2019-10-18 08:53:23 -05:00
Timm Bäder
8928323c6b popover2.ui: Stop trying to set GtkModelButton:label
The property is called "text"
2019-10-09 16:57:22 +02:00
Timm Bäder
c7203550a2 testmodelbutton: Remove toggles for removed properties 2019-10-09 16:57:22 +02:00
Christian Hergert
fea2a82ef6 textview: use GtkTextViewChild for border and overlay children
This creates a new GtkTextViewChild that can manage overlay children at
given x,y offsets in buffer coordinates. This simplifies GtkTextView by
extracting this from GtkTextWindow as well as providing a real widget for
the borders.

With this change, we also rename gtk_text_view_add_child_in_window() to
gtk_text_view_add_overlay(). For those that were using
GTK_TEXT_WINDOW_WIDGET, they can use a GtkOverlay. It does not appear
that anyone was using GTK_TEXT_WINDOW_(LEFT|RIGHT|TOP|BOTTOM) for widgets
in this fashion, but that can be done by setting a gutter widget with
gtk_text_view_set_gutter(). We can make GtkTextViewChild public if
necessary to simplify this should it become necessary.

GtkTextViewChild will setup a CSS node of either "text" or "border"
depending on the GtkTextWindowType.

The old GtkTextViewChild has been renamed to AnchoredChild as it is only
used for widgets with anchors in the GtkTextBuffer. This also removes the
use of allocated GSList and instead embeds a GQueue and GList to save a
few extraneous allocations.
2019-10-04 14:45:43 -07:00
Matthias Clasen
9501fc2c14 Merge branch 'nested-popover-menu' into 'master'
Nested popover menus

See merge request GNOME/gtk!1076
2019-09-10 01:09:31 +00:00
Timm Bäder
7d93e9963a testlist2: quit on window close 2019-09-09 17:36:27 +02:00
Timm Bäder
71339225eb icontheme: Remove gtk_icon_info_load_texture
It's the same as load_icon now.
2019-09-09 17:36:26 +02:00
Timm Bäder
590e70d4d1 icontheme: Return a paintable from gtk_icon_info_load_icon 2019-09-09 17:36:26 +02:00
Timm Bäder
fd16ac4d5e icontheme: Return paintables from more API 2019-09-09 17:36:26 +02:00
Timm Bäder
f3099afcc5 icontheme: Return textures from load_icon{,_for_scale} 2019-09-09 17:36:26 +02:00
Timm Bäder
6821fe0c13 icontheme: Add error argument to _load_texture
Loading an icon might fail.
2019-09-09 17:36:26 +02:00
Timm Bäder
4cc4868e93 label: Remove "line" from wrap properties
The property names are "wrap" and "wrap-mode", so it doesn't make sense
that the accessors refer to line_wrap and line_wrap_mode.
2019-09-09 17:36:23 +02:00
Matthias Clasen
ea44eade21 Add nesting popover menus
Add a variant of popover menus that are nesting
like traditional menus. This is a better fit for
replacing traditional main menus.
2019-09-08 19:02:06 -04:00
Timm Bäder
1c8b746b42 testscale: Properly call gtk_main_quit 2019-08-09 14:30:01 +02:00
Jonas Ådahl
7f6c31c041 tests: Remove obsolete props from popover2.ui 2019-07-24 22:42:37 +02:00
Jonas Ådahl
a2ff6af4b3 tests: Add back testpopupat
It's still useful for testing menus. Fixed the .ui file by removing a
property that no longer exists.

This effectively reverts commit
84d2150077.
2019-07-03 11:42:28 +02:00
Benjamin Otte
d541aed165 testgtk: Remove unused code
This code has been doing nothing since 2010 when the optionmenu was
removed in 274395063a.
2019-06-18 15:53:01 -04:00
Timm Bäder
66b081dc9c glglyphcache: Use stb_rect_pack for better glyph packing 2019-06-04 22:42:00 +00:00
Matthias Clasen
90f330e27a Merge branch 'gesture-click' into 'master'
Rename GtkGestureMultiPress to GtkGestureClick

See merge request GNOME/gtk!878
2019-05-29 18:39:09 +00:00
Matthias Clasen
d2bc5b490a tests: Stop using gtk_window_set_position
This api is going away.
2019-05-29 18:04:08 +00:00
Matthias Clasen
7f65e5f96b Rename GtkGestureMultiPress to GtkGestureClick
The name just made it hard for people to find the
right gesture to use.
2019-05-29 17:10:46 +00:00
Matthias Clasen
5675d585f4 testgtk: Fix a crash
Somebody forgot to update the signal handler
here when changing the size-allocate signal.
2019-05-29 11:07:01 -04:00
Benjamin Otte
a079fd2def widget: Fix transform refcounting in allocate()
Make the transform (transfer full).

1. This makes sure we actually reference the transform. Previously we
   did not.
2. Most callers create a new transform to pass to us. Now they don't
   have to uref it anymore.
2019-05-29 16:34:56 +02:00
Matthias Clasen
7447abb52b Stop using gtk_widget_get_toplevel
All uses of it can be replaced by gtk_widget_get_root.
2019-05-28 20:25:16 +00:00
Matthias Clasen
302d2a04ae Stop using gtk_widget_get_surface
Replace all uses of gtk_widget_get_surface by
gtk_native_get_surface.
2019-05-28 20:25:16 +00:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Matthias Clasen
6ab8ab87c8 Reimplement GtkPopover 2019-05-28 20:25:13 +00:00
Daniel Boles
037454d904 testscrolledwindow: GtkMenuButton != GtkContainer
It's not anymore, so don't cast it to one... Use the new :label instead.
2019-05-21 21:21:01 +01:00
Benjamin Otte
5273634f47 tests: Use g_free(), not free()
Windows doesn't like that.
2019-05-21 07:23:30 +02:00
Benjamin Otte
a1d08b4b52 rendernode: Take a graphene_point_t for the offset
... instead of 2 floats.
2019-05-21 06:43:59 +02:00
Matthias Clasen
5368f98dd5 demos: Stop using gtk_button_clicked 2019-05-18 14:33:41 -04:00
Timm Bäder
dde69802cd Add error func to node deserialization 2019-05-05 07:18:39 +02:00
Matthias Clasen
c9eca55c5e tests: Stop using gtk_menu_set_display
It is not needed here.
2019-05-01 21:54:57 +00:00
Matthias Clasen
92e21c3f1c Drop the can-default property
It was added at a time when default buttons
had a very large external border that would disrupt
aligment. Not a problem nowadays.
2019-04-28 23:28:39 +00:00
Matthias Clasen
89f7b974f2 Stop using gtk_widget_grab_default
Replace gtk_widget_grab_default by gtk_window_set_default_widget.
2019-04-28 23:21:51 +00:00
Matthias Clasen
fe3b5ba545 tests: Stop using gtk_widget_get_parent_surface
We can just use the surface of the parent.
2019-04-24 20:57:09 -04:00
Benjamin Otte
84d2150077 tests: Remove popupat test
The test hasn't worked for a while and nobody cared to fix it.

Neither do I.
2019-04-15 14:38:23 +02:00
Benjamin Otte
117fc68195 tests: Remove testboxcss
That test was cool in 2011, but hasn't been updated or used since then
because its features are now part of widget-factory and the inspector.

So let's remove it.
2019-04-12 19:34:29 +02:00
Benjamin Otte
a8f712b09a cssection: Return locations, not numbers
Now that we have GtkCssLocation, actually use it.
2019-04-12 19:34:28 +02:00
Benjamin Otte
a938c14d11 build: Add gtk-css static library
This library is meant to be the new CSS library that gets used from GDK,
GSK and GTK for string printing and parsing.

As a first step, move GtkCssProviderError into it.

While doing so, split it into GtkCssParserError (for critical problems)
and GtkCssParserWarning (for non-critical problems).
2019-04-12 19:34:28 +02:00
Matthias Clasen
ef982b7d46 Rename things
Rename the can-pick property to can-target,
and redo the pick flags with more descriptive names.
2019-04-08 08:42:25 -04:00
Matthias Clasen
b804235aea Add a flags argument to gtk_widget_pick
This will be used to let the inspector and other users
pick insensitive widgets again. For now, update all
callers to pass no flags, preserving the current
behavior.
2019-04-07 17:19:09 +00:00
Matthias Clasen
0a4a7b310d testgtk: Stop using child properties 2019-04-05 12:01:43 +00:00
Matthias Clasen
f184393f07 Remove testactionbar
This test relies on child properties.
2019-04-05 12:01:43 +00:00
Matthias Clasen
1f37600c4c Remove testtitlebar
This test relies on child properties.
2019-04-05 12:01:43 +00:00
Matthias Clasen
69d4081ff8 Merge branch 'wip/ebassi/grid-layout' into 'master'
Implement GtkGridLayout

See merge request GNOME/gtk!714
2019-04-05 02:42:55 +00:00
Emmanuele Bassi
9700543e02 tests: Update GtkGrid definitions in UI files 2019-04-05 00:20:45 +01:00
Matthias Clasen
09cd6e3b5f Fix teststack
This testcase wasn't updated to new GtkStack apis.
2019-04-03 15:10:10 +00:00
Emmanuele Bassi
447dfc029f Remove GtkLayout
The need of a specialised fixed layout container that can be placed into
a GtkScrolledWindow ceased to exist once GtkScrolledWindow gained the
ability to automatically interpose a GtkViewport when adding a child
that does not implement GtkScrollable.

All the other justifications that led to the existence of GtkLayout as a
separate widget from GtkFixed have been largely made irrelevant in the
20 years since its inception.
2019-04-02 15:29:20 +01:00
Matthias Clasen
53a28f7672 testrevealer: Cover the new transitions
Add tests for all the swing transitions.
2019-03-29 10:54:45 -04:00
Matthias Clasen
700183e5b6 Convert ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-28 16:37:21 -04:00
Matthias Clasen
14ad26a599 Convert ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-27 18:40:40 -04:00
Matthias Clasen
7ac250dea7 Convert all ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-27 13:36:24 -04:00
Matthias Clasen
de741e57f3 tests: Stop using gtk_window_set_gravity
This api is going away.
2019-03-26 17:55:29 -04:00
Matthias Clasen
27c286773c tests: Stop using gtk_window_move
It is going away.
2019-03-26 17:55:29 -04:00
Matthias Clasen
6b6f26ed45 Add a window move/resize test 2019-03-26 15:57:04 -04:00
Matthias Clasen
7ca24f12d7 window: Remove initial-focus builder support
With focus-widget now a property, this is no longer needed.
2019-03-16 21:24:45 -04:00
Matthias Clasen
2bf1561b48 Port widgets to the root focus API 2019-03-16 21:24:44 -04:00
Matthias Clasen
a3b73a416e password entry: Add a way to see the content
Add a ::show-peek-icon property and show a clickable
icon when it is set. Clicking it toggles the visibility
of the content. The same functionality is also accessible
via a context menu item.

This is a common feature of password entries.
2019-03-14 20:31:45 -04:00
Benjamin Otte
0e1a50366a transform: Move to GSK
The renaming of the prefix makes this a large patch.
2019-03-04 23:09:02 +01:00
Timm Bäder
f35b8a7541 Fix compile time warnings 2019-03-02 05:28:55 +01:00
Matthias Clasen
9e0c471b03 entry, spin button: Drop redundant API
Avoid duplicating GtkEditable APIs. Port existing users.
2019-02-28 16:34:00 -05:00
Matthias Clasen
41c0ac1a68 Merge branch 'overlay-cleanup' into 'master'
Overlay cleanup

See merge request GNOME/gtk!600
2019-02-22 03:38:20 +00:00
Matthias Clasen
f8609efa2b testoverlay: Use gtk_widget_set_can_pick
Use gtk_widget_set_can_pick instead of the
overlay-specific api with the same purpose.
2019-02-21 21:55:05 -05:00
Matthias Clasen
3487ebe4fd remove tests that no longer work 2019-02-21 19:46:38 -05:00
Benjamin Otte
e8b5056940 And another keybinding leftover 2019-02-22 00:07:35 +01:00
Benjamin Otte
c24f32619f widget: Make gtk_widget_allocate() take a GtkTransform
We can reason about GtkTransform way better - and determine its category or
do equality checks.
2019-02-21 19:47:27 +01:00
Benjamin Otte
01f7f255b5 gtk: Check return value of compute_bounds()
Half of these calls will completely break if anybody ever uses CSS
transforms with them, but hey...
2019-02-20 05:26:31 +01:00
Timm Bäder
8ce6cf569f Add test for widget transforms 2019-02-19 19:22:10 +01:00
Matthias Clasen
22ea832eb3 Fix testtreesort warnings 2019-02-19 00:25:59 -05:00
Matthias Clasen
210c5d88a2 Add a test for GtkPassworkEntry 2019-02-19 00:25:59 -05:00
Matthias Clasen
e5e2bd3187 Drop GtkAssistantPage::has-padding
This is causing us some internal complications, and
it is very easy to just add padding to the pages
yourself.
2019-02-15 10:23:48 -05:00
Emmanuele Bassi
61fbd5b541 tests: Fix comment for accuracy
The command line for compiling testwindowsize has changed.
2019-02-06 10:41:49 +01:00
Timm Bäder
55b99e9916 window: Remove icon list 2019-02-05 08:11:43 -05:00
Matthias Clasen
5120748981 Drop GtkButtonBox
This widget does not seem worth keeping,
and we want to get rid of child properties.
2019-02-04 12:44:55 -05:00
Timm Bäder
25e199e7b7 testgtk: Fix image menu item child order
We want the image first, text second.
2019-02-04 17:05:30 +01:00
Emmanuele Bassi
3bb1423804 tests: Remove spurious gtk_container_add()
Commit bd71e744d2 removed
gtk_box_pack_end(), but it added a gtk_container_add() with an
uninitialised widget, and the compiler is very unhappy about it.
2019-02-04 10:03:33 +01:00
Matthias Clasen
b0e67f1eed testcombo fixup 2019-01-23 22:52:16 -05:00
Matthias Clasen
f87e40bccd Drop a grid combo example 2019-01-23 22:45:55 -05:00
Matthias Clasen
e2693ef44f testgtk: Drop tabular menu
Tabular menus are basically unused, and we want to drop this.
2019-01-23 22:40:53 -05:00
Matthias Clasen
883d5d8584 box: Remove the position child property
The position child property is problematic, since it
requires us to emit notification for all children when
inserting a child early in the list of children.

Remove the property from all ui files.
2019-01-23 19:30:47 -05:00
Timm Bäder
28c51175d8 box: Remove pack-type child property 2019-01-23 19:30:46 -05:00
Timm Bäder
bd71e744d2 Stop using gtk_box_pack_end
It might soon go away!
2019-01-23 19:30:46 -05:00
Timm Bäder
09361e7665 tests: Remove flicker test
gtk+ hasn't been flickering in ages so this test isn't very useful.
2019-01-23 19:30:46 -05:00
Timm Bäder
4dc8ab58a3 testoverlay: Re-enable blurring
Accidentally disabled in 8b14c8d0a8
2019-01-13 08:23:25 +01:00
Timm Bäder
8b14c8d0a8 testoverlay: Fix fancy effect 2019-01-10 16:49:19 +01:00
Timm Bäder
ad93806005 showrendernode: Fix GtkImage size
Make sure we show the paintable unscaled.
2018-12-02 16:14:31 +01:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Timm Bäder
75deff035b testappchooserbutton: Fix for class hierarchy change 2018-11-13 15:19:07 +01:00
Timm Bäder
45b909f2c5 testpopup: Fix GtkEventControllerMotion::motion callback signature 2018-11-08 05:48:14 +01:00
Daniel Boles
18199a3cef testtreelistmodel: Don't use non-standard function
as per efd3758f6a strcasecmp() is not a C
standard thing (not that we bothered including any header for it anyway)
and so this test failed to build on Windows with Microsoft Visual C.
2018-11-07 20:32:55 +00:00
Carlos Garnacho
f3674688bf tests: Drop "saved positions" test in testgtk
This test solely relies on configure events, which aren't supported anymore.
2018-10-15 20:05:54 +02:00
Carlos Garnacho
dd6aa7b870 tests: Drop ::event handler in testgtk
We can use ::size-allocate for it, as window positions in root coordinates
are neither supported nor crucial here.
2018-10-15 17:39:04 +02:00
Carlos Garnacho
3c73f70dae tests: Use GtkEventControllerMotion in testpopup
Track motion through it, instead of a GtkWidget::event handler.
2018-10-15 17:39:04 +02:00
Carlos Garnacho
65fbd0af4e tests: Remove ::event handler in testwindowsize
We just want widget size here, not windowing configuration events.
2018-10-15 17:39:04 +02:00
Manu Cornet
a0056d5ca8 Remove some duplication in testfilechooserbutton
Most of the code creating the two types of dialogs (open file,
choose folder) is the same. This refactors the common code into a
helper method. This also makes it easier to add other chooser types
for this test (e.g. save file).
2018-09-17 12:27:46 +00:00
Benjamin Otte
ee5708f543 testtreelistmodel: Display the file icon, because why not 2018-09-16 18:50:17 +02:00
Benjamin Otte
b94b8ac38d testtreelistmodel: Make the statusbar display more info
Now display how many items were filtered (if any) and how many
directories remain to be sanned (if any).
2018-09-16 18:50:17 +02:00
Benjamin Otte
afd69db678 testtreelistmodel: Sort files by name 2018-09-16 18:50:17 +02:00
Benjamin Otte
64b7c123cc testtreelistmodel: Add search
Add a simple search that does a case insensitive substring search of the
file paths.
2018-09-16 18:50:17 +02:00
Benjamin Otte
fcb780ee13 testtreelistmodel: Make the directory loading async
This is way more complicated than it should be, because it requires
manually limiting the number of open file enumerators.

On the other hand, it exhaustively tests the items-changed emission of
all involved listmodels because those signals come in pretty much
randomly.

It's also 50% slower than the sync version, with the caeat that the sync
version only shows the UI after it's done loading, while this version
shows it right away.
2018-09-16 18:50:17 +02:00
Benjamin Otte
65b795b861 testtreelistmodel: Add a hack to handle LONG lists
... and make the lists long by autoexpanding the tree.
2018-09-16 18:50:17 +02:00
Benjamin Otte
4b5fb5ec79 treelistmodel: Refactor to add GtkTreeListRow
This patch does multiple things:

1. Add a custom persistent per-row object.
2. Move all per-row API to that object. This means notifications are now
   possible.
3. Add a "passthrough" construct-only property to the TreeListModel that
   influences if the model returns these new object or passes through
   the ones from the model.

This greatly simplifies the code needed to be written for widgetry,
because one can just connect the per-row object to the expanders that
expand and collapse rows.

As an added power feature, these objects can also be passed through
further models (like filter models).

It also adds kind of a hack to Adwaita to make the test look neat.
2018-09-16 18:50:17 +02:00
Benjamin Otte
573c63973a gtk: Add GtkTreeListModel
This is a GListModel implementation with a neat API that can be used to
implement trees inside GtkListBox.
2018-09-16 18:50:17 +02:00
Timm Bäder
0082675de8 testoverlaystyleclass: Fix CSS snippet 2018-08-27 18:13:01 +02:00
Timm Bäder
ed8e784879 remove tests/testinput
It's broken and almost the exact same thing as the drawing demo in
gtk4-demo.
2018-08-27 17:56:02 +02:00
Benjamin Otte
50d5666db0 container: Remove focus chains
They're prectically unused.

Widgets who want to influcence the focus chain behavior should implement
GtkWidgetClass::focus and deal with focus there.
2018-07-31 22:34:27 +02:00
Carlos Garnacho
5d1b2f627c tests: Port testwidgetfocus to using a motion controller 2018-07-30 13:14:12 +02:00
Carlos Garnacho
25b3b90920 tests: Port motion-compression to using a motion controller 2018-07-30 13:14:12 +02:00
Carlos Garnacho
5e0f2d7d20 tests: Use gesture in testtreepos 2018-07-30 13:14:12 +02:00
Carlos Garnacho
88743ab975 tests: Use gesture to popup menu in testiconview 2018-07-30 13:14:12 +02:00
Carlos Garnacho
6f15447633 tests: Update testgrid to use gestures 2018-07-30 13:14:12 +02:00
Jonas Ådahl
af21583d4d tests: Stop using legacy gtk_menu_popup API
Use the new portable APIs, so that menus will be positioned properly on
all backends.
2018-07-27 17:16:44 +02:00
Ernestas Kulik
1fbbaef49e testpopover: Don’t set margin in menu box
The gizmo already provides sufficient padding.
2018-07-23 13:05:57 +03:00
Matthias Clasen
7a1073c3ae Revert "gdk: Drop configure events"
This reverts commit a8926c9d87.
2018-07-15 20:23:45 -04:00
Matthias Clasen
a8926c9d87 gdk: Drop configure events
Replace configure events with a GdkSurface::size-changed signal.
This is part of the move to use events only for input.
2018-07-15 11:51:09 -04:00
Benjamin Otte
cbb1e74bb5 textview: Only create cairo context in gtktextdisplay.c
Everything else is done using GtkSnapshot now, including renaming the
draw_layer vfunc to snapshot_layer.
2018-07-14 05:27:54 +02:00
Matthias Clasen
7733f646d6 gdk: Rename GdkDragContext to GdkDrag
This is to go along with the newly introduced GdkDrop.

This commit includes the necessary updates to the X11, Wayland
and Broadway backends. Other backends have to be updated separately.
2018-07-02 14:59:26 +02:00
Carlos Garnacho
e08e15ba51 gtkentry: Use gestures for entry icons
Instead of doing all handling manually in the ::event vfunc,
set up drag/multipress gestures on icon images, and implement
emission of ::icon-press/release and DnD there.

As a side effect, the GdkEvent field in ::icon-press/release
signals has been dropped. Callers that might be interested on it
may still use gtk_get_current_event*().
2018-06-21 12:50:57 +02:00
Benjamin Otte
9a91d3739d widget: Remove time argument from drag_data_get() vfunc 2018-06-18 23:49:53 +02:00
Benjamin Otte
b00609c21c dnd: Make drag-motion and drag-drop signals use GdkDrop 2018-06-18 23:49:52 +02:00
Benjamin Otte
6d7cb2b781 dnd: Make drag-data-received use a GdkDrop 2018-06-18 23:49:52 +02:00
Benjamin Otte
314eaf7d10 widget: Make GtkWidgetClass::drag_leave() take a GdkDrop
Drag Contexts are on their way out!
2018-06-18 23:49:20 +02:00
Benjamin Otte
5b0a6a52c1 dnd: Get rid of gtk_drag_finish()
It's just a wrapper around gdk_drag_finish(), so use that one instead.
2018-06-18 23:49:20 +02:00
Benjamin Otte
4f3058f195 eventcontrollermotion: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
1e6eb1f8b9 draggesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
4ddc94b293 multipressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Daniel Boles
1e5c79ed47 testentrycompletion: Use the model we already got
cherry-pick of gtk-3-22 commit af350b20b1
2018-04-24 13:45:49 +01:00
Benjamin Otte
73b4a62f51 snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
2018-04-24 04:06:58 +02:00
Ting-Wei Lan
43a7f36993 gtk-demo, testgtk: Don't pass an integer to fabs
It looks like a mistake which compilers are likely to warn.
2018-04-22 21:59:13 +08:00
Ting-Wei Lan
f922109a9c build: Make the default setting work on non-Linux Unix-like systems
All of the four platform-dependent backends are enabled by default. It
is usually a good default because it requires users to explicitly choose
backends they want to use. Rules in meson.build also automatically
disable unavailable backends for macOS, Windows, Linux, so users on
these 3 major platforms don't have to manually disable things when
running meson commands.

However, meson.build doesn't do the same thing for other Unix-like
systems, which is acceptable but not ideal. To make it easier to build
GTK+ on these systems, the Linux case, which enables X11 and Wayland and
disables Win32 and Quartz, is made the default for all operating systems
that are not Windows or macOS.

This commit also changes most 'host_machine.system()' calls to os_*
variables, which are easier to read and less likely to be used wrongly.
2018-04-22 21:57:10 +08:00
Benjamin Otte
af6b2cdb37 testgtk: Don't set cairo surfaces as icons
The code expects textures these days, so use those.
2018-04-12 14:03:48 +02:00
Benjamin Otte
b9c8c146d2 tests: Use gdk_texture_save_to_png() where appropriate 2018-04-12 14:02:59 +02:00
Daniel Boles
8d8db89669 testmodelbutton: Test :centered, :icon, :inverted
Test more stuff.
2018-04-08 18:48:16 +01:00
Daniel Boles
15b569e64d testmodelbutton: Fix wrongly overridding MB child
I was setting a GtkButton:label, which resulted in the ModelButton's own
custom children getting lost. That doesn't make for a useful test...
2018-04-08 18:48:16 +01:00
Daniel Boles
08126ffdf2 testmodelbutton: Add explanatory comments to CSS
and load at an earlier, more sensible place, before creating any widgets
2018-04-08 18:48:16 +01:00
Daniel Boles
5bbb185e14 tests/testmodelbutton: Add this
and test whether :action-name, :role, and CSS nodes work as expected

https://gitlab.gnome.org/GNOME/gtk/issues/163
2018-04-08 13:17:18 +01:00
Matthias Clasen
75024fea60 testgtk: Drop snapshot
This needs to be redone with modern snapshotting infrastructure.
Lets drop it for now, it is somewhat duplicative with inspector
features.
2018-04-05 19:26:53 +02:00
Matthias Clasen
98f31e61d7 testgtk: Drop the event watcher
This is not a very useful test, and it is hard to keep working
in an event controller world.
2018-04-05 19:26:53 +02:00
Benjamin Otte
1aacb14236 testgtk: Remove draw signal usage 2018-04-05 14:57:10 +02:00
Benjamin Otte
c85547667f testgtk: Take an actual snapshot of a widget
Don't just draw the widget, take the paintable of it instead!
2018-04-05 14:56:39 +02:00
Benjamin Otte
a595a4c2ce testlist3: Set the actual row as drag icon
(Well, don't do anything actually, because dnd is broken, but
in theory...)
2018-04-05 14:56:39 +02:00
Benjamin Otte
ffc7b2bb0a snapshot: Allow passing the bounds of the created paintable
This allows being more specific about the size.
It's useful in particular when the resulting render nodes might be
too small for the size, not only when they are too large. For the
latter case, using a clip node would be enough.

It also requires adding a clip node when rendering the resulting
paintable, but that should be optimized out by GtkSnapshot when not
necessary.
2018-04-05 14:56:39 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Benjamin Otte
e3a717363b snapshot: Remove clip argument from gtk_snapshot_new()
It's not used anymore. And anybody who wants to have a clip on a
newly created snapshot can achieve that using gtk_snapshot_push_clip().
2018-04-05 14:56:38 +02:00
Benjamin Otte
73650c6da2 gtk: Remove gtk_widget_queue_draw_region()
... and gtk_widget_queue_draw_area().

They don't doi anything anymore.
2018-04-05 14:56:38 +02:00
Timm Bäder
c2c1262766 testgtk: don't set a focus adjustment on a box
That will make the focus adjustment code in gtkcontainer.c scroll to the
wrong coordinates.
2018-03-28 16:32:47 +02:00
Benjamin Otte
cc9908353c tests: Don't use gtk_drag_set_icon_surface() 2018-03-26 18:30:34 +02:00
Benjamin Otte
5415d05359 tests: Remove references to long-deleted property 2018-03-26 18:16:36 +02:00
Benjamin Otte
a1898d678b surface: Remove gdk_surface_scroll()
It's yet another fancy way to call gdk_surface_invalidate_region().

Also remove the one testgtk test that was still using it.
2018-03-21 00:43:28 +01:00
Emmanuele Bassi
b304655e2d tests: Update renamed symbol 2018-03-20 17:05:33 +00:00
Carlos Garnacho
28c27f37ee Merge branch 'detect-synaptics-touchpads-v2' into 'master'
x11/xi2: Report touchpads as TOUCHPAD, not MOUSE

See merge request GNOME/gtk!65
2018-03-20 17:03:15 +00:00
Alexander Larsson
695d141f32 Merge branch 'rename-window-to-surface' into 'master'
Rename window to surface

See merge request GNOME/gtk!72
2018-03-20 16:16:57 +00:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Alexander Larsson
3dce0dcca7 GdkSurface: Rename lots of stuff from window->surface
Mostly these are internal things, but the major public change is
that event.window is now event.surface.
2018-03-20 15:14:10 +01:00
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
This is an automatic rename of various things related
to the window->surface rename.

Public symbols changed by this is:
 GDK_MODE_WINDOW
 gdk_device_get_window_at_position
 gdk_device_get_window_at_position_double
 gdk_device_get_last_event_window
 gdk_display_get_monitor_at_window
 gdk_drag_context_get_source_window
 gdk_drag_context_get_dest_window
 gdk_drag_context_get_drag_window
 gdk_draw_context_get_window
 gdk_drawing_context_get_window
 gdk_gl_context_get_window
 gdk_synthesize_window_state
 gdk_surface_get_window_type
 gdk_x11_display_set_window_scale
 gsk_renderer_new_for_window
 gsk_renderer_get_window
 gtk_text_view_buffer_to_window_coords
 gtk_tree_view_convert_widget_to_bin_window_coords
 gtk_tree_view_convert_tree_to_bin_window_coords

The commands that generated this are:

git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface

(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type

git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface

git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Timm Bäder
1d26879fa5 tests: Add testtexture
a test that simply loads a given file as a texture and renders it.
2018-03-20 09:40:10 +01:00
Daniel van Vugt
0ad27cc598 x11/xi2: Report touchpads as TOUCHPAD, not MOUSE
is_touchpad_device() for XI2 was hardcoded to look for libinput only.
Extend it slightly to correctly identify other Xorg touchpad drivers.

https://gitlab.gnome.org/GNOME/gtk/issues/97
2018-03-19 12:08:29 +08:00
Timm Bäder
bb04808eea testgtk: Remove alpha widgets demo
This used to test that "windowed widgets" and "non-windowed widgets"
handle alpha correctly, but none of the mentioned widgets are windowed
at all anymore. For the rest, this is more easily and dynamically
testable by simply using the inspector.
2018-03-17 14:05:40 +01:00
Timm Bäder
004d0f2fc1 testgtk: GtkSpinButton is not a GtkEntry anymore 2018-03-17 12:09:30 +01:00
Benjamin Otte
cbe40f5f46 image: Remove gtk_image_set_texture()
gtk_image_get_paintable() is a perfect replacement, so use that one.
2018-03-16 06:04:45 +01:00
Benjamin Otte
01f996447e tests: Port from surface to texture 2018-03-16 06:04:45 +01:00
Benjamin Otte
a8608618a9 dragsource: Replace gtk_drag_source_set_icon_surface()
... with gtk_drag_source_set_icon_paintable().
2018-03-16 06:04:45 +01:00
Benjamin Otte
d1be2b29cf entry: Make icons a paintable 2018-03-16 06:04:44 +01:00
Daniel Boles
2f16c092a5 testspinbutton: Add button to toggle wrap on Spins
I found myself wanting to test this for something else, so let's test
it. It revealed a bug immediately!

https://gitlab.gnome.org/GNOME/gtk/issues/88
2018-03-14 23:09:51 +00:00
Daniel Boles
55664f95ab testspinbutton: Orient box orthogonally to Spins
This makes better use of space.
2018-03-14 23:01:06 +00:00
Daniel Boles
bde1328a07 testinfobar: Test more properties, response signal
Also test :message-type, :show-close-button, and ::response.
2018-03-12 19:16:07 +00:00
Daniel Boles
5fe14e06da Merge branch 'wip/dboles/frame-yalign-byealign' into 'master'
Frame: Erase the now-useless property label-yalign

See merge request GNOME/gtk!40
2018-03-12 16:17:11 +00:00
Daniel Boles
6bb1f0dbf3 testinfobar: Add simple test of :visible/:revealed
This exists merely to prove that, having added :revealed, show() and
hide() now work reliably, as does set_revealed() for the animated case.

https://bugzilla.gnome.org/show_bug.cgi?id=710888
2018-03-12 15:30:55 +00:00
Daniel Boles
e4578ca7bf Frame: Erase the now-useless property label-yalign
The border is now drawn on the frame node, not using an internal border
node, so we are no longer able to align the label to vertically overlap
the border. The property no longer performs its original purpose, & nor
is it a useful candidate for giving a new role, so no point keeping it.

https://bugzilla.gnome.org/show_bug.cgi?id=778886
2018-03-12 14:17:32 +00:00
Timm Bäder
38fa5ab57b widget: Add a translate_coordinates version for doubles
So we can use that one when translating event coordinates. Also adapt
the widgetfocus demo to ensure this works.

We should probably at some point delete either the int or the double
version.
2018-03-07 20:17:39 +01:00
Timm Bäder
c02090b1f6 tests: Add testblur 2018-02-27 12:51:07 +01:00
Benjamin Otte
db267433c0 tests: Make text test have more glyphs
Load random strings from /usr/share/dict/words instead of reusing the
same 10 words all the time. That way, we get closer to the real world
use case of having a full alphabet.
2018-02-05 17:22:56 +01:00
Emmanuele Bassi
c655759cef Replace gdk_threads_add_timeout* with g_timeout_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_timeout() and
gdk_threads_add_timeout_full() exist is to allow invoking a callback
with the GDK lock held, in case 3rd party libraries still use the
deprecated gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing timeout callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Benjamin Otte
55874470ff gtk: Remove GtkRecentChooser
It's not used any more, recent files are only used by the filtchooser
and that one uses GtkRecentManager directly.
2018-02-02 23:01:31 +01:00
Benjamin Otte
bb8baa2b76 tests: Unrealize renderer
Renderers must be unrealized these days.
2018-02-02 15:34:34 +01:00
Matthias Clasen
af0d876bb7 tests: Remove some unneeded gtk_widget_show calls
Widgets are visible by default now.
2018-01-19 23:29:13 +03:00
Matthias Clasen
cdb2fcb554 gdkgears: add a way to remove gears
This is needed to test the GL resource cleanup
code paths.
2018-01-17 19:47:45 -05:00
Matthias Clasen
f3927f1155 Drop GtkGLArea::has-alpha
We now always behave as if has-alpha is TRUE.

Update all callers.
2018-01-17 12:01:25 -05:00
Matthias Clasen
3fa0d4dad7 testgtk: Stop using gdk_display_get_maximal_cursor_size
This function is going away. Just make a reasonable assumption
that cursor sizes up to 128 are supported.
2018-01-16 23:25:50 -05:00
Matthias Clasen
ba844df6f0 tests: Stop using ::button-press/release-event
The generic ::event signal works fine here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
a2bce67d3b tests: Stop using ::button-press-event
A gesture will do here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
81b8f0493a tests: Stop using ::motion-notify-event
We can use the generic ::event signal here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
9dc14b630d testinput: Port to a drag gesture
This replaces both button-press-event and motion-notify-event
handlers.
2018-01-16 14:14:10 -05:00
Matthias Clasen
33e2f31de4 testgtk: Stop using ::button-press-event
This one example can just as well use a gesture.
2018-01-16 14:14:10 -05:00
Matthias Clasen
6d1dbec9dd tests: Stop using ::focus-in/out-event
The has-focus property works just as well here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
cf9074a2e9 Add x/y to GtkEventControllerMotion::enter
We have this information available in enter events,
and having it in the controller signal as well makes
porting easier.

Update existing users.
2018-01-16 14:14:10 -05:00
Matthias Clasen
8338b0f0cc testgtk: Stop using ::configure-event 2018-01-16 14:14:10 -05:00
Matthias Clasen
cbf1ff98f7 tests: Stop using ::configure-event
The generic ::event will do.
2018-01-16 14:14:10 -05:00
Matthias Clasen
41e4c93443 Replace all remaining uses of delete-event 2018-01-16 14:14:09 -05:00
Matthias Clasen
1c3f8ba252 testoverlay: Use an event controller
We can stop using ::enter-notify-event here, and use
our new motion event controller instead.
2018-01-16 14:14:09 -05:00
Matthias Clasen
96b2b1b2f3 testgtk: Redo the event watcher case
Make this watch for emissions of ::event, since we
want to get rid of individual signals first.
2018-01-16 14:14:09 -05:00
Matthias Clasen
6ac33215a5 testgtk: Use an event controller for 'testing scrolling'
The current code was not working with smooth scroll events,
for starters.
2018-01-16 14:14:09 -05:00
Matthias Clasen
97f805b888 testinput: Drop some no-op signal handlers
These were not doing anything.
2018-01-16 14:14:09 -05:00
Matthias Clasen
3cb93a479a tests: Avoid a use of ::map-event
We can use the ::map signal here instead.
2018-01-16 14:14:09 -05:00
Matthias Clasen
67649763b6 tests: Stop using the delete-event signal
We can use ::destroy in most cases.
2018-01-16 14:14:09 -05:00
Timm Bäder
04ade9483b testheightforwidth: Remove "vertical labels" test
This was testing lables with the angle property set, which doesn't exist
anymore.
2018-01-10 08:46:22 +01:00