Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1af58dc4ee | |||
| cb1cf06744 | |||
| c5d00ae119 | |||
| 15582ef9c1 | |||
| 0e57785af7 | |||
| 52f58f1637 | |||
| cd87252130 | |||
| 85d86d61de | |||
| 0d01ceb415 | |||
| aa005486de | |||
| cdd26d0d01 | |||
| f408c59869 | |||
| 4326e38b90 | |||
| 0f488064a2 | |||
| e6c7e038c8 | |||
| 18bd973014 | |||
| dae2d9ec27 | |||
| c0c79eee03 | |||
| 3f13349f27 | |||
| d6bfc2b9c9 | |||
| fa1bb8972a | |||
| 8e82d0fba2 | |||
| 7b1ff7c215 | |||
| 3211e82b59 | |||
| 6c8c37abbb | |||
| d5160bb950 | |||
| a59fd4a9ad | |||
| 4d0e1e0b88 | |||
| d48ba486ee | |||
| 7dac38f841 | |||
| ec57c6c10b | |||
| d55c261079 | |||
| 8640bc47b1 | |||
| d0d9f5a302 | |||
| 10d39171d9 | |||
| 6988f9b818 | |||
| c7fba52a36 | |||
| 7395dddd47 | |||
| d785820c53 | |||
| 759d8dafd9 | |||
| d9727290cf | |||
| 68b8f792d6 | |||
| 776d99ac51 | |||
| 092ff983f7 | |||
| df51bc836b | |||
| 3d1e2a0558 | |||
| 399df06d19 | |||
| 6dd19306eb | |||
| f43543165b | |||
| 2954417335 | |||
| 172f345d01 | |||
| fbe796f293 | |||
| 2ec26cd9b5 | |||
| 4b2cdb37fb | |||
| dbe5058b86 | |||
| 5833858abf | |||
| ceaa594fa4 | |||
| cadf6a9d3c | |||
| 16b8972bee | |||
| c0f6e746a0 | |||
| 13fd368781 | |||
| 75b633ae08 | |||
| da25771e58 | |||
| e95985da26 | |||
| 6f9969f4fe | |||
| b827725ace | |||
| 6c00eba7fb | |||
| d3471508a0 | |||
| 9b73b39f9a | |||
| 2670ae4436 | |||
| 2694545468 | |||
| ee91fb71ca | |||
| b92fe2fa85 | |||
| 507016cafc | |||
| 310f9f40da | |||
| ee6d081ed9 | |||
| 89115be3cb | |||
| 2a5194b635 | |||
| 2143abe5ee | |||
| 76ca9a9181 | |||
| 2bf7bdd651 | |||
| 630f0f199e | |||
| 5df01f9244 | |||
| 5edc6d94d1 | |||
| ffb410f11e | |||
| 28043f0a92 | |||
| efda30c495 | |||
| 020f3f11c8 | |||
| cdd964a3af | |||
| 5f19f09ac3 | |||
| caf2fc9a10 | |||
| 219e52f7e1 | |||
| 71813671ef | |||
| c550cf122a | |||
| 649edbe2fc | |||
| c4b88e05fd | |||
| 637a4bda5c | |||
| 03ac5f310b | |||
| 6dc6af674c | |||
| 4cc2af2db1 | |||
| 8e1017db35 | |||
| 55e68bc2ea | |||
| a589f98821 | |||
| 721dce73e0 | |||
| 8c73799ca8 | |||
| 7bafb63ec3 | |||
| d79a44c1af | |||
| 6f99a3cdb0 | |||
| 0e3da2f7cf | |||
| b9f1f8aa38 | |||
| 21c3b13596 | |||
| 40d94fcd38 | |||
| e2f6d4db43 | |||
| 726d8abb7d | |||
| cf6d9edc12 | |||
| be596f3967 | |||
| 99c4f2dd39 | |||
| 0529e15d61 | |||
| dcfa55ac7e | |||
| 28063ee2e4 | |||
| 416c370da1 | |||
| d823c39caf |
@@ -1,152 +1,3 @@
|
||||
Overview of changes in GTK+ 3.16.3
|
||||
==================================
|
||||
|
||||
* Bug fixes:
|
||||
737175 most horizontal sliders are inverted when scrolled with mouse...
|
||||
746916 File chooser search does not work over remote network shares
|
||||
746925 [HighContrast] Backdrop active (sensitive) GtkSwitch should l...
|
||||
747634 gdk_set_program_class() breaks --class
|
||||
747805 Split Headerbar unmaximize
|
||||
747808 window: fix initial shadow width for maximized/fullscreen win...
|
||||
748013 Adwaita: keyboard navigation outline on first/last button in ...
|
||||
748014 W32: Tilting mousewheel left/right does not scroll horizontally
|
||||
748061 GtkMessageDialog: Minor documentation update
|
||||
748341 GdkOffscreenWindow should not segfault on gdk_window_beep()
|
||||
748346 build: Avoid xgettext crash on MSYS2
|
||||
748500 GtkSearchEntry docs incorrectly link to themselves
|
||||
748615 GtkWindow: Get the correct shadow width even before window is...
|
||||
748640 Documentation misses out example source files when not buildi...
|
||||
748782 fontchooser should reload list of families/styles on theme ch...
|
||||
748783 Remove PANGO_ENABLE_BACKEND from gtksettings.c
|
||||
748992 GtkFontChooserWidget: Remove unused struct field
|
||||
749009 notify test fails without a session bus
|
||||
749012 GtkStack: Don't emit notify::visible-child during destruction
|
||||
749021 GtkStackSwitcher: Don't emit notify::visible-child when setti...
|
||||
|
||||
|
||||
* Translation updates:
|
||||
Brazilian Portuguese
|
||||
Czech
|
||||
Danish
|
||||
French
|
||||
Icelandic
|
||||
Occitan
|
||||
Russian
|
||||
Slovenian
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of changes in GTK+ 3.16.2
|
||||
==================================
|
||||
|
||||
* Bug fixes:
|
||||
746706 Serious accessible event spewage from Gtk+ table cells
|
||||
747288 [HighContrast] Insensitive backdrop ListBoxRow have an...
|
||||
747471 [wayland] gdk_screen_get_monitor_geometry() returns in...
|
||||
747539 popover: Remove signal handlers in dispose
|
||||
747608 Scrollbar hiding / unhiding does not work with a stylus
|
||||
747689 [HighContrast] Selected ListBoxRow’s Label is white on...
|
||||
Avoid a crash in GtkApplication
|
||||
Avoid a crash with GtkTreeview rubberbanding
|
||||
GtkApplication: Prevent more crashes around shutdown
|
||||
Prevent tab close button size changes
|
||||
|
||||
* Translation updates:
|
||||
Icelandic
|
||||
Swedish
|
||||
|
||||
|
||||
Overview of changes in GTK+ 3.16.1
|
||||
==================================
|
||||
|
||||
* Improve client-side decorations without a compositor
|
||||
|
||||
* Bug fixes:
|
||||
132197 Horizontal Scrolling Using Modifier Key and Scroll Wheel
|
||||
402168 Add underline-color and strikethrough-color to GtkTextTag properties
|
||||
613833 Unnecessary queue_resize() for GtkImage
|
||||
671362 Fixes for GtkRadioMenuItem
|
||||
734741 GtkScale's fill-level starts at the very left if show-fill-level is set
|
||||
737175 most horizontal sliders are inverted when scrolled with mouse wheel
|
||||
746222 Improve CSD windows without a compositor
|
||||
746253 has-tooltip property interferes with event-compression
|
||||
746301 Opening "Sound" panel generates pixman error
|
||||
746391 inspector: Make it easier to cut'n'paste advice message
|
||||
746468 gtkcairoblur is slow
|
||||
746586 critical warnings in a11y if focus widget is destroyed
|
||||
746602 Invalid writes through dangling weak pointers in DND code cause crashes
|
||||
746688 GtkProgressBar doesn't respect its style properties
|
||||
746712 Range ignores the "inverted" property
|
||||
746746 gtk3-demo 'OpenGL Area' crashes on systems with old OpenGL version
|
||||
746784 GtkBooleanCellAccessible emits state-changed:checked signals instead...
|
||||
746817 GtkRadioButton keynav uses wrong succession
|
||||
746821 W32: Maximized window is obscured by the taskbar
|
||||
746862 popover clears shadow of underlying widgets
|
||||
746893 gtk_list_box_bind_model is not introspectable
|
||||
746904 make it possible to disable libcanberra
|
||||
746961 new scroll bar "hides" after click+drag+release while mouse is still...
|
||||
747096 small cleanup in textbuffer clipoard handling
|
||||
747133 overshoot animation is stopped on libinput-managed touchpads
|
||||
747305 x11/gl: Use after free in glx_pixmap_get()
|
||||
747406 Fix indicator proximity checks
|
||||
747407 Make indicators pop out when needed
|
||||
|
||||
* GtkListBox
|
||||
- There has been a minor API break on the return value of the
|
||||
GtkListBoxCreateWidgetFunc callback. Previously, we would leak a
|
||||
full reference returned by this callback and now we free it.
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Catalan
|
||||
Czech
|
||||
Galician
|
||||
Greek
|
||||
Hebrew
|
||||
Hungarian
|
||||
Italian
|
||||
Korean
|
||||
Lithuanian
|
||||
Polish
|
||||
Russian
|
||||
Slovak
|
||||
Slovenian
|
||||
Spanish
|
||||
Tajik
|
||||
Vietnamese
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.16.0
|
||||
==================================
|
||||
|
||||
* Theming: Fixes for the HighContrast theme
|
||||
|
||||
* Wayland: Fix Clipboard handling
|
||||
|
||||
* Bug fixes:
|
||||
746148 Overlay controls unusable in HighContrast
|
||||
746149 “Close tab” buttons change the tab high on hover when using...
|
||||
746188 insensitive ModelButtons are not drawn insensitive
|
||||
746358 insensitive active backdrop GtkSwitches should probably loo...
|
||||
746368 the “selected color” mark is always black, even for black
|
||||
746369 “no date selection” (white on white)
|
||||
746370 GtkExpander doesn't show it is expanded when using HighCont...
|
||||
746386 clipboard crash when other client becomes the selection owner
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Bosnian
|
||||
Bulgarian
|
||||
Chinese (Taiwan)
|
||||
Hungarian
|
||||
Indonesian
|
||||
Japanese
|
||||
Norwegian bokmål
|
||||
Serbian
|
||||
Swedish
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.15.12
|
||||
===================================
|
||||
|
||||
|
||||
@@ -76,8 +76,8 @@ Even better are git-formatted patches. (Use git format-patch)
|
||||
Release notes for 3.16
|
||||
======================
|
||||
|
||||
* GTK+ now includes an OpenGL rendering widget. To support GL on
|
||||
various platforms, GTK+ uses libepoxy.
|
||||
* GTK+ now includes an OpenGL rendering widget. To support GL on various
|
||||
platforms, GTK+ uses libepoxy.
|
||||
|
||||
* GTK+ no longer uses gtk-update-icon-cache during its build. The
|
||||
--enable-gtk2-dependency configure option has been removed.
|
||||
@@ -99,7 +99,7 @@ Release notes for 3.16
|
||||
has non-scrolling parts similar to treeview headers, there is no need
|
||||
to implement this vfunc.
|
||||
|
||||
* The GtkSearchEntry widget has gained a number of new signals that
|
||||
* The GtkSearchEntry widget has gained a number of new signal that
|
||||
are emitted when certain key sequences are seen. In particular, it
|
||||
now handles the Escape key and emits ::stop-search. Applications that
|
||||
expect to handle Escape themselves will need to be updated.
|
||||
|
||||
@@ -292,7 +292,7 @@ copy ..\..\..\gtk\gtkseparatormenuitem.h $(CopyDir)\include\gtk-3.0\gtk\gtksepar
|
||||
copy ..\..\..\gtk\gtkseparatortoolitem.h $(CopyDir)\include\gtk-3.0\gtk\gtkseparatortoolitem.h
|
||||
copy ..\..\..\gtk\gtksettings.h $(CopyDir)\include\gtk-3.0\gtk\gtksettings.h
|
||||
copy ..\..\..\gtk\gtkshow.h $(CopyDir)\include\gtk-3.0\gtk\gtkshow.h
|
||||
copy ..\..\..\gtk\gtkstacksidebar.h $(CopyDir)\include\gtk-3.0\gtk\gtkstacksidebar.h
|
||||
copy ..\..\..\gtk\gtksidebar.h $(CopyDir)\include\gtk-3.0\gtk\gtksidebar.h
|
||||
copy ..\..\..\gtk\gtksizegroup.h $(CopyDir)\include\gtk-3.0\gtk\gtksizegroup.h
|
||||
copy ..\..\..\gtk\gtksizerequest.h $(CopyDir)\include\gtk-3.0\gtk\gtksizerequest.h
|
||||
copy ..\..\..\gtk\gtksocket.h $(CopyDir)\include\gtk-3.0\gtk\gtksocket.h
|
||||
|
||||
@@ -288,7 +288,7 @@ copy ..\..\..\gtk\gtkseparatormenuitem.h $(CopyDir)\include\gtk-3.0\gtk\gtksepar
|
||||
copy ..\..\..\gtk\gtkseparatortoolitem.h $(CopyDir)\include\gtk-3.0\gtk\gtkseparatortoolitem.h

|
||||
copy ..\..\..\gtk\gtksettings.h $(CopyDir)\include\gtk-3.0\gtk\gtksettings.h

|
||||
copy ..\..\..\gtk\gtkshow.h $(CopyDir)\include\gtk-3.0\gtk\gtkshow.h

|
||||
copy ..\..\..\gtk\gtkstacksidebar.h $(CopyDir)\include\gtk-3.0\gtk\gtkstacksidebar.h

|
||||
copy ..\..\..\gtk\gtksidebar.h $(CopyDir)\include\gtk-3.0\gtk\gtksidebar.h

|
||||
copy ..\..\..\gtk\gtksizegroup.h $(CopyDir)\include\gtk-3.0\gtk\gtksizegroup.h

|
||||
copy ..\..\..\gtk\gtksizerequest.h $(CopyDir)\include\gtk-3.0\gtk\gtksizerequest.h

|
||||
copy ..\..\..\gtk\gtksocket.h $(CopyDir)\include\gtk-3.0\gtk\gtksocket.h

|
||||
|
||||
+9
-33
@@ -9,9 +9,9 @@
|
||||
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [16])
|
||||
m4_define([gtk_micro_version], [3])
|
||||
m4_define([gtk_interface_age], [3])
|
||||
m4_define([gtk_minor_version], [15])
|
||||
m4_define([gtk_micro_version], [12])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
m4_define([gtk_version],
|
||||
@@ -348,7 +348,8 @@ backend_immodules=
|
||||
have_gio_unix=no
|
||||
GDK_BACKENDS=
|
||||
GDK_EXTRA_LIBS=
|
||||
GDK_EXTRA_CFLAGS=
|
||||
# expoxy.pc has Cflags: -I${includedir}, but pkg-config swallows that :-(
|
||||
GDK_EXTRA_CFLAGS="-I${prefix}/include"
|
||||
GDK_WINDOWING=
|
||||
PANGO_PACKAGES="pango pangocairo"
|
||||
|
||||
@@ -473,7 +474,6 @@ if test "$enable_mir_backend" = "yes"; then
|
||||
GDK_WINDOWING="$GDK_WINDOWING
|
||||
#define GDK_WINDOWING_MIR"
|
||||
MIR_PACKAGES="$MIR_DEPENDENCIES"
|
||||
have_gio_unix=yes
|
||||
|
||||
AM_CONDITIONAL(USE_MIR, true)
|
||||
else
|
||||
@@ -667,7 +667,7 @@ ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
|
||||
AC_MSG_CHECKING([whether xgettext supports ui files])
|
||||
if $ac_cv_path_XGETTEXT --output=- --color=no --language=Glade $srcdir/gtk/ui/gtkfilechooserwidget.ui > /dev/null 2>&1; then
|
||||
if $ac_cv_path_XGETTEXT --output=- --language=Glade $srcdir/gtk/ui/gtkfilechooserwidget.ui > /dev/null 2>&1; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
@@ -1660,34 +1660,11 @@ AM_CONDITIONAL(HAVE_COLORD, test "x$have_colord" = "xyes")
|
||||
# Check for libcanberra (only used in examples)
|
||||
##################################################
|
||||
|
||||
AC_ARG_ENABLE(libcanberra,
|
||||
[AS_HELP_STRING([--enable-libcanberra],
|
||||
[enable libcanberra support in examples [default=auto]])],
|
||||
[enable_libcanberra="$enableval"],
|
||||
[enable_libcanberra=auto])
|
||||
|
||||
AC_MSG_CHECKING([whether to use libcanberra])
|
||||
if test "$enable_libcanberra" != "no"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
have_libcanberra=no
|
||||
if test "$enable_libcanberra" != "no"; then
|
||||
PKG_CHECK_MODULES(LIBCANBERRA, libcanberra-gtk3,
|
||||
have_libcanberra=yes, have_libcanberra=no)
|
||||
if test "$enable_libcanberra" = "yes"; then
|
||||
if test "$have_libcanberra" = "no"; then
|
||||
AC_MSG_ERROR([--enable-libcanberra specified, but not available])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(LIBCANBERRA, libcanberra-gtk3,
|
||||
have_libcanberra=yes, have_libcanberra=no)
|
||||
if test "$have_libcanberra" = "yes"; then
|
||||
AC_DEFINE(HAVE_LIBCANBERRA, 1, [define if we have libcanberra])
|
||||
AC_DEFINE(HAVE_LIBCANBERRA, 1, [define if we have libcanberra])
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_LIBCANBERRA, test "x$have_libcanberra" = "xyes")
|
||||
|
||||
##################################################
|
||||
# Checks for gtk-doc and docbook-tools
|
||||
@@ -1961,7 +1938,6 @@ echo " Print backends: $PRINT_BACKENDS"
|
||||
echo " Dynamic modules: $build_dynamic_modules"
|
||||
echo " Included immodules: $included_immodules"
|
||||
echo " colord support: $have_colord"
|
||||
echo " libcanberra support: $have_libcanberra"
|
||||
echo " Introspection: $found_introspection"
|
||||
echo " Debugging: $enable_debug"
|
||||
echo " Documentation: $enable_gtk_doc"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Demonstrates migrating a window between different displays.
|
||||
* A display is a mouse and keyboard with some number of
|
||||
* associated monitors. The neat thing about having multiple
|
||||
* associated monitors. The neat thing about having multiple
|
||||
* displays is that they can be on a completely separate
|
||||
* computers, as long as there is a network connection to the
|
||||
* computer where the application is running.
|
||||
@@ -26,6 +26,9 @@
|
||||
* - Using GtkDialog
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
@@ -220,9 +220,6 @@ realize (GtkWidget *widget)
|
||||
{
|
||||
gtk_gl_area_make_current (GTK_GL_AREA (widget));
|
||||
|
||||
if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL)
|
||||
return;
|
||||
|
||||
init_buffers (&position_buffer, NULL);
|
||||
init_shaders (&program, &mvp_location);
|
||||
}
|
||||
@@ -233,9 +230,6 @@ unrealize (GtkWidget *widget)
|
||||
{
|
||||
gtk_gl_area_make_current (GTK_GL_AREA (widget));
|
||||
|
||||
if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL)
|
||||
return;
|
||||
|
||||
glDeleteBuffers (1, &position_buffer);
|
||||
glDeleteProgram (program);
|
||||
}
|
||||
@@ -277,9 +271,6 @@ static gboolean
|
||||
render (GtkGLArea *area,
|
||||
GdkGLContext *context)
|
||||
{
|
||||
if (gtk_gl_area_get_error (area) != NULL)
|
||||
return FALSE;
|
||||
|
||||
/* Clear the viewport */
|
||||
glClearColor (0.5, 0.5, 0.5, 1.0);
|
||||
glClear (GL_COLOR_BUFFER_BIT);
|
||||
|
||||
@@ -261,8 +261,6 @@ GTKDOC_LIBS = \
|
||||
# Extra options to supply to gtkdoc-mkdb
|
||||
MKDB_OPTIONS=--output-format=xml --name-space=gtk
|
||||
|
||||
MKHTML_OPTIONS="--path=\"$(abs_srcdir):$(top_srcdir)/examples\""
|
||||
|
||||
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
|
||||
content_files = \
|
||||
version.xml \
|
||||
|
||||
@@ -61,24 +61,24 @@ struct _GdkColor
|
||||
|
||||
#define GDK_TYPE_COLOR (gdk_color_get_type ())
|
||||
|
||||
GDK_DEPRECATED_IN_3_14_FOR(gdk_rgba_get_type)
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
GType gdk_color_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_DEPRECATED_IN_3_14_FOR(gdk_rgba_copy)
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
GdkColor *gdk_color_copy (const GdkColor *color);
|
||||
GDK_DEPRECATED_IN_3_14_FOR(gdk_rgba_free)
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
void gdk_color_free (GdkColor *color);
|
||||
|
||||
GDK_DEPRECATED_IN_3_14_FOR(gdk_rgba_hash)
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
guint gdk_color_hash (const GdkColor *color);
|
||||
GDK_DEPRECATED_IN_3_14_FOR(gdk_rgba_equal)
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
gboolean gdk_color_equal (const GdkColor *colora,
|
||||
const GdkColor *colorb);
|
||||
|
||||
GDK_DEPRECATED_IN_3_14_FOR(gdk_rgba_parse)
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
gboolean gdk_color_parse (const gchar *spec,
|
||||
GdkColor *color);
|
||||
GDK_DEPRECATED_IN_3_14_FOR(gdk_rgba_to_string)
|
||||
GDK_DEPRECATED_IN_3_14
|
||||
gchar * gdk_color_to_string (const GdkColor *color);
|
||||
|
||||
|
||||
|
||||
@@ -130,7 +130,6 @@ static int gdk_initialized = 0; /* 1 if the library is initi
|
||||
*/
|
||||
|
||||
static gchar *gdk_progclass = NULL;
|
||||
static gboolean gdk_progclass_overridden;
|
||||
|
||||
static GMutex gdk_threads_mutex;
|
||||
|
||||
@@ -209,7 +208,6 @@ static gboolean
|
||||
gdk_arg_class_cb (const char *key, const char *value, gpointer user_data, GError **error)
|
||||
{
|
||||
gdk_set_program_class (value);
|
||||
gdk_progclass_overridden = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1027,16 +1025,10 @@ gdk_get_program_class (void)
|
||||
* Sets the program class. The X11 backend uses the program class to set
|
||||
* the class name part of the `WM_CLASS` property on
|
||||
* toplevel windows; see the ICCCM.
|
||||
*
|
||||
* The program class can still be overridden with the --class command
|
||||
* line option.
|
||||
*/
|
||||
void
|
||||
gdk_set_program_class (const char *program_class)
|
||||
{
|
||||
if (gdk_progclass_overridden)
|
||||
return;
|
||||
|
||||
g_free (gdk_progclass);
|
||||
|
||||
gdk_progclass = g_strdup (program_class);
|
||||
|
||||
+3
-4
@@ -52,8 +52,7 @@ get_vertex_type_name (int type)
|
||||
}
|
||||
|
||||
static guint
|
||||
create_shader (int type,
|
||||
const char *code)
|
||||
create_shader (int type, const char const *code)
|
||||
{
|
||||
guint shader;
|
||||
int status;
|
||||
@@ -86,8 +85,8 @@ create_shader (int type,
|
||||
|
||||
static void
|
||||
make_program (GdkGLContextProgram *program,
|
||||
const char *vertex_shader_code,
|
||||
const char *fragment_shader_code)
|
||||
const char const *vertex_shader_code,
|
||||
const char const *fragment_shader_code)
|
||||
{
|
||||
guint vertex_shader, fragment_shader;
|
||||
int status;
|
||||
|
||||
@@ -669,12 +669,6 @@ gdk_offscreen_window_set_opacity (GdkWindow *window, gdouble opacity)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_offscreen_window_beep (GdkWindow *window)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
||||
{
|
||||
@@ -707,7 +701,7 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
||||
impl_class->destroy_foreign = NULL;
|
||||
impl_class->get_shape = NULL;
|
||||
impl_class->get_input_shape = NULL;
|
||||
impl_class->beep = gdk_offscreen_window_beep;
|
||||
impl_class->beep = NULL;
|
||||
|
||||
impl_class->focus = NULL;
|
||||
impl_class->set_type_hint = NULL;
|
||||
|
||||
@@ -207,10 +207,6 @@ typedef enum
|
||||
* reserved values such as %GDK_MODIFIER_RESERVED_13_MASK. Your code
|
||||
* should preserve and ignore them. You can use %GDK_MODIFIER_MASK to
|
||||
* remove all reserved values.
|
||||
*
|
||||
* Also note that the GDK X backend interprets button press events for button
|
||||
* 4-7 as scroll events, so %GDK_BUTTON4_MASK and %GDK_BUTTON5_MASK will never
|
||||
* be set.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
|
||||
+4
-4
@@ -3111,6 +3111,7 @@ gdk_window_end_paint (GdkWindow *window)
|
||||
{
|
||||
surface = gdk_window_ref_impl_surface (window);
|
||||
cr = cairo_create (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
cairo_set_source_surface (cr, window->current_paint.surface, 0, 0);
|
||||
gdk_cairo_region (cr, window->current_paint.region);
|
||||
@@ -3122,7 +3123,6 @@ gdk_window_end_paint (GdkWindow *window)
|
||||
cairo_destroy (cr);
|
||||
|
||||
cairo_surface_flush (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11100,9 +11100,9 @@ gdk_window_get_unscaled_size (GdkWindow *window,
|
||||
/**
|
||||
* gdk_window_set_opaque_region:
|
||||
* @window: a top-level or non-native #GdkWindow
|
||||
* @region: (allow-none): a region, or %NULL
|
||||
* @region: a region
|
||||
*
|
||||
* For optimisation purposes, compositing window managers may
|
||||
* For optimizization purposes, compositing window managers may
|
||||
* like to not draw obscured regions of windows, or turn off blending
|
||||
* during for these regions. With RGB windows with no transparency,
|
||||
* this is just the shape of the window, but with ARGB32 windows, the
|
||||
@@ -11111,7 +11111,7 @@ gdk_window_get_unscaled_size (GdkWindow *window,
|
||||
*
|
||||
* This function only works for toplevel windows.
|
||||
*
|
||||
* GTK+ will update this property automatically if
|
||||
* GTK+ will automatically update this property automatically if
|
||||
* the @window background is opaque, as we know where the opaque regions
|
||||
* are. If your window background is not opaque, please update this
|
||||
* property in your #GtkWidget::style-updated handler.
|
||||
|
||||
+3
-3
@@ -30,13 +30,13 @@
|
||||
#define GDK_TYPE_MIR_WINDOW (gdk_mir_window_get_type ())
|
||||
#define GDK_IS_MIR_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_WINDOW))
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GType gdk_mir_display_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
MirConnection *gdk_mir_display_get_mir_connection (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GType gdk_mir_window_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
|
||||
@@ -33,8 +33,6 @@ libgdk_quartz_la_SOURCES = \
|
||||
gdkdnd-quartz.h \
|
||||
gdkevents-quartz.c \
|
||||
gdkeventloop-quartz.c \
|
||||
gdkglcontext-quartz.c \
|
||||
gdkglcontext-quartz.h \
|
||||
gdkglobals-quartz.c \
|
||||
gdkkeys-quartz.c \
|
||||
gdkprivate-quartz.h \
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkglcontext-quartz.c: Quartz specific OpenGL wrappers
|
||||
*
|
||||
* Copyright © 2014 Emmanuele Bassi
|
||||
* Copyright © 2014 Alexander Larsson
|
||||
* Copyright © 2014 Brion Vibber
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkglcontext-quartz.h"
|
||||
|
||||
#include "gdkintl.h"
|
||||
|
||||
GdkGLContext *
|
||||
gdk_quartz_window_create_gl_context (GdkWindow *window,
|
||||
gboolean attached,
|
||||
GdkGLContext *share,
|
||||
GError **error)
|
||||
{
|
||||
/* FIXME: implement */
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Not implemented on OS X"));
|
||||
return NULL;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkglcontext-quartz.h: Private Quartz specific OpenGL wrappers
|
||||
*
|
||||
* Copyright © 2014 Emmanuele Bassi
|
||||
* Copyright © 2014 Red Hat, Int
|
||||
* Copyright © 2014 Brion Vibber
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_QUARTZ_GL_CONTEXT__
|
||||
#define __GDK_QUARTZ_GL_CONTEXT__
|
||||
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkvisual.h"
|
||||
#include "gdkwindow.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkmain.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GdkGLContext * gdk_quartz_window_create_gl_context (GdkWindow *window,
|
||||
gboolean attach,
|
||||
GdkGLContext *share,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_QUARTZ_GL_CONTEXT__ */
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "gdkwindowimpl.h"
|
||||
#include "gdkprivate-quartz.h"
|
||||
#include "gdkglcontext-quartz.h"
|
||||
#include "gdkquartzscreen.h"
|
||||
#include "gdkquartzcursor.h"
|
||||
|
||||
@@ -2945,7 +2944,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
||||
impl_class->change_property = _gdk_quartz_window_change_property;
|
||||
impl_class->delete_property = _gdk_quartz_window_delete_property;
|
||||
|
||||
impl_class->create_gl_context = gdk_quartz_window_create_gl_context;
|
||||
|
||||
impl_quartz_class->get_context = gdk_window_impl_quartz_get_context;
|
||||
impl_quartz_class->release_context = gdk_window_impl_quartz_release_context;
|
||||
|
||||
@@ -95,9 +95,6 @@ struct _GdkWaylandDeviceData
|
||||
struct wl_surface *pointer_surface;
|
||||
guint current_output_scale;
|
||||
GSList *pointer_surface_outputs;
|
||||
|
||||
/* Source/dest for non-local dnd */
|
||||
GdkWindow *foreign_dnd_window;
|
||||
};
|
||||
|
||||
struct _GdkWaylandDevice
|
||||
@@ -211,13 +208,10 @@ gdk_wayland_device_update_window_cursor (GdkWaylandDeviceData *wd)
|
||||
wd->enter_serial,
|
||||
wd->pointer_surface,
|
||||
x, y);
|
||||
if (buffer)
|
||||
{
|
||||
wl_surface_attach (wd->pointer_surface, buffer, 0, 0);
|
||||
wl_surface_set_buffer_scale (wd->pointer_surface, scale);
|
||||
wl_surface_damage (wd->pointer_surface, 0, 0, w, h);
|
||||
wl_surface_commit (wd->pointer_surface);
|
||||
}
|
||||
wl_surface_attach (wd->pointer_surface, buffer, 0, 0);
|
||||
wl_surface_set_buffer_scale (wd->pointer_surface, scale);
|
||||
wl_surface_damage (wd->pointer_surface, 0, 0, w, h);
|
||||
wl_surface_commit (wd->pointer_surface);
|
||||
|
||||
if (wd->grab_cursor)
|
||||
{
|
||||
@@ -629,10 +623,8 @@ data_device_enter (void *data,
|
||||
|
||||
dnd_owner = gdk_selection_owner_get_for_display (device->display, gdk_drag_get_selection (device->drop_context));
|
||||
|
||||
if (!dnd_owner)
|
||||
dnd_owner = device->foreign_dnd_window;
|
||||
|
||||
_gdk_wayland_drag_context_set_source_window (device->drop_context, dnd_owner);
|
||||
if (dnd_owner)
|
||||
_gdk_wayland_drag_context_set_source_window (device->drop_context, dnd_owner);
|
||||
|
||||
_gdk_wayland_drag_context_set_dest_window (device->drop_context,
|
||||
dest_window, serial);
|
||||
@@ -1846,26 +1838,6 @@ static const struct wl_surface_listener pointer_surface_listener = {
|
||||
pointer_surface_leave
|
||||
};
|
||||
|
||||
static GdkWindow *
|
||||
create_foreign_dnd_window (GdkDisplay *display)
|
||||
{
|
||||
GdkWindowAttr attrs;
|
||||
GdkScreen *screen;
|
||||
guint mask;
|
||||
|
||||
screen = gdk_display_get_default_screen (display);
|
||||
|
||||
attrs.x = attrs.y = 0;
|
||||
attrs.width = attrs.height = 1;
|
||||
attrs.wclass = GDK_INPUT_OUTPUT;
|
||||
attrs.window_type = GDK_WINDOW_TEMP;
|
||||
attrs.visual = gdk_screen_get_system_visual (screen);
|
||||
|
||||
mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
|
||||
return gdk_window_new (gdk_screen_get_root_window (screen), &attrs, mask);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
|
||||
guint32 id,
|
||||
@@ -1885,7 +1857,6 @@ _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
|
||||
device->device_manager = device_manager;
|
||||
device->touches = g_hash_table_new_full (NULL, NULL, NULL,
|
||||
(GDestroyNotify) g_free);
|
||||
device->foreign_dnd_window = create_foreign_dnd_window (display);
|
||||
device->wl_seat = wl_seat;
|
||||
|
||||
wl_seat_add_listener (device->wl_seat, &seat_listener, device);
|
||||
@@ -1927,7 +1898,6 @@ _gdk_wayland_device_manager_remove_seat (GdkDeviceManager *manager,
|
||||
/* FIXME: destroy data_device */
|
||||
g_clear_object (&device->keyboard_settings);
|
||||
g_hash_table_destroy (device->touches);
|
||||
gdk_window_destroy (device->foreign_dnd_window);
|
||||
g_free (device);
|
||||
|
||||
break;
|
||||
|
||||
@@ -193,13 +193,11 @@ gdk_registry_handle_global (void *data,
|
||||
output =
|
||||
wl_registry_bind (display_wayland->wl_registry, id, &wl_output_interface, MIN (version, 2));
|
||||
_gdk_wayland_screen_add_output (display_wayland->screen, id, output, MIN (version, 2));
|
||||
wl_display_roundtrip (display_wayland->wl_display);
|
||||
}
|
||||
else if (strcmp (interface, "wl_seat") == 0)
|
||||
{
|
||||
seat = wl_registry_bind (display_wayland->wl_registry, id, &wl_seat_interface, MIN (version, 4));
|
||||
_gdk_wayland_device_manager_add_seat (gdk_display->device_manager, id, seat);
|
||||
wl_display_roundtrip (display_wayland->wl_display);
|
||||
}
|
||||
else if (strcmp (interface, "wl_data_device_manager") == 0)
|
||||
{
|
||||
|
||||
@@ -236,8 +236,7 @@ gdk_wayland_drag_context_drop_reply (GdkDragContext *context,
|
||||
gboolean accepted,
|
||||
guint32 time_)
|
||||
{
|
||||
if (!accepted)
|
||||
gdk_wayland_drop_context_set_status (context, accepted);
|
||||
gdk_wayland_drop_context_set_status (context, accepted);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -419,9 +418,6 @@ _gdk_wayland_drag_context_set_dest_window (GdkDragContext *context,
|
||||
GdkWindow *dest_window,
|
||||
uint32_t serial)
|
||||
{
|
||||
if (context->dest_window)
|
||||
g_object_unref (context->dest_window);
|
||||
|
||||
context->dest_window = dest_window ? g_object_ref (dest_window) : NULL;
|
||||
GDK_WAYLAND_DRAG_CONTEXT (context)->serial = serial;
|
||||
gdk_wayland_drop_context_update_targets (context);
|
||||
|
||||
@@ -216,7 +216,6 @@ static struct {
|
||||
#endif
|
||||
{ "help", IDC_HELP },
|
||||
{ "ibeam", IDC_IBEAM },
|
||||
{ "left_ptr_watch", IDC_APPSTARTING },
|
||||
{ "sizeall", IDC_SIZEALL },
|
||||
{ "sizenesw", IDC_SIZENESW },
|
||||
{ "sizens", IDC_SIZENS },
|
||||
|
||||
@@ -1837,7 +1837,6 @@ gdk_event_translate (MSG *msg,
|
||||
RECT rect, *drag, orig_drag;
|
||||
POINT point;
|
||||
MINMAXINFO *mmi;
|
||||
LONG style;
|
||||
HWND hwnd;
|
||||
HCURSOR hcursor;
|
||||
BYTE key_state[256];
|
||||
@@ -2450,7 +2449,6 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
case WM_MOUSEHWHEEL:
|
||||
GDK_NOTE (EVENTS, g_print (" %d", (short) HIWORD (msg->wParam)));
|
||||
|
||||
/* WM_MOUSEWHEEL is delivered to the focus window. Work around
|
||||
@@ -2501,13 +2499,8 @@ gdk_event_translate (MSG *msg,
|
||||
|
||||
event = gdk_event_new (GDK_SCROLL);
|
||||
event->scroll.window = window;
|
||||
|
||||
if (msg->message == WM_MOUSEWHEEL)
|
||||
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
|
||||
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
|
||||
else if (msg->message == WM_MOUSEHWHEEL)
|
||||
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
|
||||
GDK_SCROLL_RIGHT : GDK_SCROLL_LEFT;
|
||||
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
|
||||
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
|
||||
event->scroll.time = _gdk_win32_get_next_tick (msg->time);
|
||||
event->scroll.x = (gint16) point.x;
|
||||
event->scroll.y = (gint16) point.y;
|
||||
@@ -3051,8 +3044,6 @@ gdk_event_translate (MSG *msg,
|
||||
mmi->ptMaxPosition.x, mmi->ptMaxPosition.y,
|
||||
mmi->ptMaxSize.x, mmi->ptMaxSize.y));
|
||||
|
||||
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
||||
|
||||
if (impl->hint_flags & GDK_HINT_MIN_SIZE)
|
||||
{
|
||||
rect.left = rect.top = 0;
|
||||
@@ -3081,10 +3072,7 @@ gdk_event_translate (MSG *msg,
|
||||
mmi->ptMaxTrackSize.x = maxw > 0 && maxw < G_MAXSHORT ? maxw : G_MAXSHORT;
|
||||
mmi->ptMaxTrackSize.y = maxh > 0 && maxh < G_MAXSHORT ? maxh : G_MAXSHORT;
|
||||
}
|
||||
/* Assume that these styles are incompatible with CSD,
|
||||
* so there's no reason for us to override the defaults.
|
||||
*/
|
||||
else if ((style & (WS_BORDER | WS_THICKFRAME)) == 0)
|
||||
else
|
||||
{
|
||||
HMONITOR winmon;
|
||||
MONITORINFO moninfo;
|
||||
@@ -3097,8 +3085,6 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
mmi->ptMaxTrackSize.x = moninfo.rcWork.right - moninfo.rcWork.left;
|
||||
mmi->ptMaxTrackSize.y = moninfo.rcWork.bottom - moninfo.rcWork.top;
|
||||
mmi->ptMaxPosition.x = moninfo.rcWork.left;
|
||||
mmi->ptMaxPosition.y = moninfo.rcWork.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -164,8 +164,6 @@ handle_special (guint vk,
|
||||
*ksymp = GDK_KEY_Meta_R; break;
|
||||
case VK_APPS:
|
||||
*ksymp = GDK_KEY_Menu; break;
|
||||
case VK_DECIMAL:
|
||||
*ksymp = GDK_KEY_KP_Decimal; break;
|
||||
case VK_MULTIPLY:
|
||||
*ksymp = GDK_KEY_KP_Multiply; break;
|
||||
case VK_ADD:
|
||||
|
||||
@@ -758,7 +758,6 @@ _gdk_win32_message_to_string (UINT msg)
|
||||
CASE (WM_MBUTTONUP);
|
||||
CASE (WM_MBUTTONDBLCLK);
|
||||
CASE (WM_MOUSEWHEEL);
|
||||
CASE (WM_MOUSEHWHEEL);
|
||||
CASE (WM_XBUTTONDOWN);
|
||||
CASE (WM_XBUTTONUP);
|
||||
CASE (WM_XBUTTONDBLCLK);
|
||||
|
||||
@@ -90,9 +90,6 @@
|
||||
#ifndef WM_APPCOMMAND
|
||||
#define WM_APPCOMMAND 0x319
|
||||
#endif
|
||||
#ifndef WM_MOUSEHWHEEL
|
||||
#define WM_MOUSEHWHEEL 0x20E
|
||||
#endif
|
||||
|
||||
#ifndef CF_DIBV5
|
||||
#define CF_DIBV5 17
|
||||
|
||||
@@ -762,10 +762,10 @@ _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
|
||||
{
|
||||
gint len, i;
|
||||
|
||||
/* We're only interested in the first 3 buttons */
|
||||
len = MIN (3, buttons_state->mask_len * 8);
|
||||
/* We're only interested in the first 5 buttons */
|
||||
len = MIN (5, buttons_state->mask_len * 8);
|
||||
|
||||
for (i = 1; i <= len; i++)
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (!XIMaskIsSet (buttons_state->mask, i))
|
||||
continue;
|
||||
@@ -781,6 +781,12 @@ _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
|
||||
case 3:
|
||||
state |= GDK_BUTTON3_MASK;
|
||||
break;
|
||||
case 4:
|
||||
state |= GDK_BUTTON4_MASK;
|
||||
break;
|
||||
case 5:
|
||||
state |= GDK_BUTTON5_MASK;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -309,9 +309,9 @@ glx_pixmap_get (cairo_surface_t *surface, guint texture_target)
|
||||
{
|
||||
Display *display = cairo_xlib_surface_get_display (surface);
|
||||
Screen *screen = cairo_xlib_surface_get_screen (surface);
|
||||
Visual *visual = cairo_xlib_surface_get_visual (surface);
|
||||
Visual *visual = cairo_xlib_surface_get_visual (surface);;
|
||||
GdkGLXPixmap *glx_pixmap;
|
||||
GLXFBConfig *fbconfigs, config;
|
||||
GLXFBConfig *fbconfigs;
|
||||
int nfbconfigs;
|
||||
XVisualInfo *visinfo;
|
||||
VisualID visualid;
|
||||
@@ -393,7 +393,6 @@ glx_pixmap_get (cairo_surface_t *surface, guint texture_target)
|
||||
if (value == TRUE)
|
||||
y_inverted = TRUE;
|
||||
|
||||
config = fbconfigs[i];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -408,7 +407,7 @@ glx_pixmap_get (cairo_surface_t *surface, guint texture_target)
|
||||
glx_pixmap = g_slice_new0 (GdkGLXPixmap);
|
||||
glx_pixmap->y_inverted = y_inverted;
|
||||
glx_pixmap->display = display;
|
||||
glx_pixmap->drawable = glXCreatePixmap (display, config,
|
||||
glx_pixmap->drawable = glXCreatePixmap (display, fbconfigs[i],
|
||||
cairo_xlib_surface_get_drawable (surface),
|
||||
pixmap_attributes);
|
||||
|
||||
@@ -433,11 +432,6 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context,
|
||||
double sx, sy;
|
||||
float uscale, vscale;
|
||||
GdkTexturedQuad *quads;
|
||||
GdkX11Display *display_x11;
|
||||
|
||||
display_x11 = GDK_X11_DISPLAY (gdk_gl_context_get_display (paint_context));
|
||||
if (!display_x11->has_glx_texture_from_pixmap)
|
||||
return FALSE;
|
||||
|
||||
if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_XLIB)
|
||||
return FALSE;
|
||||
@@ -564,25 +558,17 @@ create_gl3_context (GdkDisplay *display,
|
||||
GLX_CONTEXT_FLAGS_ARB, flags,
|
||||
None,
|
||||
};
|
||||
GLXContext res;
|
||||
|
||||
GdkX11GLContext *share_x11 = NULL;
|
||||
|
||||
if (share != NULL)
|
||||
share_x11 = GDK_X11_GL_CONTEXT (share);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
res = glXCreateContextAttribsARB (gdk_x11_display_get_xdisplay (display),
|
||||
config,
|
||||
share_x11 != NULL ? share_x11->glx_context : NULL,
|
||||
True,
|
||||
attrib_list);
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return NULL;
|
||||
|
||||
return res;
|
||||
return glXCreateContextAttribsARB (gdk_x11_display_get_xdisplay (display),
|
||||
config,
|
||||
share_x11 != NULL ? share_x11->glx_context : NULL,
|
||||
True,
|
||||
attrib_list);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1220,12 +1206,6 @@ gdk_x11_display_make_gl_context_current (GdkDisplay *display,
|
||||
}
|
||||
|
||||
context_x11 = GDK_X11_GL_CONTEXT (context);
|
||||
if (context_x11->glx_context == NULL)
|
||||
{
|
||||
g_critical ("No GLX context associated to the GdkGLContext; you must "
|
||||
"call gdk_gl_context_realize() first.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GDK_NOTE (OPENGL,
|
||||
g_print ("Making GLX context current to drawable %lu\n",
|
||||
|
||||
@@ -2963,15 +2963,15 @@ gdk_window_x11_set_background (GdkWindow *window,
|
||||
{
|
||||
GdkWindow *parent;
|
||||
|
||||
/* X throws BadMatch if the parent has a different depth when
|
||||
/* X throws BadMatch if the parent has a different visual when
|
||||
* using ParentRelative */
|
||||
parent = gdk_window_get_parent (window);
|
||||
if (parent && window->depth != parent->depth)
|
||||
XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XID (window), None);
|
||||
else
|
||||
if (parent && gdk_window_get_visual (parent) == gdk_window_get_visual (window))
|
||||
XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XID (window), ParentRelative);
|
||||
else
|
||||
XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XID (window), None);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+12
-2
@@ -397,9 +397,12 @@ gtk_private_h_sources = \
|
||||
gtkcsskeyframesprivate.h \
|
||||
gtkcsslookupprivate.h \
|
||||
gtkcssmatcherprivate.h \
|
||||
gtkcssnodeprivate.h \
|
||||
gtkcssnodedeclarationprivate.h \
|
||||
gtkcssnodeutilsprivate.h \
|
||||
gtkcssnumbervalueprivate.h \
|
||||
gtkcssparserprivate.h \
|
||||
gtkcsspathnodeprivate.h \
|
||||
gtkcsspositionvalueprivate.h \
|
||||
gtkcssproviderprivate.h \
|
||||
gtkcssrepeatvalueprivate.h \
|
||||
@@ -415,10 +418,12 @@ gtk_private_h_sources = \
|
||||
gtkcssstyleprivate.h \
|
||||
gtkcssstylepropertyprivate.h \
|
||||
gtkcsstransformvalueprivate.h \
|
||||
gtkcsstransientnodeprivate.h \
|
||||
gtkcsstransitionprivate.h \
|
||||
gtkcsstypedvalueprivate.h \
|
||||
gtkcssunsetvalueprivate.h \
|
||||
gtkcssvalueprivate.h \
|
||||
gtkcsswidgetnodeprivate.h \
|
||||
gtkcustompaperunixdialog.h \
|
||||
gtkdialogprivate.h \
|
||||
gtkentryprivate.h \
|
||||
@@ -627,9 +632,12 @@ gtk_base_c_sources = \
|
||||
gtkcsskeyframes.c \
|
||||
gtkcsslookup.c \
|
||||
gtkcssmatcher.c \
|
||||
gtkcssnode.c \
|
||||
gtkcssnodedeclaration.c \
|
||||
gtkcssnodeutils.c \
|
||||
gtkcssnumbervalue.c \
|
||||
gtkcssparser.c \
|
||||
gtkcsspathnode.c \
|
||||
gtkcsspositionvalue.c \
|
||||
gtkcssprovider.c \
|
||||
gtkcssrepeatvalue.c \
|
||||
@@ -647,11 +655,13 @@ gtk_base_c_sources = \
|
||||
gtkcssstyleproperty.c \
|
||||
gtkcssstylepropertyimpl.c \
|
||||
gtkcsstransformvalue.c \
|
||||
gtkcsstransientnode.c \
|
||||
gtkcsstransition.c \
|
||||
gtkcsstypedvalue.c \
|
||||
gtkcssunsetvalue.c \
|
||||
gtkcssvalue.c \
|
||||
gtkcsstypes.c \
|
||||
gtkcssvalue.c \
|
||||
gtkcsswidgetnode.c \
|
||||
gtkdialog.c \
|
||||
gtkdrawingarea.c \
|
||||
gtkeditable.c \
|
||||
@@ -1122,7 +1132,7 @@ gtktypebuiltins.c: $(gtk_public_h_sources) $(a11y_h_sources) $(deprecated_h_sour
|
||||
&& cp xgen-gtbc gtktypebuiltins.c \
|
||||
&& rm -f xgen-gtbc
|
||||
|
||||
gtk.gresource.xml: Makefile.am
|
||||
gtk.gresource.xml: Makefile.am inspector/Makefile.inc
|
||||
$(AM_V_GEN) echo "<?xml version='1.0' encoding='UTF-8'?>" > $@; \
|
||||
echo "<gresources>" >> $@; \
|
||||
echo " <gresource prefix='/org/gtk/libgtk'>" >> $@; \
|
||||
|
||||
@@ -113,8 +113,7 @@ gtk_boolean_cell_accessible_ref_state_set (AtkObject *accessible)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal)
|
||||
gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell)
|
||||
{
|
||||
GtkBooleanCellAccessible *boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (cell);
|
||||
gboolean active;
|
||||
@@ -132,16 +131,14 @@ gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
{
|
||||
boolean_cell->priv->cell_value = !boolean_cell->priv->cell_value;
|
||||
|
||||
if (emit_signal)
|
||||
atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_CHECKED, active);
|
||||
atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_CHECKED, active);
|
||||
}
|
||||
|
||||
if (boolean_cell->priv->cell_sensitive != sensitive)
|
||||
{
|
||||
boolean_cell->priv->cell_sensitive = !boolean_cell->priv->cell_sensitive;
|
||||
|
||||
if (emit_signal)
|
||||
atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_SENSITIVE, sensitive);
|
||||
atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_CHECKED, sensitive);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -419,23 +419,19 @@ _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
|
||||
/*
|
||||
* gtk_cell_accessible_update_cache:
|
||||
* @cell: the cell that is changed
|
||||
* @emit_signal: whether or not to notify the ATK bridge
|
||||
*
|
||||
* Notifies the cell that the values in the data in the row that
|
||||
* is used to feed the cell renderer with has changed. The
|
||||
* cell_changed function of @cell is called to send update
|
||||
* notifications for the properties it takes from its cell
|
||||
* renderer. If @emit_signal is TRUE, also notify the ATK bridge
|
||||
* of the change. The bridge should be notified when an existing
|
||||
* cell changes; not when a newly-created cell is being set up.
|
||||
* renderer.
|
||||
*
|
||||
* Note that there is no higher granularity available about which
|
||||
* properties changed, so you will need to make do with this
|
||||
* function.
|
||||
**/
|
||||
void
|
||||
_gtk_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal)
|
||||
_gtk_cell_accessible_update_cache (GtkCellAccessible *cell)
|
||||
{
|
||||
GtkCellAccessibleClass *klass;
|
||||
|
||||
@@ -444,5 +440,5 @@ _gtk_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
klass = GTK_CELL_ACCESSIBLE_GET_CLASS (cell);
|
||||
|
||||
if (klass->update_cache)
|
||||
klass->update_cache (cell, emit_signal);
|
||||
klass->update_cache (cell);
|
||||
}
|
||||
|
||||
@@ -48,8 +48,7 @@ struct _GtkCellAccessible
|
||||
struct _GtkCellAccessibleClass
|
||||
{
|
||||
GtkAccessibleClass parent_class;
|
||||
void (*update_cache) (GtkCellAccessible *cell,
|
||||
gboolean emit_signal);
|
||||
void (*update_cache) (GtkCellAccessible *cell);
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -25,8 +25,7 @@ G_BEGIN_DECLS
|
||||
void _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
|
||||
GtkCellRendererState added,
|
||||
GtkCellRendererState removed);
|
||||
void _gtk_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal);
|
||||
void _gtk_cell_accessible_update_cache (GtkCellAccessible *cell);
|
||||
void _gtk_cell_accessible_initialize (GtkCellAccessible *cell,
|
||||
GtkWidget *widget,
|
||||
AtkObject *parent);
|
||||
|
||||
@@ -64,14 +64,13 @@ gtk_container_cell_accessible_ref_child (AtkObject *obj,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal)
|
||||
gtk_container_cell_accessible_update_cache (GtkCellAccessible *cell)
|
||||
{
|
||||
GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (cell);
|
||||
GList *l;
|
||||
|
||||
for (l = container->priv->children; l; l = l->next)
|
||||
_gtk_cell_accessible_update_cache (l->data, emit_signal);
|
||||
_gtk_cell_accessible_update_cache (l->data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -87,8 +87,7 @@ static void add_attr (PangoAttrList *attr_li
|
||||
|
||||
/* Misc */
|
||||
|
||||
static void gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal);
|
||||
static void gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell);
|
||||
|
||||
static void atk_text_interface_init (AtkTextIface *iface);
|
||||
|
||||
@@ -133,12 +132,12 @@ gtk_text_cell_accessible_get_name (AtkObject *atk_obj)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal)
|
||||
gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell)
|
||||
{
|
||||
GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (cell);
|
||||
AtkObject *obj = ATK_OBJECT (cell);
|
||||
gint text_length;
|
||||
gboolean rv = FALSE;
|
||||
gint temp_length;
|
||||
gchar *text;
|
||||
GtkCellRenderer *renderer;
|
||||
|
||||
@@ -150,33 +149,48 @@ gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
g_object_get (renderer, "text", &text, NULL);
|
||||
g_object_unref (renderer);
|
||||
|
||||
if (text == NULL)
|
||||
text = g_strdup ("");
|
||||
text_length = g_utf8_strlen (text, -1);
|
||||
|
||||
if (g_strcmp0 (text_cell->priv->cell_text, text) != 0)
|
||||
if (text_cell->priv->cell_text)
|
||||
{
|
||||
if (text_cell->priv->cell_length && emit_signal)
|
||||
if (text == NULL || g_strcmp0 (text_cell->priv->cell_text, text) != 0)
|
||||
{
|
||||
g_signal_emit_by_name (cell, "text-changed::delete",
|
||||
0, text_cell->priv->cell_length);
|
||||
g_free (text_cell->priv->cell_text);
|
||||
temp_length = text_cell->priv->cell_length;
|
||||
text_cell->priv->cell_text = NULL;
|
||||
text_cell->priv->cell_length = 0;
|
||||
g_signal_emit_by_name (cell, "text-changed::delete", 0, temp_length);
|
||||
if (obj->name == NULL)
|
||||
g_object_notify (G_OBJECT (obj), "accessible-name");
|
||||
if (text)
|
||||
rv = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
rv = TRUE;
|
||||
|
||||
g_free (text_cell->priv->cell_text);
|
||||
text_cell->priv->cell_text = g_strdup (text);
|
||||
text_cell->priv->cell_length = text_length;
|
||||
|
||||
if (text_length && emit_signal)
|
||||
if (rv)
|
||||
{
|
||||
if (text == NULL)
|
||||
{
|
||||
g_signal_emit_by_name (cell, "text-changed::insert",
|
||||
0, text_cell->priv->cell_length);
|
||||
text_cell->priv->cell_text = g_strdup ("");
|
||||
text_cell->priv->cell_length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
text_cell->priv->cell_text = g_strdup (text);
|
||||
text_cell->priv->cell_length = g_utf8_strlen (text, -1);
|
||||
}
|
||||
|
||||
if (obj->name == NULL && emit_signal)
|
||||
g_object_notify (G_OBJECT (obj), "accessible-name");
|
||||
}
|
||||
|
||||
g_free (text);
|
||||
|
||||
if (rv)
|
||||
{
|
||||
g_signal_emit_by_name (cell, "text-changed::insert",
|
||||
0, text_cell->priv->cell_length);
|
||||
|
||||
if (obj->name == NULL)
|
||||
g_object_notify (G_OBJECT (obj), "accessible-name");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -509,11 +509,6 @@ gtk_text_view_accessible_get_character_extents (AtkText *text,
|
||||
GdkWindow *window;
|
||||
gint x_widget, y_widget, x_window, y_window;
|
||||
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
@@ -524,9 +519,6 @@ gtk_text_view_accessible_get_character_extents (AtkText *text,
|
||||
gtk_text_view_get_iter_location (view, &iter, &rectangle);
|
||||
|
||||
window = gtk_text_view_get_window (view, GTK_TEXT_WINDOW_WIDGET);
|
||||
if (window == NULL)
|
||||
return;
|
||||
|
||||
gdk_window_get_origin (window, &x_widget, &y_widget);
|
||||
|
||||
*height = rectangle.height;
|
||||
|
||||
@@ -425,7 +425,7 @@ create_cell (GtkTreeView *treeview,
|
||||
cell_info_new (accessible, tree, node, column, cell);
|
||||
|
||||
set_cell_data (treeview, accessible, cell);
|
||||
_gtk_cell_accessible_update_cache (cell, FALSE);
|
||||
_gtk_cell_accessible_update_cache (cell);
|
||||
|
||||
return cell;
|
||||
}
|
||||
@@ -1705,7 +1705,7 @@ _gtk_tree_view_accessible_changed (GtkTreeView *treeview,
|
||||
continue;
|
||||
|
||||
set_cell_data (treeview, accessible, cell);
|
||||
_gtk_cell_accessible_update_cache (cell, TRUE);
|
||||
_gtk_cell_accessible_update_cache (cell);
|
||||
}
|
||||
|
||||
g_signal_emit_by_name (accessible, "visible-data-changed");
|
||||
|
||||
@@ -1111,7 +1111,7 @@ gtk_font_selection_size_activate (GtkWidget *w,
|
||||
const gchar *text;
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
|
||||
new_size = (int) MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
|
||||
new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
|
||||
|
||||
if (priv->size != new_size)
|
||||
gtk_font_selection_set_size (fontsel, new_size);
|
||||
@@ -1130,7 +1130,7 @@ gtk_font_selection_size_focus_out (GtkWidget *w,
|
||||
const gchar *text;
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
|
||||
new_size = (int) MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
|
||||
new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
|
||||
|
||||
gtk_font_selection_set_size (fontsel, new_size);
|
||||
|
||||
|
||||
@@ -305,18 +305,16 @@ gtk_gradient_resolve (GtkGradient *gradient,
|
||||
cairo_pattern_t *
|
||||
_gtk_gradient_resolve_full (GtkGradient *gradient,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (gradient != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
|
||||
g_return_val_if_fail (GTK_IS_CSS_STYLE (values), NULL);
|
||||
g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values), NULL);
|
||||
g_return_val_if_fail (*dependencies == 0, NULL);
|
||||
g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
|
||||
g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
|
||||
|
||||
if (gradient->radius0 == 0 && gradient->radius1 == 0)
|
||||
pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0,
|
||||
@@ -332,21 +330,17 @@ _gtk_gradient_resolve_full (GtkGradient *gradient,
|
||||
ColorStop *stop;
|
||||
GtkCssValue *val;
|
||||
GdkRGBA rgba;
|
||||
GtkCssDependencies stop_deps;
|
||||
|
||||
stop = &g_array_index (gradient->stops, ColorStop, i);
|
||||
|
||||
/* if color resolving fails, assume transparency */
|
||||
val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (stop->color),
|
||||
provider,
|
||||
gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
&stop_deps,
|
||||
gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR),
|
||||
NULL);
|
||||
if (val)
|
||||
{
|
||||
rgba = *_gtk_css_rgba_value_get_rgba (val);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, stop_deps);
|
||||
_gtk_css_value_unref (val);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -25,9 +25,8 @@ G_BEGIN_DECLS
|
||||
|
||||
cairo_pattern_t * _gtk_gradient_resolve_full (GtkGradient *gradient,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *values,
|
||||
GtkCssStyle *parent_values,
|
||||
GtkCssDependencies *dependencies);
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style);
|
||||
|
||||
GtkGradient * _gtk_gradient_transition (GtkGradient *start,
|
||||
GtkGradient *end,
|
||||
|
||||
@@ -77,7 +77,7 @@ struct _GtkHandleBoxPrivate
|
||||
{
|
||||
/* Properties */
|
||||
GtkPositionType handle_position;
|
||||
gint snap_edge;
|
||||
GtkPositionType snap_edge;
|
||||
GtkShadowType shadow_type;
|
||||
gboolean child_detached;
|
||||
/* Properties */
|
||||
@@ -1051,7 +1051,7 @@ gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), (GtkPositionType)-1);
|
||||
|
||||
return (GtkPositionType)handle_box->priv->snap_edge;
|
||||
return handle_box->priv->snap_edge;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2945,17 +2945,17 @@ gtk_icon_factory_buildable_custom_tag_end (GtkBuildable *buildable,
|
||||
}
|
||||
if (source_data->icon_name)
|
||||
gtk_icon_source_set_icon_name (icon_source, source_data->icon_name);
|
||||
if ((gint)source_data->size != -1)
|
||||
if (source_data->size != -1)
|
||||
{
|
||||
gtk_icon_source_set_size (icon_source, source_data->size);
|
||||
gtk_icon_source_set_size_wildcarded (icon_source, FALSE);
|
||||
}
|
||||
if ((gint)source_data->direction != -1)
|
||||
if (source_data->direction != -1)
|
||||
{
|
||||
gtk_icon_source_set_direction (icon_source, source_data->direction);
|
||||
gtk_icon_source_set_direction_wildcarded (icon_source, FALSE);
|
||||
}
|
||||
if ((gint)source_data->state != -1)
|
||||
if (source_data->state != -1)
|
||||
{
|
||||
gtk_icon_source_set_state (icon_source, source_data->state);
|
||||
gtk_icon_source_set_state_wildcarded (icon_source, FALSE);
|
||||
|
||||
@@ -95,7 +95,7 @@ real_add (const GtkStockItem *items,
|
||||
gpointer old_key, old_value;
|
||||
const GtkStockItem *item = &items[i];
|
||||
|
||||
if (replace_primary && (guint)item->modifier == PRIMARY_MODIFIER)
|
||||
if (replace_primary && item->modifier == PRIMARY_MODIFIER)
|
||||
{
|
||||
item = gtk_stock_item_copy (item);
|
||||
((GtkStockItem *)item)->modifier = (NON_STATIC_MASK |
|
||||
|
||||
@@ -306,8 +306,6 @@ gtk_symbolic_color_resolve (GtkSymbolicColor *color,
|
||||
v = _gtk_css_color_value_resolve (color->value,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (props),
|
||||
current,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
_gtk_css_value_unref (current);
|
||||
if (v == NULL)
|
||||
|
||||
@@ -2288,7 +2288,6 @@ add_credits_section (GtkAboutDialog *about,
|
||||
|
||||
label = gtk_label_new (str->str);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
||||
g_signal_connect_swapped (label, "activate-link",
|
||||
G_CALLBACK (emit_activate_link), about);
|
||||
g_string_free (str, TRUE);
|
||||
|
||||
+6
-6
@@ -39,7 +39,7 @@
|
||||
*
|
||||
* The action will be looked up in action groups that are found among
|
||||
* the widgets ancestors. Most commonly, these will be the actions with
|
||||
* the “win.” or “app.” prefix that are associated with the #GtkApplicationWindow
|
||||
* the "win" or "app" prefix that are associated with the #GtkApplicationWindow
|
||||
* or "GtkApplication, but other action groups that are added with
|
||||
* gtk_widget_insert_action_group() will be consulted as well.
|
||||
*
|
||||
@@ -54,10 +54,10 @@
|
||||
|
||||
/**
|
||||
* GtkActionableInterface:
|
||||
* @get_action_name: virtual function for gtk_actionable_get_action_name()
|
||||
* @set_action_name: virtual function for gtk_actionable_set_action_name()
|
||||
* @get_action_target_value: virtual function for gtk_actionable_get_action_target_value()
|
||||
* @set_action_target_value: virtual function for gtk_actionable_set_action_target_value()
|
||||
* @get_action_name: virtual pointer for gtk_actionable_get_action_name()
|
||||
* @set_action_name: virtual pointer for gtk_actionable_set_action_name()
|
||||
* @get_action_target_value: virtual pointer for gtk_actionable_get_action_target_value()
|
||||
* @set_action_target_value: virtual pointer for gtk_actionable_set_action_target_value()
|
||||
*
|
||||
* The interface vtable for #GtkActionable.
|
||||
**/
|
||||
@@ -161,7 +161,7 @@ gtk_actionable_get_action_target_value (GtkActionable *actionable)
|
||||
* The target value has two purposes. First, it is used as the
|
||||
* parameter to activation of the action associated with the
|
||||
* #GtkActionable widget. Second, it is used to determine if the widget
|
||||
* should be rendered as “active” — the widget is active if the state
|
||||
* should be rendered as “active” - the widget is active if the state
|
||||
* is equal to the given target.
|
||||
*
|
||||
* Consider the example of associating a set of buttons with a #GAction
|
||||
|
||||
+15
-19
@@ -69,7 +69,7 @@
|
||||
* that the GDK lock be held while invoking actions locally with
|
||||
* g_action_group_activate_action(). The same applies to actions
|
||||
* associated with #GtkApplicationWindow and to the “activate” and
|
||||
* “open” #GApplication methods.
|
||||
* 'open' #GApplication methods.
|
||||
*
|
||||
* ## Automatic resources ## {#automatic-resources}
|
||||
*
|
||||
@@ -113,8 +113,8 @@
|
||||
* session while inhibitors are present.
|
||||
*
|
||||
* ## See Also ## {#seealso}
|
||||
* [HowDoI: Using GtkApplication](https://wiki.gnome.org/HowDoI/GtkApplication),
|
||||
* [Getting Started with GTK+: Basics](https://developer.gnome.org/gtk3/stable/gtk-getting-started.html#id-1.2.3.3)
|
||||
* HowDoI: [Using GtkApplication] (https://wiki.gnome.org/HowDoI/GtkApplication)
|
||||
* [Getting Started with GTK+: Basics] (https://developer.gnome.org/gtk3/stable/gtk-getting-started.html#id-1.2.3.3)
|
||||
*/
|
||||
|
||||
enum {
|
||||
@@ -506,9 +506,7 @@ gtk_application_focus_in_event_cb (GtkWindow *window,
|
||||
priv->windows = g_list_concat (link, priv->windows);
|
||||
}
|
||||
|
||||
if (application->priv->impl)
|
||||
gtk_application_impl_active_window_changed (application->priv->impl, window);
|
||||
|
||||
gtk_application_impl_active_window_changed (application->priv->impl, window);
|
||||
g_object_notify (G_OBJECT (application), "active-window");
|
||||
|
||||
return FALSE;
|
||||
@@ -1128,7 +1126,7 @@ gtk_application_get_window_by_id (GtkApplication *application,
|
||||
*
|
||||
* The active window is the one that was most recently focused (within
|
||||
* the application). This window may not have the focus at the moment
|
||||
* if another application has it — this is just the most
|
||||
* if another application has it -- this is just the most
|
||||
* recently-focused window within this application.
|
||||
*
|
||||
* Returns: (transfer none): the active window
|
||||
@@ -1371,12 +1369,12 @@ gtk_application_get_app_menu (GtkApplication *application)
|
||||
* each window, or at the top of the screen. In some environments, if
|
||||
* both the application menu and the menubar are set, the application
|
||||
* menu will be presented as if it were the first item of the menubar.
|
||||
* Other environments treat the two as completely separate — for example,
|
||||
* the application menu may be rendered by the desktop shell while the
|
||||
* menubar (if set) remains in each individual window.
|
||||
* Other environments treat the two as completely separate -- for
|
||||
* example, the application menu may be rendered by the desktop shell
|
||||
* while the menubar (if set) remains in each individual window.
|
||||
*
|
||||
* Use the base #GActionMap interface to add actions, to respond to the
|
||||
* user selecting these menu items.
|
||||
* Use the base #GActionMap interface to add actions, to respond to the user
|
||||
* selecting these menu items.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
@@ -1632,11 +1630,11 @@ normalise_detailed_name (const gchar *detailed_action_name)
|
||||
* @application: a #GtkApplication
|
||||
* @detailed_action_name: a detailed action name, specifying an action
|
||||
* and target to associate accelerators with
|
||||
* @accels: (array zero-terminated=1): a list of accelerators in the format
|
||||
* understood by gtk_accelerator_parse()
|
||||
* @accels: (array zero-terminated=1): a list of accelerators in the format understood by
|
||||
* gtk_accelerator_parse()
|
||||
*
|
||||
* Sets zero or more keyboard accelerators that will trigger the
|
||||
* given action. The first item in @accels will be the primary
|
||||
* given action. The first item in @accels will be the primary
|
||||
* accelerator, which may be displayed in the UI.
|
||||
*
|
||||
* To remove all accelerators for an action, use an empty, zero-terminated
|
||||
@@ -1780,16 +1778,14 @@ void
|
||||
gtk_application_handle_window_realize (GtkApplication *application,
|
||||
GtkWindow *window)
|
||||
{
|
||||
if (application->priv->impl)
|
||||
gtk_application_impl_handle_window_realize (application->priv->impl, window);
|
||||
gtk_application_impl_handle_window_realize (application->priv->impl, window);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_application_handle_window_map (GtkApplication *application,
|
||||
GtkWindow *window)
|
||||
{
|
||||
if (application->priv->impl)
|
||||
gtk_application_impl_handle_window_map (application->priv->impl, window);
|
||||
gtk_application_impl_handle_window_map (application->priv->impl, window);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,7 +96,8 @@
|
||||
*
|
||||
* menubar = G_MENU_MODEL (gtk_builder_get_object (builder,
|
||||
* "menubar"));
|
||||
* gtk_application_set_menubar (G_APPLICATION (app), menubar);
|
||||
* gtk_application_set_menubar (G_APPLICATION (app),
|
||||
* menubar);
|
||||
* g_object_unref (builder);
|
||||
*
|
||||
* ...
|
||||
@@ -117,7 +118,7 @@
|
||||
* Attribute values can be translated using gettext, like other #GtkBuilder
|
||||
* content. `<attribute>` elements can be marked for translation with a
|
||||
* `translatable="yes"` attribute. It is also possible to specify message
|
||||
* context and translator comments, using the context and comments attributes.
|
||||
* context and translator comments,using the context and comments attributes.
|
||||
* To make use of this, the #GtkBuilder must have been given the gettext
|
||||
* domain to use.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -1132,7 +1132,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
|
||||
/**
|
||||
* gtk_button_box_new:
|
||||
* @orientation: the box's orientation.
|
||||
* @orientation: the box' orientation.
|
||||
*
|
||||
* Creates a new #GtkButtonBox.
|
||||
*
|
||||
|
||||
+127
-77
@@ -77,6 +77,8 @@
|
||||
|
||||
#include "gtkbox.h"
|
||||
#include "gtkboxprivate.h"
|
||||
#include "gtkcssnodeprivate.h"
|
||||
#include "gtkcssnodeutilsprivate.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkorientableprivate.h"
|
||||
@@ -435,14 +437,12 @@ static gboolean
|
||||
gtk_box_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkAllocation alloc;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_widget_get_allocation (widget, &alloc);
|
||||
|
||||
gtk_render_background (context, cr, 0, 0, alloc.width, alloc.height);
|
||||
gtk_render_frame (context, cr, 0, 0, alloc.width, alloc.height);
|
||||
gtk_css_node_draw (gtk_widget_get_css_node (widget),
|
||||
cr,
|
||||
gtk_widget_get_allocated_width (widget),
|
||||
gtk_widget_get_allocated_height (widget),
|
||||
NULL,
|
||||
widget);
|
||||
|
||||
return GTK_WIDGET_CLASS (gtk_box_parent_class)->draw (widget, cr);
|
||||
}
|
||||
@@ -472,9 +472,13 @@ count_expand_children (GtkBox *box,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_size_allocate_no_center (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
gtk_box_size_allocate_no_center (GtkCssNode *cssnode,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline,
|
||||
GtkAllocation *out_clip,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (data);
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *private = box->priv;
|
||||
GtkBoxChild *child;
|
||||
@@ -484,12 +488,12 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
|
||||
|
||||
GtkTextDirection direction;
|
||||
GtkAllocation child_allocation;
|
||||
GtkAllocation child_clip;
|
||||
GtkRequestedSize *sizes;
|
||||
gint child_minimum_baseline, child_natural_baseline;
|
||||
gint minimum_above, natural_above;
|
||||
gint minimum_below, natural_below;
|
||||
gboolean have_baseline;
|
||||
gint baseline;
|
||||
|
||||
GtkPackType packing;
|
||||
|
||||
@@ -499,8 +503,7 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
|
||||
gint x = 0, y = 0, i;
|
||||
gint child_size;
|
||||
|
||||
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
*out_clip = *allocation;
|
||||
|
||||
count_expand_children (box, &nvis_children, &nexpand_children);
|
||||
|
||||
@@ -679,7 +682,6 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||
if (baseline == -1 && have_baseline)
|
||||
{
|
||||
gint height = MAX (1, allocation->height);
|
||||
@@ -798,18 +800,21 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
|
||||
|
||||
gtk_widget_get_clip (child->widget, &child_clip);
|
||||
gdk_rectangle_union (out_clip, out_clip, &child_clip);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
_gtk_widget_set_simple_clip (widget, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_size_allocate_with_center (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
gtk_box_size_allocate_with_center (GtkCssNode *cssnode,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline,
|
||||
GtkAllocation *out_clip,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (data);
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *priv = box->priv;
|
||||
GtkBoxChild *child;
|
||||
@@ -817,14 +822,13 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
|
||||
gint nvis[2];
|
||||
gint nexp[2];
|
||||
GtkTextDirection direction;
|
||||
GtkAllocation child_allocation;
|
||||
GtkAllocation child_allocation, child_clip;
|
||||
GtkRequestedSize *sizes[2];
|
||||
GtkRequestedSize center_req;
|
||||
gint child_minimum_baseline, child_natural_baseline;
|
||||
gint minimum_above, natural_above;
|
||||
gint minimum_below, natural_below;
|
||||
gboolean have_baseline;
|
||||
gint baseline;
|
||||
gint idx[2];
|
||||
gint center_pos;
|
||||
gint center_size;
|
||||
@@ -838,8 +842,6 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
|
||||
gint x = 0, y = 0, i;
|
||||
gint child_size;
|
||||
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
|
||||
nvis[0] = nvis[1] = 0;
|
||||
nexp[0] = nexp[1] = 0;
|
||||
for (children = priv->children; children; children = children->next)
|
||||
@@ -871,6 +873,8 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
|
||||
min_size[0] = nat_size[0] = nvis[0] * priv->spacing;
|
||||
min_size[1] = nat_size[1] = nvis[1] * priv->spacing;
|
||||
|
||||
*out_clip = *allocation;
|
||||
|
||||
/* Retrieve desired size for visible children. */
|
||||
idx[0] = idx[1] = 0;
|
||||
for (children = priv->children; children; children = children->next)
|
||||
@@ -1025,7 +1029,6 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||
if (baseline == -1 && have_baseline)
|
||||
{
|
||||
gint height = MAX (1, allocation->height);
|
||||
@@ -1139,6 +1142,8 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
|
||||
gtk_widget_get_clip (child->widget, &child_clip);
|
||||
gdk_rectangle_union (out_clip, out_clip, &child_clip);
|
||||
|
||||
i++;
|
||||
}
|
||||
@@ -1170,9 +1175,10 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
|
||||
child_allocation.y = center_pos;
|
||||
child_allocation.height = center_size;
|
||||
}
|
||||
gtk_widget_size_allocate_with_baseline (priv->center->widget, &child_allocation, baseline);
|
||||
|
||||
_gtk_widget_set_simple_clip (widget, NULL);
|
||||
gtk_widget_size_allocate_with_baseline (priv->center->widget, &child_allocation, baseline);
|
||||
gtk_widget_get_clip (priv->center->widget, &child_clip);
|
||||
gdk_rectangle_union (out_clip, out_clip, &child_clip);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1180,12 +1186,20 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkAllocation clip;
|
||||
|
||||
if (box->priv->center &&
|
||||
gtk_widget_get_visible (box->priv->center->widget))
|
||||
gtk_box_size_allocate_with_center (widget, allocation);
|
||||
else
|
||||
gtk_box_size_allocate_no_center (widget, allocation);
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
|
||||
gtk_css_node_allocate (gtk_widget_get_css_node (widget),
|
||||
allocation,
|
||||
gtk_widget_get_allocated_baseline (widget),
|
||||
&clip,
|
||||
box->priv->center && gtk_widget_get_visible (box->priv->center->widget)
|
||||
? gtk_box_size_allocate_with_center
|
||||
: gtk_box_size_allocate_no_center,
|
||||
box);
|
||||
|
||||
gtk_widget_set_clip (widget, &clip);
|
||||
}
|
||||
|
||||
static GType
|
||||
@@ -1434,17 +1448,25 @@ gtk_box_buildable_init (GtkBuildableIface *iface)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_invalidate_order_foreach (GtkWidget *widget)
|
||||
gtk_box_invalidate_order_foreach (GtkWidget *widget,
|
||||
gpointer prev)
|
||||
{
|
||||
_gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
|
||||
GtkCssNode **previous = prev;
|
||||
GtkCssNode *cur = gtk_widget_get_css_node (widget);
|
||||
|
||||
if (*previous)
|
||||
gtk_css_node_set_after (cur, *previous);
|
||||
|
||||
*previous = cur;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_invalidate_order (GtkBox *box)
|
||||
{
|
||||
GtkCssNode *previous = NULL;
|
||||
gtk_container_foreach (GTK_CONTAINER (box),
|
||||
(GtkCallback) gtk_box_invalidate_order_foreach,
|
||||
NULL);
|
||||
gtk_box_invalidate_order_foreach,
|
||||
&previous);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1490,8 +1512,8 @@ gtk_box_pack (GtkBox *box,
|
||||
|
||||
gtk_widget_freeze_child_notify (child);
|
||||
|
||||
gtk_box_invalidate_order (box);
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (box));
|
||||
gtk_box_invalidate_order (box);
|
||||
|
||||
g_signal_connect (child, "notify::visible",
|
||||
G_CALLBACK (box_child_visibility_notify_cb), box);
|
||||
@@ -1657,22 +1679,6 @@ gtk_box_get_size (GtkWidget *widget,
|
||||
*natural_baseline = nat_baseline;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_get_preferred_width (GtkWidget *widget,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
gtk_box_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_get_preferred_height (GtkWidget *widget,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
||||
gint avail_size,
|
||||
@@ -1956,19 +1962,74 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
|
||||
*natural_size = required_natural;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_get_preferred_size (GtkCssNode *cssnode,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum,
|
||||
gint *natural,
|
||||
gint *minimum_baseline,
|
||||
gint *natural_baseline,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *widget = data;
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *priv = box->priv;
|
||||
|
||||
if (for_size < 0)
|
||||
{
|
||||
gtk_box_get_size (widget, orientation, minimum, natural, minimum_baseline, natural_baseline);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->orientation == orientation)
|
||||
gtk_box_compute_size_for_orientation (box, for_size, minimum, natural);
|
||||
else
|
||||
gtk_box_compute_size_for_opposing_orientation (box, for_size, minimum, natural, minimum_baseline, natural_baseline);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_get_preferred_width (GtkWidget *widget,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
-1,
|
||||
minimum_size, natural_size,
|
||||
NULL, NULL,
|
||||
gtk_box_get_preferred_size,
|
||||
widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_get_preferred_height (GtkWidget *widget,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
-1,
|
||||
minimum_size, natural_size,
|
||||
NULL, NULL,
|
||||
gtk_box_get_preferred_size,
|
||||
widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_get_preferred_width_for_height (GtkWidget *widget,
|
||||
gint height,
|
||||
gint *minimum_width,
|
||||
gint *natural_width)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *private = box->priv;
|
||||
|
||||
if (private->orientation == GTK_ORIENTATION_VERTICAL)
|
||||
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width, NULL, NULL);
|
||||
else
|
||||
gtk_box_compute_size_for_orientation (box, height, minimum_width, natural_width);
|
||||
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
height,
|
||||
minimum_width, natural_width,
|
||||
NULL, NULL,
|
||||
gtk_box_get_preferred_size,
|
||||
widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1979,24 +2040,13 @@ gtk_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||
gint *minimum_baseline,
|
||||
gint *natural_baseline)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *private = box->priv;
|
||||
|
||||
if (width < 0)
|
||||
gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_height, natural_height, minimum_baseline, natural_baseline);
|
||||
else
|
||||
{
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
gtk_box_compute_size_for_opposing_orientation (box, width, minimum_height, natural_height, minimum_baseline, natural_baseline);
|
||||
else
|
||||
{
|
||||
if (minimum_baseline)
|
||||
*minimum_baseline = -1;
|
||||
if (natural_baseline)
|
||||
*natural_baseline = -1;
|
||||
gtk_box_compute_size_for_orientation (box, width, minimum_height, natural_height);
|
||||
}
|
||||
}
|
||||
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
width,
|
||||
minimum_height, natural_height,
|
||||
minimum_baseline, natural_baseline,
|
||||
gtk_box_get_preferred_size,
|
||||
widget);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -203,7 +203,6 @@
|
||||
*
|
||||
* Additionally, since 3.10 a special <template> tag has been added
|
||||
* to the format allowing one to define a widget class’s components.
|
||||
* See the [GtkWidget documentation][composite-templates] for details.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+43
-84
@@ -25,32 +25,6 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Gets the size for a single box blur.
|
||||
*
|
||||
* Much of this, the 3 * sqrt(2 * pi) / 4, is the known value for
|
||||
* approximating a Gaussian using box blurs. This yields quite a good
|
||||
* approximation for a Gaussian. For more details, see:
|
||||
* http://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=590039#c19
|
||||
*/
|
||||
#define GAUSSIAN_SCALE_FACTOR ((3.0 * sqrt(2 * G_PI) / 4))
|
||||
|
||||
#define get_box_filter_size(radius) ((int)(GAUSSIAN_SCALE_FACTOR * (radius)))
|
||||
|
||||
/* Sadly, clang is picky about get_box_filter_size(2) not being a
|
||||
* constant expression, thus we have to use precomputed values.
|
||||
*/
|
||||
#define BOX_FILTER_SIZE_2 3
|
||||
#define BOX_FILTER_SIZE_3 5
|
||||
#define BOX_FILTER_SIZE_4 7
|
||||
#define BOX_FILTER_SIZE_5 9
|
||||
#define BOX_FILTER_SIZE_6 11
|
||||
#define BOX_FILTER_SIZE_7 13
|
||||
#define BOX_FILTER_SIZE_8 15
|
||||
#define BOX_FILTER_SIZE_9 16
|
||||
#define BOX_FILTER_SIZE_10 18
|
||||
|
||||
/* This applies a single box blur pass to a horizontal range of pixels;
|
||||
* since the box blur has the same weight for all pixels, we can
|
||||
* implement an efficient sliding window algorithm where we add
|
||||
@@ -86,37 +60,18 @@ blur_xspan (guchar *row,
|
||||
* only divide down after all three passes. (SSE parallel implementation
|
||||
* of the divide step is possible.)
|
||||
*/
|
||||
|
||||
#define BLUR_ROW_KERNEL(D) \
|
||||
for (i = -(D) + offset; i < row_width + offset; i++) \
|
||||
{ \
|
||||
if (i >= 0 && i < row_width) \
|
||||
sum += row[i]; \
|
||||
\
|
||||
if (i >= offset) \
|
||||
{ \
|
||||
if (i >= (D)) \
|
||||
sum -= row[i - (D)]; \
|
||||
\
|
||||
tmp_buffer[i - offset] = (sum + (D) / 2) / (D); \
|
||||
} \
|
||||
} \
|
||||
break;
|
||||
|
||||
/* We unroll the values for d for radius 2-10 to avoid a generic
|
||||
* divide operation (not radius 1, because its a no-op) */
|
||||
switch (d)
|
||||
for (i = -d + offset; i < row_width + offset; i++)
|
||||
{
|
||||
case BOX_FILTER_SIZE_2: BLUR_ROW_KERNEL (BOX_FILTER_SIZE_2);
|
||||
case BOX_FILTER_SIZE_3: BLUR_ROW_KERNEL (BOX_FILTER_SIZE_3);
|
||||
case BOX_FILTER_SIZE_4: BLUR_ROW_KERNEL (BOX_FILTER_SIZE_4);
|
||||
case BOX_FILTER_SIZE_5: BLUR_ROW_KERNEL (BOX_FILTER_SIZE_5);
|
||||
case BOX_FILTER_SIZE_6: BLUR_ROW_KERNEL (BOX_FILTER_SIZE_6);
|
||||
case BOX_FILTER_SIZE_7: BLUR_ROW_KERNEL (BOX_FILTER_SIZE_7);
|
||||
case BOX_FILTER_SIZE_8: BLUR_ROW_KERNEL (BOX_FILTER_SIZE_8);
|
||||
case BOX_FILTER_SIZE_9: BLUR_ROW_KERNEL (BOX_FILTER_SIZE_9);
|
||||
case BOX_FILTER_SIZE_10: BLUR_ROW_KERNEL (BOX_FILTER_SIZE_10);
|
||||
default: BLUR_ROW_KERNEL (d);
|
||||
if (i >= 0 && i < row_width)
|
||||
sum += row[i];
|
||||
|
||||
if (i >= offset)
|
||||
{
|
||||
if (i >= d)
|
||||
sum -= row[i - d];
|
||||
|
||||
tmp_buffer[i - offset] = (sum + d / 2) / d;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy (row, tmp_buffer, row_width);
|
||||
@@ -185,35 +140,45 @@ flip_buffer (guchar *dst_buffer,
|
||||
#undef BLOCK_SIZE
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the size for a single box blur.
|
||||
*
|
||||
* Much of this, the 3 * sqrt(2 * pi) / 4, is the known value for
|
||||
* approximating a Gaussian using box blurs. This yields quite a good
|
||||
* approximation for a Gaussian. For more details, see:
|
||||
* http://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=590039#c19
|
||||
*/
|
||||
#define GAUSSIAN_SCALE_FACTOR ((3.0 * sqrt(2 * G_PI) / 4))
|
||||
|
||||
static int
|
||||
get_box_filter_size (double radius)
|
||||
{
|
||||
return GAUSSIAN_SCALE_FACTOR * radius;
|
||||
}
|
||||
|
||||
static void
|
||||
_boxblur (guchar *buffer,
|
||||
int width,
|
||||
int height,
|
||||
int radius,
|
||||
GtkBlurFlags flags)
|
||||
_boxblur (guchar *buffer,
|
||||
int width,
|
||||
int height,
|
||||
int radius)
|
||||
{
|
||||
guchar *flipped_buffer;
|
||||
int d = get_box_filter_size (radius);
|
||||
|
||||
flipped_buffer = g_malloc (width * height);
|
||||
|
||||
if (flags & GTK_BLUR_Y)
|
||||
{
|
||||
/* Step 1: swap rows and columns */
|
||||
flip_buffer (flipped_buffer, buffer, width, height);
|
||||
/* Step 1: swap rows and columns */
|
||||
flip_buffer (flipped_buffer, buffer, width, height);
|
||||
|
||||
/* Step 2: blur rows (really columns) */
|
||||
blur_rows (flipped_buffer, buffer, height, width, d);
|
||||
/* Step 2: blur rows (really columns) */
|
||||
blur_rows (flipped_buffer, buffer, height, width, d);
|
||||
|
||||
/* Step 3: swap rows and columns */
|
||||
flip_buffer (buffer, flipped_buffer, height, width);
|
||||
}
|
||||
/* Step 3: swap rows and columns */
|
||||
flip_buffer (buffer, flipped_buffer, height, width);
|
||||
|
||||
if (flags & GTK_BLUR_X)
|
||||
{
|
||||
/* Step 4: blur rows */
|
||||
blur_rows (buffer, flipped_buffer, width, height, d);
|
||||
}
|
||||
/* Step 4: blur rows */
|
||||
blur_rows (buffer, flipped_buffer, width, height, d);
|
||||
|
||||
g_free (flipped_buffer);
|
||||
}
|
||||
@@ -227,8 +192,7 @@ _boxblur (guchar *buffer,
|
||||
*/
|
||||
void
|
||||
_gtk_cairo_blur_surface (cairo_surface_t* surface,
|
||||
double radius_d,
|
||||
GtkBlurFlags flags)
|
||||
double radius_d)
|
||||
{
|
||||
int radius = radius_d;
|
||||
|
||||
@@ -236,12 +200,7 @@ _gtk_cairo_blur_surface (cairo_surface_t* surface,
|
||||
g_return_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE);
|
||||
g_return_if_fail (cairo_image_surface_get_format (surface) == CAIRO_FORMAT_A8);
|
||||
|
||||
/* The code doesn't actually do any blurring for radius 1, as it
|
||||
* ends up with box filter size 1 */
|
||||
if (radius <= 1)
|
||||
return;
|
||||
|
||||
if ((flags & (GTK_BLUR_X|GTK_BLUR_Y)) == 0)
|
||||
if (radius == 0)
|
||||
return;
|
||||
|
||||
/* Before we mess with the surface, execute any pending drawing. */
|
||||
@@ -250,7 +209,7 @@ _gtk_cairo_blur_surface (cairo_surface_t* surface,
|
||||
_boxblur (cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface),
|
||||
cairo_image_surface_get_height (surface),
|
||||
radius, flags);
|
||||
radius);
|
||||
|
||||
/* Inform cairo we altered the surface contents. */
|
||||
cairo_surface_mark_dirty (surface);
|
||||
|
||||
@@ -29,16 +29,8 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
GTK_BLUR_NONE = 0,
|
||||
GTK_BLUR_X = 1<<0,
|
||||
GTK_BLUR_Y = 1<<1,
|
||||
GTK_BLUR_REPEAT = 1<<2
|
||||
} GtkBlurFlags;
|
||||
|
||||
void _gtk_cairo_blur_surface (cairo_surface_t *surface,
|
||||
double radius,
|
||||
GtkBlurFlags flags);;
|
||||
double radius);
|
||||
int _gtk_cairo_blur_compute_pixels (double radius);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+1
-12
@@ -1846,19 +1846,8 @@ gtk_container_idle_sizer (GdkFrameClock *clock,
|
||||
*/
|
||||
if (container->priv->restyle_pending)
|
||||
{
|
||||
GtkBitmask *empty;
|
||||
gint64 current_time;
|
||||
|
||||
empty = _gtk_bitmask_new ();
|
||||
current_time = g_get_monotonic_time ();
|
||||
|
||||
container->priv->restyle_pending = FALSE;
|
||||
_gtk_style_context_validate (gtk_widget_get_style_context (GTK_WIDGET (container)),
|
||||
current_time,
|
||||
0,
|
||||
empty);
|
||||
|
||||
_gtk_bitmask_free (empty);
|
||||
gtk_css_node_validate (gtk_widget_get_css_node (GTK_WIDGET (container)));
|
||||
}
|
||||
|
||||
/* we may be invoked with a container_resize_queue of NULL, because
|
||||
|
||||
+22
-16
@@ -63,6 +63,21 @@ gtk_css_animated_style_get_section (GtkCssStyle *style,
|
||||
return gtk_css_style_get_section (animated->style, id);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_animated_style_is_static (GtkCssStyle *style)
|
||||
{
|
||||
GtkCssAnimatedStyle *animated = GTK_CSS_ANIMATED_STYLE (style);
|
||||
GSList *list;
|
||||
|
||||
for (list = animated->animations; list; list = list->next)
|
||||
{
|
||||
if (!_gtk_style_animation_is_static (list->data, animated->current_time))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_animated_style_dispose (GObject *object)
|
||||
{
|
||||
@@ -101,6 +116,7 @@ gtk_css_animated_style_class_init (GtkCssAnimatedStyleClass *klass)
|
||||
|
||||
style_class->get_value = gtk_css_animated_style_get_value;
|
||||
style_class->get_section = gtk_css_animated_style_get_section;
|
||||
style_class->is_static = gtk_css_animated_style_is_static;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -410,6 +426,9 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
|
||||
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
|
||||
gtk_internal_return_val_if_fail (previous_style == NULL || GTK_IS_CSS_STYLE (previous_style), NULL);
|
||||
|
||||
if (timestamp == 0)
|
||||
return g_object_ref (base_style);
|
||||
|
||||
animations = NULL;
|
||||
|
||||
if (previous_style != NULL)
|
||||
@@ -441,6 +460,9 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (source), NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base), NULL);
|
||||
|
||||
if (timestamp == 0)
|
||||
return g_object_ref (source->style);
|
||||
|
||||
animations = NULL;
|
||||
for (l = source->animations; l; l = l->next)
|
||||
{
|
||||
@@ -466,19 +488,3 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
|
||||
|
||||
return GTK_CSS_STYLE (result);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_animated_style_is_static (GtkCssAnimatedStyle *style)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style), TRUE);
|
||||
|
||||
for (list = style->animations; list; list = list->next)
|
||||
{
|
||||
if (!_gtk_style_animation_is_static (list->data, style->current_time))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -68,8 +68,6 @@ void gtk_css_animated_style_set_animated_value(GtkCssAnimated
|
||||
GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
|
||||
guint id);
|
||||
|
||||
gboolean gtk_css_animated_style_is_static (GtkCssAnimatedStyle *style);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CSS_ANIMATED_STYLE_PRIVATE_H__ */
|
||||
|
||||
@@ -47,20 +47,16 @@ gtk_css_value_array_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
GtkCssValue *i_value;
|
||||
guint i, j;
|
||||
GtkCssDependencies child_deps;
|
||||
|
||||
result = NULL;
|
||||
for (i = 0; i < value->n_values; i++)
|
||||
{
|
||||
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, &child_deps);
|
||||
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
|
||||
|
||||
if (result == NULL &&
|
||||
i_value != value->values[i])
|
||||
|
||||
@@ -45,25 +45,20 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
GtkCssDependencies x_deps, y_deps;
|
||||
|
||||
if (value->x == NULL && value->y == NULL)
|
||||
return _gtk_css_value_ref (value);
|
||||
|
||||
x_deps = y_deps = 0;
|
||||
x = y = NULL;
|
||||
|
||||
if (value->x)
|
||||
x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style, &x_deps);
|
||||
x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style);
|
||||
|
||||
if (value->y)
|
||||
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style, &y_deps);
|
||||
|
||||
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
|
||||
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style);
|
||||
|
||||
return _gtk_css_bg_size_value_new (value->x ? x : NULL,
|
||||
value->y ? y : NULL);
|
||||
|
||||
@@ -46,11 +46,9 @@ gtk_css_value_border_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssValue *computed;
|
||||
GtkCssDependencies child_deps;
|
||||
gboolean changed = FALSE;
|
||||
guint i;
|
||||
|
||||
@@ -61,8 +59,7 @@ gtk_css_value_border_compute (GtkCssValue *value,
|
||||
{
|
||||
if (value->values[i])
|
||||
{
|
||||
computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, &child_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
|
||||
changed |= (computed->values[i] != value->values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-36
@@ -124,8 +124,7 @@ gtk_css_value_color_get_fallback (guint property_id,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
NULL);
|
||||
parent_style);
|
||||
default:
|
||||
if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
|
||||
g_warning ("No fallback color defined for property '%s'",
|
||||
@@ -138,20 +137,13 @@ GtkCssValue *
|
||||
_gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssValue *current,
|
||||
GtkCssDependencies current_deps,
|
||||
GtkCssDependencies *dependencies,
|
||||
GSList *cycle_list)
|
||||
{
|
||||
GtkCssDependencies unused;
|
||||
GtkCssValue *value;
|
||||
|
||||
g_return_val_if_fail (color != NULL, NULL);
|
||||
g_return_val_if_fail (provider == NULL || GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
||||
|
||||
if (dependencies == NULL)
|
||||
dependencies = &unused;
|
||||
*dependencies = 0;
|
||||
|
||||
switch (color->type)
|
||||
{
|
||||
case COLOR_TYPE_LITERAL:
|
||||
@@ -170,7 +162,7 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
if (named == NULL)
|
||||
return NULL;
|
||||
|
||||
value = _gtk_css_color_value_resolve (named, provider, current, current_deps, dependencies, &cycle);
|
||||
value = _gtk_css_color_value_resolve (named, provider, current, &cycle);
|
||||
if (value == NULL)
|
||||
return NULL;
|
||||
}
|
||||
@@ -182,12 +174,10 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkHSLA hsla;
|
||||
GdkRGBA shade;
|
||||
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.shade.color, provider, current, current_deps, dependencies, cycle_list);
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.shade.color, provider, current, cycle_list);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, 0);
|
||||
|
||||
_gtk_hsla_init_from_rgba (&hsla, _gtk_css_rgba_value_get_rgba (val));
|
||||
_gtk_hsla_shade (&hsla, &hsla, color->sym_col.shade.factor);
|
||||
|
||||
@@ -204,11 +194,10 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkCssValue *val;
|
||||
GdkRGBA alpha;
|
||||
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.alpha.color, provider, current, current_deps, dependencies, cycle_list);
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.alpha.color, provider, current, cycle_list);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, 0);
|
||||
alpha = *_gtk_css_rgba_value_get_rgba (val);
|
||||
alpha.alpha = CLAMP (alpha.alpha * color->sym_col.alpha.factor, 0, 1);
|
||||
|
||||
@@ -222,21 +211,19 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
{
|
||||
GtkCssValue *val;
|
||||
GdkRGBA color1, color2, res;
|
||||
GtkCssDependencies dep1, dep2;
|
||||
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, current, current_deps, &dep1, cycle_list);
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, current, cycle_list);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
color1 = *_gtk_css_rgba_value_get_rgba (val);
|
||||
_gtk_css_value_unref (val);
|
||||
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, current, current_deps, &dep2, cycle_list);
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, current, cycle_list);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
color2 = *_gtk_css_rgba_value_get_rgba (val);
|
||||
_gtk_css_value_unref (val);
|
||||
|
||||
*dependencies = _gtk_css_dependencies_union (dep1, dep2);
|
||||
res.red = CLAMP (color1.red + ((color2.red - color1.red) * color->sym_col.mix.factor), 0, 1);
|
||||
res.green = CLAMP (color1.green + ((color2.green - color1.green) * color->sym_col.mix.factor), 0, 1);
|
||||
res.blue = CLAMP (color1.blue + ((color2.blue - color1.blue) * color->sym_col.mix.factor), 0, 1);
|
||||
@@ -262,7 +249,6 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
case COLOR_TYPE_CURRENT_COLOR:
|
||||
if (current)
|
||||
{
|
||||
*dependencies = current_deps;
|
||||
return _gtk_css_value_ref (current);
|
||||
}
|
||||
else
|
||||
@@ -270,8 +256,6 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
return _gtk_css_color_value_resolve (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (GTK_CSS_PROPERTY_COLOR)),
|
||||
provider,
|
||||
NULL,
|
||||
0,
|
||||
dependencies,
|
||||
cycle_list);
|
||||
}
|
||||
break;
|
||||
@@ -301,11 +285,9 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssValue *resolved, *current;
|
||||
GtkCssDependencies current_deps;
|
||||
|
||||
/* The computed value of the ‘currentColor’ keyword is the computed
|
||||
* value of the ‘color’ property. If the ‘currentColor’ keyword is
|
||||
@@ -314,27 +296,18 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
||||
if (property_id == GTK_CSS_PROPERTY_COLOR)
|
||||
{
|
||||
if (parent_style)
|
||||
{
|
||||
current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR);
|
||||
current_deps = GTK_CSS_EQUALS_PARENT;
|
||||
}
|
||||
current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR);
|
||||
else
|
||||
{
|
||||
current = NULL;
|
||||
current_deps = 0;
|
||||
}
|
||||
current = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
|
||||
current_deps = GTK_CSS_DEPENDS_ON_COLOR;
|
||||
}
|
||||
|
||||
resolved = _gtk_css_color_value_resolve (value,
|
||||
provider,
|
||||
current,
|
||||
current_deps,
|
||||
dependencies,
|
||||
NULL);
|
||||
|
||||
if (resolved == NULL)
|
||||
|
||||
@@ -46,8 +46,6 @@ GtkCssValue * _gtk_css_color_value_parse (GtkCssParser *parser)
|
||||
GtkCssValue * _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssValue *current,
|
||||
GtkCssDependencies current_deps,
|
||||
GtkCssDependencies *dependencies,
|
||||
GSList *cycle_list);
|
||||
|
||||
|
||||
|
||||
@@ -41,15 +41,12 @@ gtk_css_value_corner_compute (GtkCssValue *corner,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
GtkCssDependencies x_deps, y_deps;
|
||||
|
||||
x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style, &x_deps);
|
||||
y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style, &y_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
|
||||
x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style);
|
||||
y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style);
|
||||
if (x == corner->x && y == corner->y)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
|
||||
@@ -54,8 +54,7 @@ gtk_css_value_ease_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
@@ -40,8 +40,7 @@ gtk_css_value_engine_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
+4
-11
@@ -42,8 +42,7 @@ gtk_css_value_enum_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
@@ -165,8 +164,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
double font_size;
|
||||
|
||||
@@ -197,7 +195,6 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
font_size = _gtk_css_font_size_get_default (provider) * 2;
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_SMALLER:
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
|
||||
if (parent_style)
|
||||
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
|
||||
else
|
||||
@@ -206,7 +203,6 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
font_size /= 1.2;
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_LARGER:
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
|
||||
if (parent_style)
|
||||
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
|
||||
else
|
||||
@@ -337,7 +333,7 @@ static GtkCssValue font_variant_values[] = {
|
||||
GtkCssValue *
|
||||
_gtk_css_font_variant_value_new (PangoVariant font_variant)
|
||||
{
|
||||
g_return_val_if_fail ((gint)font_variant < G_N_ELEMENTS (font_variant_values), NULL);
|
||||
g_return_val_if_fail (font_variant < G_N_ELEMENTS (font_variant_values), NULL);
|
||||
|
||||
return _gtk_css_value_ref (&font_variant_values[font_variant]);
|
||||
}
|
||||
@@ -376,8 +372,7 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
PangoWeight new_weight;
|
||||
int parent_value;
|
||||
@@ -385,8 +380,6 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
|
||||
if (value->value >= 0)
|
||||
return _gtk_css_value_ref (value);
|
||||
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
|
||||
|
||||
if (parent_style)
|
||||
parent_value = gtk_css_style_get_value (parent_style, property_id)->value;
|
||||
else
|
||||
|
||||
@@ -74,8 +74,7 @@ gtk_css_value_icon_theme_compute (GtkCssValue *icon_theme,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
GtkIconTheme *icontheme;
|
||||
|
||||
+3
-10
@@ -65,8 +65,7 @@ gtk_css_image_real_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
return g_object_ref (image);
|
||||
}
|
||||
@@ -149,23 +148,17 @@ _gtk_css_image_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssDependencies unused;
|
||||
GtkCssImageClass *klass;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
|
||||
g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
|
||||
|
||||
if (dependencies == NULL)
|
||||
dependencies = &unused;
|
||||
*dependencies = 0;
|
||||
|
||||
klass = GTK_CSS_IMAGE_GET_CLASS (image);
|
||||
|
||||
return klass->compute (image, property_id, provider, style, parent_style, dependencies);
|
||||
return klass->compute (image, property_id, provider, style, parent_style);
|
||||
}
|
||||
|
||||
GtkCssImage *
|
||||
|
||||
@@ -806,8 +806,7 @@ gtk_css_image_builtin_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssImageBuiltin *result;
|
||||
GtkBorderStyle border_style;
|
||||
@@ -832,9 +831,6 @@ gtk_css_image_builtin_compute (GtkCssImage *image,
|
||||
result->bg_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
|
||||
result->border_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
|
||||
|
||||
/* XXX: We also depend on other values, but I guess we cannot express that */
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_COLOR;
|
||||
|
||||
return GTK_CSS_IMAGE (result);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,7 @@ gtk_css_image_gradient_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssImageGradient *gradient = GTK_CSS_IMAGE_GRADIENT (image);
|
||||
GtkCssImageGradient *copy;
|
||||
@@ -46,7 +45,7 @@ gtk_css_image_gradient_compute (GtkCssImage *image,
|
||||
|
||||
copy = g_object_new (GTK_TYPE_CSS_IMAGE_GRADIENT, NULL);
|
||||
copy->gradient = gtk_gradient_ref (gradient->gradient);
|
||||
copy->pattern = _gtk_gradient_resolve_full (copy->gradient, provider, style, parent_style, dependencies);
|
||||
copy->pattern = _gtk_gradient_resolve_full (copy->gradient, provider, style, parent_style);
|
||||
|
||||
return GTK_CSS_IMAGE (copy);
|
||||
}
|
||||
|
||||
@@ -129,8 +129,7 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
|
||||
GtkCssImageIconTheme *copy;
|
||||
@@ -149,8 +148,6 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
||||
copy->scale = _gtk_style_provider_private_get_scale (provider);
|
||||
copy->color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
|
||||
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_COLOR;
|
||||
|
||||
return GTK_CSS_IMAGE (copy);
|
||||
}
|
||||
|
||||
|
||||
@@ -432,8 +432,7 @@ gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
|
||||
GtkCssImageLinear *copy;
|
||||
@@ -442,24 +441,21 @@ gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
copy = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
|
||||
copy->repeating = linear->repeating;
|
||||
|
||||
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style, dependencies);
|
||||
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style);
|
||||
|
||||
g_array_set_size (copy->stops, linear->stops->len);
|
||||
for (i = 0; i < linear->stops->len; i++)
|
||||
{
|
||||
GtkCssImageLinearColorStop *stop, *scopy;
|
||||
GtkCssDependencies child_deps;
|
||||
|
||||
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
|
||||
scopy = &g_array_index (copy->stops, GtkCssImageLinearColorStop, i);
|
||||
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, &child_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, &child_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -59,8 +59,7 @@ struct _GtkCssImageClass
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies);
|
||||
GtkCssStyle *parent_style);
|
||||
/* compare two images for equality */
|
||||
gboolean (* equal) (GtkCssImage *image1,
|
||||
GtkCssImage *image2);
|
||||
@@ -96,8 +95,7 @@ GtkCssImage * _gtk_css_image_compute (GtkCssImage *
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies);
|
||||
GtkCssStyle *parent_style);
|
||||
gboolean _gtk_css_image_equal (GtkCssImage *image1,
|
||||
GtkCssImage *image2);
|
||||
GtkCssImage * _gtk_css_image_transition (GtkCssImage *start,
|
||||
|
||||
@@ -97,8 +97,7 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image);
|
||||
GtkCssImageScaled *copy;
|
||||
@@ -122,8 +121,7 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
dependencies);
|
||||
parent_style);
|
||||
else
|
||||
copy->images[i] = g_object_ref (scaled->images[i]);
|
||||
}
|
||||
|
||||
@@ -124,8 +124,7 @@ gtk_css_image_url_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
|
||||
|
||||
|
||||
@@ -38,8 +38,7 @@ gtk_css_value_image_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssImage *image, *computed;
|
||||
|
||||
@@ -48,7 +47,7 @@ gtk_css_value_image_compute (GtkCssValue *value,
|
||||
if (image == NULL)
|
||||
return _gtk_css_value_ref (value);
|
||||
|
||||
computed = _gtk_css_image_compute (image, property_id, provider, style, parent_style, dependencies);
|
||||
computed = _gtk_css_image_compute (image, property_id, provider, style, parent_style);
|
||||
|
||||
if (computed == image)
|
||||
{
|
||||
|
||||
@@ -38,12 +38,10 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
if (parent_style)
|
||||
{
|
||||
*dependencies = GTK_CSS_EQUALS_PARENT;
|
||||
return _gtk_css_value_ref (gtk_css_style_get_value (parent_style, property_id));
|
||||
}
|
||||
else
|
||||
@@ -52,8 +50,7 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
dependencies);
|
||||
parent_style);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
@@ -94,8 +93,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
dependencies);
|
||||
parent_style);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -466,8 +466,7 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
|
||||
resolved->property_ids[p],
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
NULL);
|
||||
parent_style);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+233
-3
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "gtkcssmatcherprivate.h"
|
||||
|
||||
#include "gtkcssnodedeclarationprivate.h"
|
||||
#include "gtkcssnodeprivate.h"
|
||||
#include "gtkwidgetpath.h"
|
||||
|
||||
/* GTK_CSS_MATCHER_WIDGET_PATH */
|
||||
@@ -31,6 +33,7 @@ gtk_css_matcher_widget_path_get_parent (GtkCssMatcher *matcher,
|
||||
return FALSE;
|
||||
|
||||
matcher->path.klass = child->path.klass;
|
||||
matcher->path.decl = NULL;
|
||||
matcher->path.path = child->path.path;
|
||||
matcher->path.index = child->path.index - 1;
|
||||
matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index);
|
||||
@@ -46,6 +49,7 @@ gtk_css_matcher_widget_path_get_previous (GtkCssMatcher *matcher,
|
||||
return FALSE;
|
||||
|
||||
matcher->path.klass = next->path.klass;
|
||||
matcher->path.decl = NULL;
|
||||
matcher->path.path = next->path.path;
|
||||
matcher->path.index = next->path.index;
|
||||
matcher->path.sibling_index = next->path.sibling_index - 1;
|
||||
@@ -58,6 +62,9 @@ gtk_css_matcher_widget_path_get_state (const GtkCssMatcher *matcher)
|
||||
{
|
||||
const GtkWidgetPath *siblings;
|
||||
|
||||
if (matcher->path.decl)
|
||||
return gtk_css_node_declaration_get_state (matcher->path.decl);
|
||||
|
||||
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
|
||||
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
|
||||
return gtk_widget_path_iter_get_state (siblings, matcher->path.sibling_index);
|
||||
@@ -84,6 +91,10 @@ gtk_css_matcher_widget_path_has_class (const GtkCssMatcher *matcher,
|
||||
{
|
||||
const GtkWidgetPath *siblings;
|
||||
|
||||
if (matcher->path.decl &&
|
||||
gtk_css_node_declaration_has_class (matcher->path.decl, class_name))
|
||||
return TRUE;
|
||||
|
||||
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
|
||||
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
|
||||
return gtk_widget_path_iter_has_qclass (siblings, matcher->path.sibling_index, class_name);
|
||||
@@ -111,6 +122,16 @@ gtk_css_matcher_widget_path_has_regions (const GtkCssMatcher *matcher)
|
||||
GSList *regions;
|
||||
gboolean result;
|
||||
|
||||
if (matcher->path.decl)
|
||||
{
|
||||
GList *list = gtk_css_node_declaration_list_regions (matcher->path.decl);
|
||||
if (list)
|
||||
{
|
||||
g_list_free (list);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
|
||||
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
|
||||
@@ -132,6 +153,14 @@ gtk_css_matcher_widget_path_has_region (const GtkCssMatcher *matcher,
|
||||
const GtkWidgetPath *siblings;
|
||||
GtkRegionFlags region_flags;
|
||||
|
||||
if (matcher->path.decl)
|
||||
{
|
||||
GQuark q = g_quark_try_string (region);
|
||||
|
||||
if (q && gtk_css_node_declaration_has_region (matcher->path.decl, q, ®ion_flags))
|
||||
goto found;
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
|
||||
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
|
||||
@@ -144,12 +173,13 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (!gtk_widget_path_iter_has_region (matcher->path.path, matcher->path.index, region, ®ion_flags))
|
||||
return FALSE;
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
found:
|
||||
if ((flags & region_flags) != flags)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -195,13 +225,15 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = {
|
||||
};
|
||||
|
||||
gboolean
|
||||
_gtk_css_matcher_init (GtkCssMatcher *matcher,
|
||||
const GtkWidgetPath *path)
|
||||
_gtk_css_matcher_init (GtkCssMatcher *matcher,
|
||||
const GtkWidgetPath *path,
|
||||
const GtkCssNodeDeclaration *decl)
|
||||
{
|
||||
if (gtk_widget_path_length (path) == 0)
|
||||
return FALSE;
|
||||
|
||||
matcher->path.klass = >K_CSS_MATCHER_WIDGET_PATH;
|
||||
matcher->path.decl = decl;
|
||||
matcher->path.path = path;
|
||||
matcher->path.index = gtk_widget_path_length (path) - 1;
|
||||
matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (path, matcher->path.index);
|
||||
@@ -209,6 +241,204 @@ _gtk_css_matcher_init (GtkCssMatcher *matcher,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GTK_CSS_MATCHER_NODE */
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_get_parent (GtkCssMatcher *matcher,
|
||||
const GtkCssMatcher *child)
|
||||
{
|
||||
GtkCssNode *node;
|
||||
|
||||
node = gtk_css_node_get_parent (child->node.node);
|
||||
if (node == NULL)
|
||||
return FALSE;
|
||||
|
||||
return gtk_css_node_init_matcher (node, matcher);
|
||||
}
|
||||
|
||||
static GtkCssNode *
|
||||
get_previous_visible_sibling (GtkCssNode *node)
|
||||
{
|
||||
do {
|
||||
node = gtk_css_node_get_previous_sibling (node);
|
||||
} while (node && !gtk_css_node_get_visible (node));
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static GtkCssNode *
|
||||
get_next_visible_sibling (GtkCssNode *node)
|
||||
{
|
||||
do {
|
||||
node = gtk_css_node_get_next_sibling (node);
|
||||
} while (node && !gtk_css_node_get_visible (node));
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_get_previous (GtkCssMatcher *matcher,
|
||||
const GtkCssMatcher *next)
|
||||
{
|
||||
GtkCssNode *node;
|
||||
|
||||
node = get_previous_visible_sibling (next->node.node);
|
||||
if (node == NULL)
|
||||
return FALSE;
|
||||
|
||||
return gtk_css_node_init_matcher (node, matcher);
|
||||
}
|
||||
|
||||
static GtkStateFlags
|
||||
gtk_css_matcher_node_get_state (const GtkCssMatcher *matcher)
|
||||
{
|
||||
return gtk_css_node_get_state (matcher->node.node);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_has_type (const GtkCssMatcher *matcher,
|
||||
GType type)
|
||||
{
|
||||
return g_type_is_a (gtk_css_node_get_widget_type (matcher->node.node), type);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_has_class (const GtkCssMatcher *matcher,
|
||||
GQuark class_name)
|
||||
{
|
||||
return gtk_css_node_has_qclass (matcher->node.node, class_name);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_has_id (const GtkCssMatcher *matcher,
|
||||
const char *id)
|
||||
{
|
||||
return gtk_css_node_get_id (matcher->node.node) == g_intern_string (id);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_has_regions (const GtkCssMatcher *matcher)
|
||||
{
|
||||
GList *regions;
|
||||
gboolean result;
|
||||
|
||||
regions = gtk_css_node_list_regions (matcher->node.node);
|
||||
result = regions != NULL;
|
||||
g_list_free (regions);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_has_region (const GtkCssMatcher *matcher,
|
||||
const char *region,
|
||||
GtkRegionFlags flags)
|
||||
{
|
||||
GtkRegionFlags region_flags;
|
||||
GQuark region_quark;
|
||||
|
||||
region_quark = g_quark_try_string (region);
|
||||
if (!region_quark)
|
||||
return FALSE;
|
||||
|
||||
if (!gtk_css_node_has_region (matcher->node.node, region_quark, ®ion_flags))
|
||||
return FALSE;
|
||||
|
||||
if ((flags & region_flags) != flags)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_nth_child (GtkCssNode *node,
|
||||
int a,
|
||||
int b)
|
||||
{
|
||||
while (b-- > 0)
|
||||
{
|
||||
if (node == NULL)
|
||||
return FALSE;
|
||||
|
||||
node = get_previous_visible_sibling (node);
|
||||
}
|
||||
|
||||
if (a == 0)
|
||||
return node == NULL;
|
||||
else if (a == 1)
|
||||
return TRUE;
|
||||
|
||||
b = 0;
|
||||
while (node)
|
||||
{
|
||||
b++;
|
||||
node = get_previous_visible_sibling (node);
|
||||
}
|
||||
|
||||
return b % a == 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_nth_last_child (GtkCssNode *node,
|
||||
int a,
|
||||
int b)
|
||||
{
|
||||
while (b-- > 0)
|
||||
{
|
||||
if (node == NULL)
|
||||
return FALSE;
|
||||
|
||||
node = get_next_visible_sibling (node);
|
||||
}
|
||||
|
||||
if (a == 0)
|
||||
return node == NULL;
|
||||
else if (a == 1)
|
||||
return TRUE;
|
||||
|
||||
b = 0;
|
||||
while (node)
|
||||
{
|
||||
b++;
|
||||
node = get_next_visible_sibling (node);
|
||||
}
|
||||
|
||||
return b % a == 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_node_has_position (const GtkCssMatcher *matcher,
|
||||
gboolean forward,
|
||||
int a,
|
||||
int b)
|
||||
{
|
||||
if (forward)
|
||||
return gtk_css_matcher_node_nth_child (matcher->node.node, a, b);
|
||||
else
|
||||
return gtk_css_matcher_node_nth_last_child (matcher->node.node, a, b);
|
||||
}
|
||||
|
||||
static const GtkCssMatcherClass GTK_CSS_MATCHER_NODE = {
|
||||
gtk_css_matcher_node_get_parent,
|
||||
gtk_css_matcher_node_get_previous,
|
||||
gtk_css_matcher_node_get_state,
|
||||
gtk_css_matcher_node_has_type,
|
||||
gtk_css_matcher_node_has_class,
|
||||
gtk_css_matcher_node_has_id,
|
||||
gtk_css_matcher_node_has_regions,
|
||||
gtk_css_matcher_node_has_region,
|
||||
gtk_css_matcher_node_has_position,
|
||||
FALSE
|
||||
};
|
||||
|
||||
void
|
||||
_gtk_css_matcher_node_init (GtkCssMatcher *matcher,
|
||||
GtkCssNode *node)
|
||||
{
|
||||
matcher->node.klass = >K_CSS_MATCHER_NODE;
|
||||
matcher->node.node = node;
|
||||
}
|
||||
|
||||
/* GTK_CSS_MATCHER_WIDGET_ANY */
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef union _GtkCssMatcher GtkCssMatcher;
|
||||
typedef struct _GtkCssMatcherNode GtkCssMatcherNode;
|
||||
typedef struct _GtkCssMatcherSuperset GtkCssMatcherSuperset;
|
||||
typedef struct _GtkCssMatcherWidgetPath GtkCssMatcherWidgetPath;
|
||||
typedef struct _GtkCssMatcherClass GtkCssMatcherClass;
|
||||
@@ -55,11 +55,17 @@ struct _GtkCssMatcherClass {
|
||||
|
||||
struct _GtkCssMatcherWidgetPath {
|
||||
const GtkCssMatcherClass *klass;
|
||||
const GtkCssNodeDeclaration *decl;
|
||||
const GtkWidgetPath *path;
|
||||
guint index;
|
||||
guint sibling_index;
|
||||
};
|
||||
|
||||
struct _GtkCssMatcherNode {
|
||||
const GtkCssMatcherClass *klass;
|
||||
GtkCssNode *node;
|
||||
};
|
||||
|
||||
struct _GtkCssMatcherSuperset {
|
||||
const GtkCssMatcherClass *klass;
|
||||
const GtkCssMatcher *subset;
|
||||
@@ -69,11 +75,15 @@ struct _GtkCssMatcherSuperset {
|
||||
union _GtkCssMatcher {
|
||||
const GtkCssMatcherClass *klass;
|
||||
GtkCssMatcherWidgetPath path;
|
||||
GtkCssMatcherNode node;
|
||||
GtkCssMatcherSuperset superset;
|
||||
};
|
||||
|
||||
gboolean _gtk_css_matcher_init (GtkCssMatcher *matcher,
|
||||
const GtkWidgetPath *path) G_GNUC_WARN_UNUSED_RESULT;
|
||||
const GtkWidgetPath *path,
|
||||
const GtkCssNodeDeclaration *decl) G_GNUC_WARN_UNUSED_RESULT;
|
||||
void _gtk_css_matcher_node_init (GtkCssMatcher *matcher,
|
||||
GtkCssNode *node);
|
||||
void _gtk_css_matcher_any_init (GtkCssMatcher *matcher);
|
||||
void _gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
|
||||
const GtkCssMatcher *subset,
|
||||
|
||||
+1300
File diff suppressed because it is too large
Load Diff
@@ -18,14 +18,12 @@
|
||||
#ifndef __GTK_CSS_NODE_DECLARATION_PRIVATE_H__
|
||||
#define __GTK_CSS_NODE_DECLARATION_PRIVATE_H__
|
||||
|
||||
#include "gtkcsstypesprivate.h"
|
||||
#include "gtkenums.h"
|
||||
#include "gtkwidgetpath.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkCssNodeDeclaration GtkCssNodeDeclaration;
|
||||
|
||||
|
||||
GtkCssNodeDeclaration * gtk_css_node_declaration_new (void);
|
||||
GtkCssNodeDeclaration * gtk_css_node_declaration_ref (GtkCssNodeDeclaration *decl);
|
||||
void gtk_css_node_declaration_unref (GtkCssNodeDeclaration *decl);
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CSS_NODE_PRIVATE_H__
|
||||
#define __GTK_CSS_NODE_PRIVATE_H__
|
||||
|
||||
#include "gtkcssnodedeclarationprivate.h"
|
||||
#include "gtkbitmaskprivate.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_CSS_NODE (gtk_css_node_get_type ())
|
||||
#define GTK_CSS_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_NODE, GtkCssNode))
|
||||
#define GTK_CSS_NODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_NODE, GtkCssNodeClass))
|
||||
#define GTK_IS_CSS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_NODE))
|
||||
#define GTK_IS_CSS_NODE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_NODE))
|
||||
#define GTK_CSS_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_NODE, GtkCssNodeClass))
|
||||
|
||||
typedef struct _GtkCssNode GtkCssNode;
|
||||
typedef struct _GtkCssNodeClass GtkCssNodeClass;
|
||||
|
||||
struct _GtkCssNode
|
||||
{
|
||||
GObject object;
|
||||
|
||||
GtkCssNode *parent;
|
||||
GtkCssNode *previous_sibling;
|
||||
GtkCssNode *next_sibling;
|
||||
GtkCssNode *first_child;
|
||||
GtkCssNode *last_child;
|
||||
|
||||
GtkCssNodeDeclaration *decl;
|
||||
GtkCssStyle *style;
|
||||
|
||||
GtkCssChange pending_changes; /* changes that accumulated since the style was last computed */
|
||||
|
||||
guint visible :1; /* node will be skipped when validating or computing styles */
|
||||
guint invalid :1; /* node or a child needs to be validated (even if just for animation) */
|
||||
guint children_changed :1; /* the children changed since last validation */
|
||||
guint needs_propagation :1; /* children have state changes that need to be propagated to their siblings */
|
||||
/* Two invariants hold for this variable:
|
||||
* style_is_invalid == TRUE => next_sibling->style_is_invalid == TRUE
|
||||
* style_is_invalid == FALSE => first_child->style_is_invalid == TRUE
|
||||
* So if a valid style is computed, one has to previously ensure that the parent's and the previous sibling's style
|
||||
* are valid. This allows both validation and invalidation to run in O(nodes-in-tree) */
|
||||
guint style_is_invalid :1; /* the style needs to be recomputed */
|
||||
};
|
||||
|
||||
struct _GtkCssNodeClass
|
||||
{
|
||||
GObjectClass object_class;
|
||||
|
||||
void (* node_added) (GtkCssNode *cssnode,
|
||||
GtkCssNode *child,
|
||||
GtkCssNode *previous);
|
||||
void (* node_removed) (GtkCssNode *cssnode,
|
||||
GtkCssNode *child,
|
||||
GtkCssNode *previous);
|
||||
void (* style_changed) (GtkCssNode *cssnode,
|
||||
GtkCssStyle *old_style,
|
||||
GtkCssStyle *new_style);
|
||||
|
||||
gboolean (* init_matcher) (GtkCssNode *cssnode,
|
||||
GtkCssMatcher *matcher);
|
||||
GtkWidgetPath * (* create_widget_path) (GtkCssNode *cssnode);
|
||||
const GtkWidgetPath * (* get_widget_path) (GtkCssNode *cssnode);
|
||||
/* get style provider to use or NULL to use parent's */
|
||||
GtkStyleProviderPrivate *(* get_style_provider) (GtkCssNode *cssnode);
|
||||
/* get frame clock or NULL (only relevant for root node) */
|
||||
GdkFrameClock * (* get_frame_clock) (GtkCssNode *cssnode);
|
||||
GtkCssStyle * (* update_style) (GtkCssNode *cssnode,
|
||||
GtkCssChange pending_changes,
|
||||
gint64 timestamp,
|
||||
GtkCssStyle *old_style);
|
||||
void (* invalidate) (GtkCssNode *node);
|
||||
void (* queue_validate) (GtkCssNode *node);
|
||||
void (* dequeue_validate) (GtkCssNode *node);
|
||||
void (* validate) (GtkCssNode *node);
|
||||
};
|
||||
|
||||
GType gtk_css_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkCssNode * gtk_css_node_new (void);
|
||||
|
||||
void gtk_css_node_set_parent (GtkCssNode *cssnode,
|
||||
GtkCssNode *parent);
|
||||
void gtk_css_node_set_after (GtkCssNode *cssnode,
|
||||
GtkCssNode *previous_sibling);
|
||||
void gtk_css_node_set_before (GtkCssNode *cssnode,
|
||||
GtkCssNode *next_sibling);
|
||||
GtkCssNode * gtk_css_node_get_parent (GtkCssNode *cssnode);
|
||||
GtkCssNode * gtk_css_node_get_first_child (GtkCssNode *cssnode);
|
||||
GtkCssNode * gtk_css_node_get_last_child (GtkCssNode *cssnode);
|
||||
GtkCssNode * gtk_css_node_get_previous_sibling(GtkCssNode *cssnode);
|
||||
GtkCssNode * gtk_css_node_get_next_sibling (GtkCssNode *cssnode);
|
||||
|
||||
void gtk_css_node_set_visible (GtkCssNode *cssnode,
|
||||
gboolean visible);
|
||||
gboolean gtk_css_node_get_visible (GtkCssNode *cssnode);
|
||||
|
||||
void gtk_css_node_set_widget_type (GtkCssNode *cssnode,
|
||||
GType widget_type);
|
||||
GType gtk_css_node_get_widget_type (GtkCssNode *cssnode);
|
||||
void gtk_css_node_set_id (GtkCssNode *cssnode,
|
||||
const char *id);
|
||||
const char * gtk_css_node_get_id (GtkCssNode *cssnode);
|
||||
void gtk_css_node_set_state (GtkCssNode *cssnode,
|
||||
GtkStateFlags state_flags);
|
||||
GtkStateFlags gtk_css_node_get_state (GtkCssNode *cssnode);
|
||||
void gtk_css_node_add_state (GtkCssNode *cssnode,
|
||||
GtkStateFlags state_flags);
|
||||
void gtk_css_node_remove_state (GtkCssNode *cssnode,
|
||||
GtkStateFlags state_flags);
|
||||
void gtk_css_node_set_junction_sides (GtkCssNode *cssnode,
|
||||
GtkJunctionSides junction_sides);
|
||||
GtkJunctionSides gtk_css_node_get_junction_sides (GtkCssNode *cssnode);
|
||||
void gtk_css_node_set_classes (GtkCssNode *cssnode,
|
||||
const char **classes);
|
||||
char ** gtk_css_node_get_classes (GtkCssNode *cssnode);
|
||||
void gtk_css_node_add_class (GtkCssNode *cssnode,
|
||||
const char *style_class);
|
||||
void gtk_css_node_remove_class (GtkCssNode *cssnode,
|
||||
const char *style_class);
|
||||
gboolean gtk_css_node_has_class (GtkCssNode *cssnode,
|
||||
const char *style_class);
|
||||
gboolean gtk_css_node_has_qclass (GtkCssNode *cssnode,
|
||||
GQuark style_class);
|
||||
GList * gtk_css_node_list_classes (GtkCssNode *cssnode);
|
||||
void gtk_css_node_add_region (GtkCssNode *cssnode,
|
||||
GQuark region,
|
||||
GtkRegionFlags flags);
|
||||
void gtk_css_node_remove_region (GtkCssNode *cssnode,
|
||||
GQuark region);
|
||||
gboolean gtk_css_node_has_region (GtkCssNode *cssnode,
|
||||
GQuark region,
|
||||
GtkRegionFlags *out_flags);
|
||||
GList * gtk_css_node_list_regions (GtkCssNode *cssnode);
|
||||
|
||||
const GtkCssNodeDeclaration *
|
||||
gtk_css_node_get_declaration (GtkCssNode *cssnode);
|
||||
GtkCssStyle * gtk_css_node_get_style (GtkCssNode *cssnode);
|
||||
|
||||
|
||||
void gtk_css_node_invalidate_style_provider
|
||||
(GtkCssNode *cssnode);
|
||||
void gtk_css_node_invalidate_frame_clock
|
||||
(GtkCssNode *cssnode,
|
||||
gboolean just_timestamp);
|
||||
void gtk_css_node_invalidate (GtkCssNode *cssnode,
|
||||
GtkCssChange change);
|
||||
void gtk_css_node_validate (GtkCssNode *cssnode);
|
||||
|
||||
gboolean gtk_css_node_init_matcher (GtkCssNode *cssnode,
|
||||
GtkCssMatcher *matcher);
|
||||
GtkWidgetPath * gtk_css_node_create_widget_path (GtkCssNode *cssnode);
|
||||
const GtkWidgetPath * gtk_css_node_get_widget_path (GtkCssNode *cssnode);
|
||||
GtkStyleProviderPrivate *gtk_css_node_get_style_provider(GtkCssNode *cssnode);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CSS_NODE_PRIVATE_H__ */
|
||||
@@ -0,0 +1,300 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkcssnodeutilsprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkcssshadowsvalueprivate.h"
|
||||
#include "gtkcssstyleprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
|
||||
void
|
||||
gtk_css_node_style_changed_for_widget (GtkCssNode *node,
|
||||
GtkCssStyle *old_style,
|
||||
GtkCssStyle *new_style,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
static GtkBitmask *affects_size = NULL;
|
||||
GtkBitmask *changes;
|
||||
|
||||
changes = gtk_css_style_get_difference (old_style, new_style);
|
||||
|
||||
if (G_UNLIKELY (affects_size == NULL))
|
||||
affects_size = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP);
|
||||
|
||||
if (_gtk_bitmask_intersects (changes, affects_size))
|
||||
gtk_widget_queue_resize (widget);
|
||||
else
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
_gtk_bitmask_free (changes);
|
||||
}
|
||||
|
||||
static gint
|
||||
get_number (GtkCssStyle *style,
|
||||
guint property)
|
||||
{
|
||||
double d = _gtk_css_number_value_get (gtk_css_style_get_value (style, property), 100);
|
||||
|
||||
if (d < 1)
|
||||
return ceil (d);
|
||||
else
|
||||
return floor (d);
|
||||
}
|
||||
|
||||
static void
|
||||
get_box_margin (GtkCssStyle *style,
|
||||
GtkBorder *margin)
|
||||
{
|
||||
margin->top = get_number (style, GTK_CSS_PROPERTY_MARGIN_TOP);
|
||||
margin->left = get_number (style, GTK_CSS_PROPERTY_MARGIN_LEFT);
|
||||
margin->bottom = get_number (style, GTK_CSS_PROPERTY_MARGIN_BOTTOM);
|
||||
margin->right = get_number (style, GTK_CSS_PROPERTY_MARGIN_RIGHT);
|
||||
}
|
||||
|
||||
static void
|
||||
get_box_border (GtkCssStyle *style,
|
||||
GtkBorder *border)
|
||||
{
|
||||
border->top = get_number (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH);
|
||||
border->left = get_number (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH);
|
||||
border->bottom = get_number (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH);
|
||||
border->right = get_number (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH);
|
||||
}
|
||||
|
||||
static void
|
||||
get_box_padding (GtkCssStyle *style,
|
||||
GtkBorder *border)
|
||||
{
|
||||
border->top = get_number (style, GTK_CSS_PROPERTY_PADDING_TOP);
|
||||
border->left = get_number (style, GTK_CSS_PROPERTY_PADDING_LEFT);
|
||||
border->bottom = get_number (style, GTK_CSS_PROPERTY_PADDING_BOTTOM);
|
||||
border->right = get_number (style, GTK_CSS_PROPERTY_PADDING_RIGHT);
|
||||
}
|
||||
|
||||
static void
|
||||
get_content_size_func_default (GtkCssNode *cssnode,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum,
|
||||
gint *natural,
|
||||
gint *minimum_baseline,
|
||||
gint *natural_baseline,
|
||||
gpointer unused)
|
||||
{
|
||||
*minimum = 0;
|
||||
*natural = 0;
|
||||
|
||||
if (minimum_baseline)
|
||||
*minimum_baseline = 0;
|
||||
if (natural_baseline)
|
||||
*natural_baseline = 0;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_node_get_preferred_size (GtkCssNode *cssnode,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum,
|
||||
gint *natural,
|
||||
gint *minimum_baseline,
|
||||
gint *natural_baseline,
|
||||
GtkCssNodeSizeFunc get_content_size_func,
|
||||
gpointer get_content_size_data)
|
||||
{
|
||||
GtkCssStyle *style;
|
||||
GtkBorder margin, border, padding;
|
||||
int min_size, extra_size, extra_opposite, extra_baseline;
|
||||
|
||||
if (!get_content_size_func)
|
||||
get_content_size_func = get_content_size_func_default;
|
||||
style = gtk_css_node_get_style (cssnode);
|
||||
get_box_margin (style, &margin);
|
||||
get_box_border (style, &border);
|
||||
get_box_padding (style, &padding);
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
extra_size = margin.left + margin.right + border.left + border.right + padding.left + padding.right;
|
||||
extra_opposite = margin.top + margin.bottom + border.top + border.bottom + padding.top + padding.bottom;
|
||||
extra_baseline = margin.left + border.left + padding.left;
|
||||
min_size = get_number (style, GTK_CSS_PROPERTY_MIN_WIDTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
extra_size = margin.top + margin.bottom + border.top + border.bottom + padding.top + padding.bottom;
|
||||
extra_opposite = margin.left + margin.right + border.left + border.right + padding.left + padding.right;
|
||||
extra_baseline = margin.top + border.top + padding.top;
|
||||
min_size = get_number (style, GTK_CSS_PROPERTY_MIN_HEIGHT);
|
||||
}
|
||||
|
||||
if (for_size > -1)
|
||||
for_size -= extra_opposite;
|
||||
|
||||
if (minimum_baseline)
|
||||
*minimum_baseline = -1;
|
||||
if (natural_baseline)
|
||||
*natural_baseline = -1;
|
||||
|
||||
get_content_size_func (cssnode,
|
||||
orientation,
|
||||
for_size,
|
||||
minimum, natural,
|
||||
minimum_baseline, natural_baseline,
|
||||
get_content_size_data);
|
||||
|
||||
g_warn_if_fail (*minimum <= *natural);
|
||||
|
||||
*minimum = MAX (min_size, *minimum);
|
||||
*natural = MAX (min_size, *natural);
|
||||
|
||||
*minimum += extra_size;
|
||||
*natural += extra_size;
|
||||
|
||||
if (minimum_baseline && *minimum_baseline > -1)
|
||||
*minimum_baseline += extra_baseline;
|
||||
if (natural_baseline && *natural_baseline > -1)
|
||||
*natural_baseline += extra_baseline;
|
||||
}
|
||||
|
||||
static void
|
||||
allocate_func_default (GtkCssNode *cssnode,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline,
|
||||
GtkAllocation *out_clip,
|
||||
gpointer unused)
|
||||
{
|
||||
*out_clip = *allocation;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_node_allocate (GtkCssNode *cssnode,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline,
|
||||
GtkAllocation *out_clip,
|
||||
GtkCssNodeAllocateFunc allocate_func,
|
||||
gpointer allocate_data)
|
||||
{
|
||||
GtkAllocation content_allocation, clip;
|
||||
GtkBorder margin, border, padding, shadow, extents;
|
||||
GtkCssStyle *style;
|
||||
|
||||
if (out_clip == NULL)
|
||||
out_clip = &clip;
|
||||
if (!allocate_func)
|
||||
allocate_func = allocate_func_default;
|
||||
style = gtk_css_node_get_style (cssnode);
|
||||
get_box_margin (style, &margin);
|
||||
get_box_border (style, &border);
|
||||
get_box_padding (style, &padding);
|
||||
extents.top = margin.top + border.top + padding.top;
|
||||
extents.right = margin.right + border.right + padding.right;
|
||||
extents.bottom = margin.bottom + border.bottom + padding.bottom;
|
||||
extents.left = margin.left + border.left + padding.left;
|
||||
|
||||
content_allocation.x = allocation->x + extents.left;
|
||||
content_allocation.y = allocation->y + extents.top;
|
||||
content_allocation.width = allocation->width - extents.left - extents.right;
|
||||
content_allocation.height = allocation->height - extents.top - extents.bottom;
|
||||
if (baseline >= 0)
|
||||
baseline += extents.top;
|
||||
|
||||
g_assert (content_allocation.width >= 0);
|
||||
g_assert (content_allocation.height >= 0);
|
||||
|
||||
allocate_func (cssnode, &content_allocation, baseline, out_clip, allocate_data);
|
||||
|
||||
_gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
|
||||
out_clip->x -= extents.left + shadow.left - margin.left;
|
||||
out_clip->y -= extents.top + shadow.top - margin.top;
|
||||
out_clip->width += extents.left + extents.right + shadow.left + shadow.right - margin.left - margin.right;
|
||||
out_clip->height += extents.top + extents.bottom + shadow.top + shadow.bottom - margin.top - margin.bottom;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
draw_contents_func_default (GtkCssNode *cssnode,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer unused)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_node_draw (GtkCssNode *cssnode,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
GtkCssNodeDrawFunc draw_contents_func,
|
||||
gpointer draw_contents_data)
|
||||
{
|
||||
GtkBorder margin, border, padding;
|
||||
gboolean draw_focus;
|
||||
GtkCssStyle *style;
|
||||
int contents_width, contents_height;
|
||||
|
||||
if (draw_contents_func == NULL)
|
||||
draw_contents_func = draw_contents_func_default;
|
||||
style = gtk_css_node_get_style (cssnode);
|
||||
get_box_margin (style, &margin);
|
||||
get_box_border (style, &border);
|
||||
get_box_padding (style, &padding);
|
||||
|
||||
gtk_css_style_render_background (style,
|
||||
cr,
|
||||
margin.left,
|
||||
margin.top,
|
||||
width - margin.left - margin.right,
|
||||
height - margin.top - margin.bottom,
|
||||
gtk_css_node_get_junction_sides (cssnode));
|
||||
gtk_css_style_render_border (style,
|
||||
cr,
|
||||
margin.left,
|
||||
margin.top,
|
||||
width - margin.left - margin.right,
|
||||
height - margin.top - margin.bottom,
|
||||
0,
|
||||
gtk_css_node_get_junction_sides (cssnode));
|
||||
|
||||
cairo_translate (cr,
|
||||
margin.left + border.left + padding.left,
|
||||
margin.top + border.top + padding.top);
|
||||
contents_width = width - margin.left - margin.right - border.left - border.right - padding.left - padding.right;
|
||||
contents_height = height - margin.top - margin.bottom - border.top - border.bottom - padding.top - padding.bottom;
|
||||
|
||||
draw_focus = draw_contents_func (cssnode, cr, contents_width, contents_height, draw_contents_data);
|
||||
|
||||
cairo_translate (cr,
|
||||
- (margin.left + border.left + padding.left),
|
||||
- (margin.top + border.top + padding.top));
|
||||
|
||||
if (draw_focus)
|
||||
gtk_css_style_render_outline (style,
|
||||
cr,
|
||||
margin.left,
|
||||
margin.top,
|
||||
width - margin.left - margin.right,
|
||||
height - margin.top - margin.bottom);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CSS_NODE_UTILS_PRIVATE_H__
|
||||
#define __GTK_CSS_NODE_UTILS_PRIVATE_H__
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include "gtk/gtkcssnodeprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gtk_css_node_style_changed_for_widget (GtkCssNode *node,
|
||||
GtkCssStyle *old_style,
|
||||
GtkCssStyle *new_style,
|
||||
GtkWidget *widget);
|
||||
|
||||
typedef void (* GtkCssNodeSizeFunc) (GtkCssNode *cssnode,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum,
|
||||
gint *natural,
|
||||
gint *minimum_baseline,
|
||||
gint *natural_baseline,
|
||||
gpointer get_content_size_data);
|
||||
void gtk_css_node_get_preferred_size (GtkCssNode *cssnode,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum,
|
||||
gint *natural,
|
||||
gint *minimum_baseline,
|
||||
gint *natural_baseline,
|
||||
GtkCssNodeSizeFunc get_content_size_func,
|
||||
gpointer get_content_size_data);
|
||||
|
||||
typedef void (* GtkCssNodeAllocateFunc) (GtkCssNode *cssnode,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline,
|
||||
GtkAllocation *out_clip,
|
||||
gpointer allocate_data);
|
||||
void gtk_css_node_allocate (GtkCssNode *cssnode,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline,
|
||||
GtkAllocation *out_clip,
|
||||
GtkCssNodeAllocateFunc allocate_func,
|
||||
gpointer allocate_data);
|
||||
|
||||
typedef gboolean (* GtkCssNodeDrawFunc) (GtkCssNode *cssnode,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data);
|
||||
void gtk_css_node_draw (GtkCssNode *cssnode,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
GtkCssNodeDrawFunc draw_contents_func,
|
||||
gpointer draw_contents_data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CSS_NODE_UTILS_PRIVATE_H__ */
|
||||
@@ -39,19 +39,16 @@ static double
|
||||
get_base_font_size (guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
|
||||
{
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
|
||||
if (parent_style)
|
||||
return _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
|
||||
else
|
||||
return _gtk_css_font_size_get_default (provider);
|
||||
}
|
||||
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
|
||||
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
|
||||
}
|
||||
|
||||
@@ -60,8 +57,7 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkBorderStyle border_style;
|
||||
|
||||
@@ -106,7 +102,7 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
||||
/* percentages for font sizes are computed, other percentages aren't */
|
||||
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
|
||||
return _gtk_css_number_value_new (number->value / 100.0 *
|
||||
get_base_font_size (property_id, provider, style, parent_style, dependencies),
|
||||
get_base_font_size (property_id, provider, style, parent_style),
|
||||
GTK_CSS_PX);
|
||||
case GTK_CSS_NUMBER:
|
||||
case GTK_CSS_PX:
|
||||
@@ -134,13 +130,13 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
||||
break;
|
||||
case GTK_CSS_EM:
|
||||
return _gtk_css_number_value_new (number->value *
|
||||
get_base_font_size (property_id, provider, style, parent_style, dependencies),
|
||||
get_base_font_size (property_id, provider, style, parent_style),
|
||||
GTK_CSS_PX);
|
||||
break;
|
||||
case GTK_CSS_EX:
|
||||
/* for now we pretend ex is half of em */
|
||||
return _gtk_css_number_value_new (number->value * 0.5 *
|
||||
get_base_font_size (property_id, provider, style, parent_style, dependencies),
|
||||
get_base_font_size (property_id, provider, style, parent_style),
|
||||
GTK_CSS_PX);
|
||||
case GTK_CSS_RAD:
|
||||
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkcsspathnodeprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkCssPathNode, gtk_css_path_node, GTK_TYPE_CSS_NODE)
|
||||
|
||||
static void
|
||||
gtk_css_path_node_finalize (GObject *object)
|
||||
{
|
||||
GtkCssPathNode *node = GTK_CSS_PATH_NODE (object);
|
||||
|
||||
if (node->path)
|
||||
gtk_widget_path_unref (node->path);
|
||||
|
||||
G_OBJECT_CLASS (gtk_css_path_node_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_path_node_invalidate (GtkCssNode *node)
|
||||
{
|
||||
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
|
||||
|
||||
if (path_node->context)
|
||||
{
|
||||
GtkBitmask *changes;
|
||||
|
||||
changes = _gtk_bitmask_new ();
|
||||
changes = _gtk_bitmask_invert_range (changes,
|
||||
0,
|
||||
_gtk_css_style_property_get_n_properties ());
|
||||
|
||||
gtk_style_context_validate (path_node->context, changes);
|
||||
|
||||
_gtk_bitmask_free (changes);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_path_node_real_init_matcher (GtkCssNode *node,
|
||||
GtkCssMatcher *matcher)
|
||||
{
|
||||
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
|
||||
|
||||
if (path_node->path == NULL ||
|
||||
gtk_widget_path_length (path_node->path) == 0)
|
||||
return FALSE;
|
||||
|
||||
return _gtk_css_matcher_init (matcher,
|
||||
path_node->path,
|
||||
gtk_css_node_get_declaration (node));
|
||||
}
|
||||
|
||||
static GtkWidgetPath *
|
||||
gtk_css_path_node_real_create_widget_path (GtkCssNode *node)
|
||||
{
|
||||
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
|
||||
GtkWidgetPath *path;
|
||||
guint length;
|
||||
|
||||
if (path_node->path == NULL)
|
||||
path = gtk_widget_path_new ();
|
||||
else
|
||||
path = gtk_widget_path_copy (path_node->path);
|
||||
|
||||
length = gtk_widget_path_length (path);
|
||||
if (length > 0)
|
||||
{
|
||||
gtk_css_node_declaration_add_to_widget_path (gtk_css_node_get_declaration (node),
|
||||
path,
|
||||
length - 1);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
static const GtkWidgetPath *
|
||||
gtk_css_path_node_real_get_widget_path (GtkCssNode *node)
|
||||
{
|
||||
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
|
||||
|
||||
return path_node->path;
|
||||
}
|
||||
|
||||
static GtkCssStyle *
|
||||
gtk_css_path_node_update_style (GtkCssNode *cssnode,
|
||||
GtkCssChange change,
|
||||
gint64 timestamp,
|
||||
GtkCssStyle *style)
|
||||
{
|
||||
/* This should get rid of animations */
|
||||
return GTK_CSS_NODE_CLASS (gtk_css_path_node_parent_class)->update_style (cssnode, change, 0, style);
|
||||
}
|
||||
|
||||
static GtkStyleProviderPrivate *
|
||||
gtk_css_path_node_get_style_provider (GtkCssNode *node)
|
||||
{
|
||||
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
|
||||
|
||||
if (path_node->context == NULL)
|
||||
return NULL;
|
||||
|
||||
return gtk_style_context_get_style_provider (path_node->context);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_path_node_class_init (GtkCssPathNodeClass *klass)
|
||||
{
|
||||
GtkCssNodeClass *node_class = GTK_CSS_NODE_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gtk_css_path_node_finalize;
|
||||
|
||||
node_class->invalidate = gtk_css_path_node_invalidate;
|
||||
node_class->update_style = gtk_css_path_node_update_style;
|
||||
node_class->init_matcher = gtk_css_path_node_real_init_matcher;
|
||||
node_class->create_widget_path = gtk_css_path_node_real_create_widget_path;
|
||||
node_class->get_widget_path = gtk_css_path_node_real_get_widget_path;
|
||||
node_class->get_style_provider = gtk_css_path_node_get_style_provider;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_path_node_init (GtkCssPathNode *cssnode)
|
||||
{
|
||||
}
|
||||
|
||||
GtkCssNode *
|
||||
gtk_css_path_node_new (GtkStyleContext *context)
|
||||
{
|
||||
GtkCssPathNode *node;
|
||||
|
||||
g_return_val_if_fail (context == NULL || GTK_IS_STYLE_CONTEXT (context), NULL);
|
||||
|
||||
node = g_object_new (GTK_TYPE_CSS_PATH_NODE, NULL);
|
||||
node->context = context;
|
||||
|
||||
return GTK_CSS_NODE (node);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_path_node_unset_context (GtkCssPathNode *node)
|
||||
{
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_PATH_NODE (node));
|
||||
gtk_internal_return_if_fail (node->context != NULL);
|
||||
|
||||
node->context = NULL;
|
||||
|
||||
gtk_css_node_invalidate_style_provider (GTK_CSS_NODE (node));
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_path_node_set_widget_path (GtkCssPathNode *node,
|
||||
GtkWidgetPath *path)
|
||||
{
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_PATH_NODE (node));
|
||||
|
||||
if (node->path == path)
|
||||
return;
|
||||
|
||||
if (node->path)
|
||||
gtk_widget_path_unref (node->path);
|
||||
|
||||
if (path)
|
||||
gtk_widget_path_ref (path);
|
||||
|
||||
node->path = path;
|
||||
|
||||
gtk_css_node_invalidate (GTK_CSS_NODE (node), GTK_CSS_CHANGE_ANY);
|
||||
}
|
||||
|
||||
GtkWidgetPath *
|
||||
gtk_css_path_node_get_widget_path (GtkCssPathNode *node)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_PATH_NODE (node), NULL);
|
||||
|
||||
return node->path;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CSS_PATH_NODE_PRIVATE_H__
|
||||
#define __GTK_CSS_PATH_NODE_PRIVATE_H__
|
||||
|
||||
#include "gtkcssnodeprivate.h"
|
||||
#include "gtkwidgetpath.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_CSS_PATH_NODE (gtk_css_path_node_get_type ())
|
||||
#define GTK_CSS_PATH_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_PATH_NODE, GtkCssPathNode))
|
||||
#define GTK_CSS_PATH_NODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_PATH_NODE, GtkCssPathNodeClass))
|
||||
#define GTK_IS_CSS_PATH_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_PATH_NODE))
|
||||
#define GTK_IS_CSS_PATH_NODE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_PATH_NODE))
|
||||
#define GTK_CSS_PATH_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_PATH_NODE, GtkCssPathNodeClass))
|
||||
|
||||
typedef struct _GtkCssPathNode GtkCssPathNode;
|
||||
typedef struct _GtkCssPathNodeClass GtkCssPathNodeClass;
|
||||
|
||||
struct _GtkCssPathNode
|
||||
{
|
||||
GtkCssNode node;
|
||||
|
||||
GtkStyleContext *context;
|
||||
GtkWidgetPath *path;
|
||||
};
|
||||
|
||||
struct _GtkCssPathNodeClass
|
||||
{
|
||||
GtkCssNodeClass node_class;
|
||||
};
|
||||
|
||||
GType gtk_css_path_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkCssNode * gtk_css_path_node_new (GtkStyleContext *context);
|
||||
|
||||
void gtk_css_path_node_unset_context (GtkCssPathNode *node);
|
||||
|
||||
void gtk_css_path_node_set_widget_path (GtkCssPathNode *node,
|
||||
GtkWidgetPath *path);
|
||||
GtkWidgetPath * gtk_css_path_node_get_widget_path (GtkCssPathNode *node);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CSS_PATH_NODE_PRIVATE_H__ */
|
||||
@@ -41,15 +41,12 @@ gtk_css_value_position_compute (GtkCssValue *position,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
GtkCssDependencies x_deps, y_deps;
|
||||
|
||||
x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style, &x_deps);
|
||||
y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style, &y_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
|
||||
x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style);
|
||||
y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style);
|
||||
if (x == position->x && y == position->y)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
|
||||
@@ -1695,7 +1695,7 @@ gtk_css_provider_get_style_property (GtkStyleProvider *provider,
|
||||
gtk_widget_path_iter_set_state (path, -1, state);
|
||||
}
|
||||
|
||||
if (!_gtk_css_matcher_init (&matcher, path))
|
||||
if (!_gtk_css_matcher_init (&matcher, path, NULL))
|
||||
{
|
||||
gtk_widget_path_unref (path);
|
||||
return FALSE;
|
||||
|
||||
@@ -38,8 +38,7 @@ gtk_css_value_repeat_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
@@ -38,8 +38,7 @@ gtk_css_value_rgba_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
@@ -55,11 +55,9 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
GtkCssDependencies child_deps;
|
||||
guint i;
|
||||
|
||||
if (value->len == 0)
|
||||
@@ -68,8 +66,7 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
|
||||
result = gtk_css_shadows_value_new (value->values, value->len);
|
||||
for (i = 0; i < value->len; i++)
|
||||
{
|
||||
result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, &child_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
+26
-83
@@ -67,31 +67,15 @@ gtk_css_value_shadow_compute (GtkCssValue *shadow,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssValue *hoffset, *voffset, *radius, *spread, *color;
|
||||
GtkCssDependencies child_deps;
|
||||
|
||||
child_deps = 0;
|
||||
hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style, &child_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
|
||||
child_deps = 0;
|
||||
voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style, &child_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
|
||||
child_deps = 0;
|
||||
radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style, &child_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
|
||||
child_deps = 0;
|
||||
spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style, &child_deps),
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
|
||||
child_deps = 0;
|
||||
color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style, &child_deps);
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style);
|
||||
voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style);
|
||||
radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style);
|
||||
spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style),
|
||||
color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style);
|
||||
|
||||
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);
|
||||
}
|
||||
@@ -313,10 +297,7 @@ static gboolean
|
||||
needs_blur (const GtkCssValue *shadow)
|
||||
{
|
||||
double radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||
|
||||
/* The code doesn't actually do any blurring for radius 1, as it
|
||||
* ends up with box filter size 1 */
|
||||
if (radius <= 1.0)
|
||||
if (radius == 0.0)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
@@ -326,15 +307,12 @@ static const cairo_user_data_key_t original_cr_key;
|
||||
|
||||
static cairo_t *
|
||||
gtk_css_shadow_value_start_drawing (const GtkCssValue *shadow,
|
||||
cairo_t *cr,
|
||||
GtkBlurFlags blur_flags)
|
||||
cairo_t *cr)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *blur_cr;
|
||||
gdouble radius, clip_radius;
|
||||
gboolean blur_x = (blur_flags & GTK_BLUR_X) != 0;
|
||||
gboolean blur_y = (blur_flags & GTK_BLUR_Y) != 0;
|
||||
|
||||
if (!needs_blur (shadow))
|
||||
return cr;
|
||||
@@ -344,22 +322,12 @@ gtk_css_shadow_value_start_drawing (const GtkCssValue *shadow,
|
||||
radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||
clip_radius = _gtk_cairo_blur_compute_pixels (radius);
|
||||
|
||||
if (blur_flags & GTK_BLUR_REPEAT)
|
||||
{
|
||||
if (!blur_x)
|
||||
clip_rect.width = 1;
|
||||
if (!blur_y)
|
||||
clip_rect.height = 1;
|
||||
}
|
||||
|
||||
/* Create a larger surface to center the blur. */
|
||||
surface = cairo_surface_create_similar_image (cairo_get_target (cr),
|
||||
CAIRO_FORMAT_A8,
|
||||
clip_rect.width + (blur_x ? 2 * clip_radius : 0),
|
||||
clip_rect.height + (blur_y ? 2 * clip_radius : 0));
|
||||
cairo_surface_set_device_offset (surface,
|
||||
(blur_x ? clip_radius : 0) - clip_rect.x,
|
||||
(blur_y ? clip_radius : 0) - clip_rect.y);
|
||||
clip_rect.width + 2 * clip_radius,
|
||||
clip_rect.height + 2 * clip_radius);
|
||||
cairo_surface_set_device_offset (surface, clip_radius - clip_rect.x, clip_radius - clip_rect.y);
|
||||
blur_cr = cairo_create (surface);
|
||||
cairo_set_user_data (blur_cr, &original_cr_key, cairo_reference (cr), (cairo_destroy_func_t) cairo_destroy);
|
||||
|
||||
@@ -374,24 +342,9 @@ gtk_css_shadow_value_start_drawing (const GtkCssValue *shadow,
|
||||
return blur_cr;
|
||||
}
|
||||
|
||||
void
|
||||
mask_surface_repeat (cairo_t *cr,
|
||||
cairo_surface_t *surface)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
pattern = cairo_pattern_create_for_surface (surface);
|
||||
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
|
||||
|
||||
cairo_mask (cr, pattern);
|
||||
|
||||
cairo_pattern_destroy (pattern);
|
||||
}
|
||||
|
||||
static cairo_t *
|
||||
gtk_css_shadow_value_finish_drawing (const GtkCssValue *shadow,
|
||||
cairo_t *cr,
|
||||
GtkBlurFlags blur_flags)
|
||||
cairo_t *cr)
|
||||
{
|
||||
gdouble radius;
|
||||
cairo_t *original_cr;
|
||||
@@ -405,16 +358,12 @@ gtk_css_shadow_value_finish_drawing (const GtkCssValue *shadow,
|
||||
/* Blur the surface. */
|
||||
surface = cairo_get_target (cr);
|
||||
radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||
_gtk_cairo_blur_surface (surface, radius, blur_flags);
|
||||
_gtk_cairo_blur_surface (surface, radius);
|
||||
|
||||
gdk_cairo_set_source_rgba (original_cr, _gtk_css_rgba_value_get_rgba (shadow->color));
|
||||
if (blur_flags & GTK_BLUR_REPEAT)
|
||||
mask_surface_repeat (original_cr, surface);
|
||||
else
|
||||
cairo_mask_surface (original_cr, surface, 0, 0);
|
||||
cairo_mask_surface (original_cr, surface, 0, 0);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
return original_cr;
|
||||
@@ -476,7 +425,7 @@ make_blurred_pango_surface (cairo_t *existing_cr,
|
||||
cr = cairo_create (surface);
|
||||
cairo_move_to (cr, 0, 0);
|
||||
_gtk_pango_fill_layout (cr, layout);
|
||||
_gtk_cairo_blur_surface (surface, radius * x_scale, GTK_BLUR_X | GTK_BLUR_Y);
|
||||
_gtk_cairo_blur_surface (surface, radius * x_scale);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
@@ -563,14 +512,14 @@ _gtk_css_shadow_value_paint_icon (const GtkCssValue *shadow,
|
||||
pattern = cairo_pattern_reference (cairo_get_source (cr));
|
||||
|
||||
gdk_cairo_set_source_rgba (cr, _gtk_css_rgba_value_get_rgba (shadow->color));
|
||||
cr = gtk_css_shadow_value_start_drawing (shadow, cr, GTK_BLUR_X | GTK_BLUR_Y);
|
||||
cr = gtk_css_shadow_value_start_drawing (shadow, cr);
|
||||
|
||||
cairo_translate (cr,
|
||||
_gtk_css_number_value_get (shadow->hoffset, 0),
|
||||
_gtk_css_number_value_get (shadow->voffset, 0));
|
||||
cairo_mask (cr, pattern);
|
||||
|
||||
cr = gtk_css_shadow_value_finish_drawing (shadow, cr, GTK_BLUR_X | GTK_BLUR_Y);
|
||||
cr = gtk_css_shadow_value_finish_drawing (shadow, cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
cairo_pattern_destroy (pattern);
|
||||
@@ -618,18 +567,16 @@ draw_shadow (const GtkCssValue *shadow,
|
||||
cairo_t *cr,
|
||||
GtkRoundedBox *box,
|
||||
GtkRoundedBox *clip_box,
|
||||
GtkBlurFlags blur_flags)
|
||||
gboolean blur)
|
||||
{
|
||||
cairo_t *shadow_cr;
|
||||
gboolean do_blur;
|
||||
|
||||
if (has_empty_clip (cr))
|
||||
return;
|
||||
|
||||
gdk_cairo_set_source_rgba (cr, _gtk_css_rgba_value_get_rgba (shadow->color));
|
||||
do_blur = (blur_flags & (GTK_BLUR_X | GTK_BLUR_Y)) != 0;
|
||||
if (do_blur)
|
||||
shadow_cr = gtk_css_shadow_value_start_drawing (shadow, cr, blur_flags);
|
||||
if (blur)
|
||||
shadow_cr = gtk_css_shadow_value_start_drawing (shadow, cr);
|
||||
else
|
||||
shadow_cr = cr;
|
||||
|
||||
@@ -640,8 +587,8 @@ draw_shadow (const GtkCssValue *shadow,
|
||||
|
||||
cairo_fill (shadow_cr);
|
||||
|
||||
if (do_blur)
|
||||
gtk_css_shadow_value_finish_drawing (shadow, shadow_cr, blur_flags);
|
||||
if (blur)
|
||||
gtk_css_shadow_value_finish_drawing (shadow, shadow_cr);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -697,7 +644,7 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
|
||||
_gtk_rounded_box_shrink (&clip_box, -clip_radius, -clip_radius, -clip_radius, -clip_radius);
|
||||
|
||||
if (!needs_blur (shadow))
|
||||
draw_shadow (shadow, cr, &box, &clip_box, GTK_BLUR_NONE);
|
||||
draw_shadow (shadow, cr, &box, &clip_box, FALSE);
|
||||
else
|
||||
{
|
||||
int i, x1, x2, y1, y2;
|
||||
@@ -767,7 +714,7 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
|
||||
/* Also clip with remaining to ensure we never draw any area twice */
|
||||
gdk_cairo_region (cr, remaining);
|
||||
cairo_clip (cr);
|
||||
draw_shadow (shadow, cr, &box, &clip_box, GTK_BLUR_X | GTK_BLUR_Y);
|
||||
draw_shadow (shadow, cr, &box, &clip_box, TRUE);
|
||||
cairo_restore (cr);
|
||||
|
||||
/* We drew the region, remove it from remaining */
|
||||
@@ -781,11 +728,8 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
|
||||
/* Then the sides */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
GtkBlurFlags blur_flags = GTK_BLUR_REPEAT;
|
||||
|
||||
if (i == GTK_CSS_TOP || i == GTK_CSS_BOTTOM)
|
||||
{
|
||||
blur_flags |= GTK_BLUR_Y;
|
||||
x1 = floor (box.box.x - clip_radius);
|
||||
x2 = ceil (box.box.x + box.box.width + clip_radius);
|
||||
}
|
||||
@@ -802,7 +746,6 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
|
||||
|
||||
if (i == GTK_CSS_LEFT || i == GTK_CSS_RIGHT)
|
||||
{
|
||||
blur_flags |= GTK_BLUR_X;
|
||||
y1 = floor (box.box.y - clip_radius);
|
||||
y2 = ceil (box.box.y + box.box.height + clip_radius);
|
||||
}
|
||||
@@ -823,7 +766,7 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
|
||||
/* Also clip with remaining to ensure we never draw any area twice */
|
||||
gdk_cairo_region (cr, remaining);
|
||||
cairo_clip (cr);
|
||||
draw_shadow (shadow, cr, &box, &clip_box, blur_flags);
|
||||
draw_shadow (shadow, cr, &box, &clip_box, TRUE);
|
||||
cairo_restore (cr);
|
||||
|
||||
/* We drew the region, remove it from remaining */
|
||||
@@ -839,7 +782,7 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
|
||||
cairo_save (cr);
|
||||
gdk_cairo_region (cr, remaining);
|
||||
cairo_clip (cr);
|
||||
draw_shadow (shadow, cr, &box, &clip_box, GTK_BLUR_NONE);
|
||||
draw_shadow (shadow, cr, &box, &clip_box, FALSE);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_region_destroy (remaining);
|
||||
|
||||
+1
-116
@@ -66,28 +66,6 @@ gtk_css_static_style_get_section (GtkCssStyle *style,
|
||||
return g_ptr_array_index (sstyle->sections, id);
|
||||
}
|
||||
|
||||
/* Compute the bitmask of potentially changed properties if the parent has changed
|
||||
* the passed in ones.
|
||||
* This is for example needed when changes in the "color" property will affect
|
||||
* all properties using "currentColor" as a color.
|
||||
*/
|
||||
static GtkBitmask *
|
||||
gtk_css_static_style_compute_dependencies (GtkCssStaticStyle *style,
|
||||
const GtkBitmask *parent_changes)
|
||||
{
|
||||
GtkCssStaticStyle *sstyle = GTK_CSS_STATIC_STYLE (style);
|
||||
GtkBitmask *changes;
|
||||
|
||||
changes = _gtk_bitmask_copy (parent_changes);
|
||||
changes = _gtk_bitmask_intersect (changes, sstyle->depends_on_parent);
|
||||
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_COLOR))
|
||||
changes = _gtk_bitmask_union (changes, sstyle->depends_on_color);
|
||||
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_FONT_SIZE))
|
||||
changes = _gtk_bitmask_union (changes, sstyle->depends_on_font_size);
|
||||
|
||||
return changes;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_static_style_dispose (GObject *object)
|
||||
{
|
||||
@@ -107,19 +85,6 @@ gtk_css_static_style_dispose (GObject *object)
|
||||
G_OBJECT_CLASS (gtk_css_static_style_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_static_style_finalize (GObject *object)
|
||||
{
|
||||
GtkCssStaticStyle *style = GTK_CSS_STATIC_STYLE (object);
|
||||
|
||||
_gtk_bitmask_free (style->depends_on_parent);
|
||||
_gtk_bitmask_free (style->equals_parent);
|
||||
_gtk_bitmask_free (style->depends_on_color);
|
||||
_gtk_bitmask_free (style->depends_on_font_size);
|
||||
|
||||
G_OBJECT_CLASS (gtk_css_static_style_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
|
||||
{
|
||||
@@ -127,7 +92,6 @@ gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
|
||||
GtkCssStyleClass *style_class = GTK_CSS_STYLE_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_css_static_style_dispose;
|
||||
object_class->finalize = gtk_css_static_style_finalize;
|
||||
|
||||
style_class->get_value = gtk_css_static_style_get_value;
|
||||
style_class->get_section = gtk_css_static_style_get_section;
|
||||
@@ -136,10 +100,6 @@ gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
|
||||
static void
|
||||
gtk_css_static_style_init (GtkCssStaticStyle *style)
|
||||
{
|
||||
style->depends_on_parent = _gtk_bitmask_new ();
|
||||
style->equals_parent = _gtk_bitmask_new ();
|
||||
style->depends_on_color = _gtk_bitmask_new ();
|
||||
style->depends_on_font_size = _gtk_bitmask_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -235,71 +195,6 @@ gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
|
||||
return GTK_CSS_STYLE (result);
|
||||
}
|
||||
|
||||
GtkCssStyle *
|
||||
gtk_css_static_style_new_update (GtkCssStaticStyle *style,
|
||||
const GtkBitmask *parent_changes,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
GtkCssStyle *parent)
|
||||
{
|
||||
GtkCssStaticStyle *result;
|
||||
GtkCssLookup *lookup;
|
||||
GtkBitmask *changes;
|
||||
guint i;
|
||||
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_STATIC_STYLE (style), NULL);
|
||||
gtk_internal_return_val_if_fail (parent_changes != NULL, NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
||||
gtk_internal_return_val_if_fail (matcher != NULL, NULL);
|
||||
|
||||
changes = gtk_css_static_style_compute_dependencies (style, parent_changes);
|
||||
if (_gtk_bitmask_is_empty (changes))
|
||||
{
|
||||
_gtk_bitmask_free (changes);
|
||||
return g_object_ref (style);
|
||||
}
|
||||
|
||||
result = g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
|
||||
|
||||
result->change = style->change;
|
||||
result->depends_on_parent = _gtk_bitmask_subtract (_gtk_bitmask_union (result->depends_on_parent, style->depends_on_parent),
|
||||
changes);
|
||||
result->equals_parent = _gtk_bitmask_subtract (_gtk_bitmask_union (result->equals_parent, style->equals_parent),
|
||||
changes);
|
||||
result->depends_on_color = _gtk_bitmask_subtract (_gtk_bitmask_union (result->depends_on_color, style->depends_on_color),
|
||||
changes);
|
||||
result->depends_on_font_size = _gtk_bitmask_subtract (_gtk_bitmask_union (result->depends_on_font_size, style->depends_on_font_size),
|
||||
changes);
|
||||
|
||||
for (i = 0; i < style->values->len; i++)
|
||||
{
|
||||
if (_gtk_bitmask_get (changes, i))
|
||||
continue;
|
||||
|
||||
gtk_css_static_style_set_value (result,
|
||||
i,
|
||||
gtk_css_static_style_get_value (GTK_CSS_STYLE (style), i),
|
||||
gtk_css_static_style_get_section (GTK_CSS_STYLE (style), i));
|
||||
}
|
||||
|
||||
lookup = _gtk_css_lookup_new (changes);
|
||||
|
||||
_gtk_style_provider_private_lookup (provider,
|
||||
matcher,
|
||||
lookup,
|
||||
NULL);
|
||||
|
||||
_gtk_css_lookup_resolve (lookup,
|
||||
provider,
|
||||
result,
|
||||
parent);
|
||||
|
||||
_gtk_css_lookup_free (lookup);
|
||||
_gtk_bitmask_free (changes);
|
||||
|
||||
return GTK_CSS_STYLE (result);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
@@ -308,7 +203,6 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section)
|
||||
{
|
||||
GtkCssDependencies dependencies;
|
||||
GtkCssValue *value;
|
||||
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_STATIC_STYLE (style));
|
||||
@@ -332,19 +226,10 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
else
|
||||
_gtk_css_value_ref (specified);
|
||||
|
||||
value = _gtk_css_value_compute (specified, id, provider, GTK_CSS_STYLE (style), parent_style, &dependencies);
|
||||
value = _gtk_css_value_compute (specified, id, provider, GTK_CSS_STYLE (style), parent_style);
|
||||
|
||||
gtk_css_static_style_set_value (style, id, value, section);
|
||||
|
||||
if (dependencies & (GTK_CSS_DEPENDS_ON_PARENT | GTK_CSS_EQUALS_PARENT))
|
||||
style->depends_on_parent = _gtk_bitmask_set (style->depends_on_parent, id, TRUE);
|
||||
if (dependencies & (GTK_CSS_EQUALS_PARENT))
|
||||
style->equals_parent = _gtk_bitmask_set (style->equals_parent, id, TRUE);
|
||||
if (dependencies & (GTK_CSS_DEPENDS_ON_COLOR))
|
||||
style->depends_on_color = _gtk_bitmask_set (style->depends_on_color, id, TRUE);
|
||||
if (dependencies & (GTK_CSS_DEPENDS_ON_FONT_SIZE))
|
||||
style->depends_on_font_size = _gtk_bitmask_set (style->depends_on_font_size, id, TRUE);
|
||||
|
||||
_gtk_css_value_unref (value);
|
||||
_gtk_css_value_unref (specified);
|
||||
}
|
||||
|
||||
@@ -42,11 +42,6 @@ struct _GtkCssStaticStyle
|
||||
GPtrArray *values; /* the values */
|
||||
GPtrArray *sections; /* sections the values are defined in */
|
||||
|
||||
GtkBitmask *depends_on_parent; /* values that depend on parent values */
|
||||
GtkBitmask *equals_parent; /* values that equal their parent values */
|
||||
GtkBitmask *depends_on_color; /* values that depend on the color property */
|
||||
GtkBitmask *depends_on_font_size; /* values that depend on the font-size property */
|
||||
|
||||
GtkCssChange change; /* change as returned by value lookup */
|
||||
};
|
||||
|
||||
@@ -61,11 +56,6 @@ GtkCssStyle * gtk_css_static_style_get_default (void);
|
||||
GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
GtkCssStyle *parent);
|
||||
GtkCssStyle * gtk_css_static_style_new_update (GtkCssStaticStyle *style,
|
||||
const GtkBitmask *parent_changes,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
GtkCssStyle *parent);
|
||||
|
||||
void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkStyleProviderPrivate*provider,
|
||||
|
||||
@@ -38,8 +38,7 @@ gtk_css_value_string_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssDependencies *dependencies)
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
@@ -46,10 +46,17 @@ gtk_css_style_real_get_section (GtkCssStyle *style,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_style_real_is_static (GtkCssStyle *style)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_style_class_init (GtkCssStyleClass *klass)
|
||||
{
|
||||
klass->get_section = gtk_css_style_real_get_section;
|
||||
klass->is_static = gtk_css_style_real_is_static;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -82,6 +89,9 @@ gtk_css_style_get_difference (GtkCssStyle *style,
|
||||
GtkBitmask *result;
|
||||
guint i, len;
|
||||
|
||||
if (style == other)
|
||||
return _gtk_bitmask_new ();
|
||||
|
||||
result = _gtk_bitmask_new ();
|
||||
len = _gtk_css_style_property_get_n_properties ();
|
||||
for (i = 0; i < len; i++)
|
||||
@@ -94,6 +104,15 @@ gtk_css_style_get_difference (GtkCssStyle *style,
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_style_is_static (GtkCssStyle *style)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), TRUE);
|
||||
|
||||
return GTK_CSS_STYLE_GET_CLASS (style)->is_static (style);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gtk_css_style_print (GtkCssStyle *style,
|
||||
GString *string)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user