Commit Graph

55130 Commits

Author SHA1 Message Date
Benjamin Otte
6546ef3459 picture: Introduce
This commit introduces GtkPicture, which is supposed to complement
GtkImage.

GtkImage will be adapted to always display an icon, while
GtkPicture displays regular imagery.
2018-06-10 02:23:02 +02:00
Matthias Clasen
9d48a95d9a puzzle: fix some compiler warnings
These slipped under the radar, sorry.
2018-06-09 19:39:43 -04:00
Timm Bäder
cfbba2c710 widget: Use priv pointer less
Instead declare a priv local. We should do this even if we don't remove
the priv pointer from GtkWidget entirely, just to stay consistent with
new code we introduce.
2018-06-09 21:25:15 +02:00
Руслан Ижбулатов
a394a86151 Use aligned allocators for GskRenderNode
Any data that is later fed to graphene must be
allocated with proper alignment, if graphene
uses SSE2 or GCC vector instructions.
2018-06-09 14:05:49 +00:00
Руслан Ижбулатов
8e74eb382f Add aligned allocator functions to GSK
The code is mostly stolen from graphene.
Allocators support any alignment, but their implementation
only calls system aligned allocator functions if malloc()
is not aligned to 16-byte boundaries. If it is aligned,
the implementation just calls malloc() regardless of which
alignment is requested by the caller.

This can be fixed by saving the result of meson malloc()
alignment check and adding a few conditions to the implementation,
but right now GSK and GTK only need 16-byte alignment either way.
2018-06-09 14:01:03 +00:00
Руслан Ижбулатов
bd2e3f5b9b Add aligned allocator support to meson
* A bunch of new variables for config.h.meson
* A check for aligned allocation being necessary at all
  (graphene must use GCC vector instructions or SSE2)
* A check for C malloc() being aligned at 16-byte boundaries
* A check for a few special aligned allocator functions being
  present and not being built-ins (posix_memalign is a builtin
  in GCC, even on platforms where there is no posix_memalign
  system function)
* Added -mstackrealign flag on Windows, since otherwise
  stack variables may become unaligned when the stack briefly
  passes through OS code (such as in various callbacks and
  handlers)
2018-06-09 13:52:42 +00:00
Philippe Normand
2f181df1cf gtkmain: Add gtk_get_main_thread()
This utility function can be useful to know which thread was initialized for
GTK+.
2018-06-08 18:41:54 +01:00
Philippe Normand
542ad4fdc5 gtkmain: Add gtk_is_initialized()
This utility function can be useful to check whether GTK+ was already
initialized or not.
2018-06-08 18:39:38 +01:00
Fran Dieguez
085368eb93 Update Galician translation 2018-06-08 08:09:57 +00:00
Matthias Clasen
1ee23d0d49 puzzle: Add mouse support
Make it so that clicking on a puzzle piece moves enough
pieces to move the empty space there, if it is possible.
2018-06-07 21:47:30 -04:00
Matthias Clasen
ebf042d305 puzzle: Use plain labels
The previous code looked cool in the UI, but was too much
of a hack in the code.
2018-06-07 21:47:30 -04:00
Matthias Clasen
a849ffbd79 Add tweaks
Allow setting the puzzle size, and allow chosing between
the rose and the radioactive animation. Change the default
size to 3. 6 is just too hard.
2018-06-07 21:47:30 -04:00
Matthias Clasen
547d63d56a puzzle: Add a reshuffle button 2018-06-07 21:47:30 -04:00
Matthias Clasen
ddad5c3ce9 Keep aspect ratio of the image
Since we don't have a good way to control the window size tightly,
make the content keep aspect ratio.
2018-06-07 21:47:30 -04:00
Benjamin Otte
b6c8943bbf demo: Add the sliding puzzle demo 2018-06-07 21:47:30 -04:00
Matthias Clasen
46d8c84049 Merge branch 'master' into 'master'
Fix reference to user styles in gtkstyleprovider.h

See merge request GNOME/gtk!184
2018-06-07 18:27:25 +00:00
Mohammed Sadiq
59c8fdff29 font-button: Suggest non deprecated function in docs
gtk_font_button_get_font_name() has been deprecated in 3.22 and
its public API is removed from GTK4.
2018-06-07 15:45:32 +05:30
Matijs van Zuijlen
932e5ea34e Fix reference to user styles in gtkstyleprovider.h 2018-06-07 08:54:23 +00:00
Matthias Clasen
d2d4ea6f0a Merge branch 'wip/move-to-rect-public' into 'master'
gdk: Make gdk_surface_move_to_rect public

See merge request GNOME/gtk!179
2018-06-05 21:02:51 +00:00
Daniel Boles
3396c5e983 SizeRequest: Round px values up for min CSS sizes
Otherwise, requesting a min size in em where the equivalent in px had a
fractional part would lead to the widget getting allocated 1 too few px.
You could see this in the CSS property vs. allocation in the Inspector.

Note that margin/border/padding are left alone: the rationale is that we
do as browsers do, and Benjamin said we already do that for those,
whereas his tests on min-(width|height) showed otherwise. My subsequent
analysis indicated it to be far less clear-cut than that, but he remains
unconvinced that we should ceil() all the things! So just do these ones.

https://gitlab.gnome.org/GNOME/gtk/issues/1088
2018-06-05 18:49:52 +01:00
Jonas Ådahl
c0e1044d5c gdk: Make gdk_surface_move_to_rect public
This is the API used by GtkMenu to properly position menus on the screen
without requiring GTK to query the menu window's position or the work
area of where the window is positioned. It makes it possible to position
popup windows properly when using Wayland.

Make this API available to external users so custom popup windows can be
positioned properly as well.

Related: https://gitlab.gnome.org/GNOME/gtk/issues/997
2018-06-05 17:53:05 +02:00
Timm Bäder
5c24bbf00c popover: Add missing close paren in docs 2018-06-04 21:58:44 +02:00
Timm Bäder
a1e3e9dd17 colorbutton: Remove priv pointer 2018-06-04 21:58:44 +02:00
Timm Bäder
d53c28b07a aspectframe: Remove unused member 2018-06-04 21:58:44 +02:00
Timm Bäder
a3987f3386 bin: Remove public GtkBinPrivate typedef 2018-06-04 21:58:44 +02:00
Timm Bäder
4e9a879de0 statusbar: Remove garbage from header file
Nobody will ever read those comments; documentation belongs into the
soruce file so gtk-doc actually picks it up.
2018-06-04 21:58:44 +02:00
Timm Bäder
9109b0c3f2 statusbar: Remove priv pointer 2018-06-04 21:58:44 +02:00
Timm Bäder
758137b5d9 widget: Add docs for {get,set}_focus_child
With get_ being still private.
2018-06-04 21:58:44 +02:00
Timm Bäder
4ab3aada3f gl renderer: use w axis vector from graphene
Instead of initializing our own one every time.
2018-06-04 21:58:44 +02:00
Matthias Clasen
7a5567bf41 Merge branch 'patch-1' into 'master'
GtkWindow: Handle non-square icons with height > width correctly

Closes #657

See merge request GNOME/gtk!170
2018-06-03 18:10:03 +00:00
Christian Stadelmann
a70f0356e9 GtkWindow: Handle non-square icons with height > width correctly 2018-05-31 17:26:17 +02:00
Mohammed Sadiq
f4c1a40446 widget: Fix example code in doc 2018-05-31 16:24:00 +05:30
Matthias Clasen
8b24d59cde Merge branch 'gesture-docs' into 'master'
Gesture stuff

See merge request GNOME/gtk!169
2018-05-30 02:13:04 +00:00
Matthias Clasen
60aeb15116 x11: Don't set NET_WM_PID when sandboxed
It is not useful, and some window managers misinterpret it and
add some "runs as root" indication to the window decoration.

See https://github.com/mate-desktop/marco/issues/301
2018-05-29 20:19:05 -04:00
Matthias Clasen
c83441ae4a gdk: Add a private api to find sandboxes
This will be used in more places in the future.
2018-05-29 20:17:22 -04:00
Benjamin Otte
83a80ab866 events: Mark static function as such 2018-05-29 21:54:47 +02:00
Benjamin Otte
7e574fa98c gdk: Get rid of gdk_event_free()
Events are objects, so use g_object_unref().
2018-05-29 21:53:44 +02:00
Ernestas Kulik
4d2b39d98c gesturemultipress: Don’t fire ::released after ::cancel
Causing a grab in the handler for ::pressed by, e.g., popping up a
context menu will cause the gesture to be canceled and, subsequently,
::end and ::released to be fired, all while the button is still
physically pressed. That results in no event being available to the
::released handler and garbage coordinates, given that
gtk_gesture_get_point() returns FALSE.

Emitting ::released can be avoided by checking the return value
gtk_gesture_get_point().
2018-05-29 19:09:28 +03:00
Ernestas Kulik
e9765c0405 gesture: Fix code snippet
GTK_EVENT_SEQUENCE_ACCEPTED seems to never have been a valid enumeration
value. GTK_EVENT_SEQUENCE_CLAIMED is the closest in meaning.
2018-05-29 18:27:59 +03:00
Ernestas Kulik
334c7911c1 gesture: Fix get_last_event() docs
Querying the event sequence of a gesture will always yield NULL for
non-touch events, but passing NULL in to calls to
gtk_gesture_get_last_event() is a perfectly valid use case.
2018-05-29 18:15:20 +03:00
Victor Toso
d424837496 gdkseatdefault: Don't hide GdkSurface on grab failure
Application is not expecting that.

Bug found due gdk_seat_grab() failure on Lock Screen. When user
Unlock the screen, the application is visible but does not receive
enter-event any more on X11/GNOME.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1485968
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1571422

Signed-off-by: Victor Toso <victortoso@redhat.com>
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
2018-05-29 14:05:14 +02:00
Carlos Garnacho
694d9aa9f9 gtkpopover: Fix thinko in key press event type check
That code branch is meant to check for key events, seems obvious we want
GDK_KEY_PRESS, not GDK_BUTTON_PRESS (which also broke the branch right
below).

Makes us all able to dismiss popovers again.
2018-05-29 14:05:14 +02:00
Carlos Garnacho
317abed78e Revert "popover: Fix setting priv->button_pressed in ::event handler"
This reverts commit d638ff3afa.

Doesn't look like the right fix. Another one coming that fixes dismissing
through both pointer and keyboard.
2018-05-29 14:03:27 +02:00
Matthias Clasen
979a7e8afa Remove an unused struct
Positive side-effect: visual c no longer has an empty struct
to complain about.
2018-05-27 11:57:49 -04:00
Timm Bäder
d638ff3afa popover: Fix setting priv->button_pressed in ::event handler
There were two cases in that if/else cascade handling the
event_type == GDK_BUTTON_PRESS case, so priv->button_pressed never got
set.
2018-05-27 17:51:51 +02:00
Timm Bäder
c8decbaad0 gdkscreen-x11: Remove redundant typedef
Causes warnings with clang.
2018-05-27 17:51:51 +02:00
Timm Bäder
719b2b0525 gl renderer: Remove an outdated comment 2018-05-27 17:51:51 +02:00
Matthias Clasen
f9875040c6 Merge branch 'master' into 'master'
icontheme: Keep dir_mtimes in order

Closes #1115

See merge request GNOME/gtk!161
2018-05-27 15:50:17 +00:00
Timm Bäder
7f9cd9f9d9 filechooserwidget: Don't chain up in ::event
GtkWidgetClass.event is NULL.
2018-05-27 16:20:55 +02:00
Timm Bäder
251913c80e gl renderer: Use offsets for more node types 2018-05-27 16:20:55 +02:00