forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master Closes #2743 See merge request GNOME/gtk!2161
This commit is contained in:
commit
c4b2112f16
@ -1197,16 +1197,6 @@ main (int argc, char **argv)
|
||||
};
|
||||
int i;
|
||||
|
||||
/* Most code in gtk-demo is intended to be exemplary, but not
|
||||
* these few lines, which are just a hack so gtk-demo will work
|
||||
* in the GTK tree without installing it.
|
||||
*/
|
||||
if (g_file_test ("../../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
||||
{
|
||||
g_setenv ("GTK_IM_MODULE_FILE", "../../modules/input/immodules.cache", TRUE);
|
||||
}
|
||||
/* -- End of hack -- */
|
||||
|
||||
app = gtk_application_new ("org.gtk.Demo4", G_APPLICATION_NON_UNIQUE|G_APPLICATION_HANDLES_COMMAND_LINE);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
|
@ -378,7 +378,6 @@ gdk_device_get_state
|
||||
gdk_device_get_surface_at_position
|
||||
GdkTimeCoord
|
||||
gdk_device_get_axis
|
||||
gdk_device_get_axis_names
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_device_tool_get_serial
|
||||
@ -483,6 +482,7 @@ gdk_event_get_source_device
|
||||
gdk_event_get_device_tool
|
||||
gdk_event_get_time
|
||||
gdk_event_get_display
|
||||
gdk_event_get_seat
|
||||
GdkEventSequence
|
||||
gdk_event_get_event_sequence
|
||||
gdk_event_get_modifier_state
|
||||
|
@ -312,6 +312,8 @@ gtk_list_box_bind_model
|
||||
gtk_list_box_row_new
|
||||
gtk_list_box_row_changed
|
||||
gtk_list_box_row_is_selected
|
||||
gtk_list_box_row_get_child
|
||||
gtk_list_box_row_set_child
|
||||
gtk_list_box_row_get_header
|
||||
gtk_list_box_row_set_header
|
||||
gtk_list_box_row_get_index
|
||||
@ -459,6 +461,8 @@ gtk_list_item_set_child
|
||||
gtk_list_item_get_selected
|
||||
gtk_list_item_get_selectable
|
||||
gtk_list_item_set_selectable
|
||||
gtk_list_item_get_activatable
|
||||
gtk_list_item_set_activatable
|
||||
<SUBSECTION Standard>
|
||||
GTK_LIST_ITEM
|
||||
GTK_LIST_ITEM_CLASS
|
||||
@ -622,6 +626,7 @@ gtk_column_view_column_get_type
|
||||
<TITLE>GtkGridView</TITLE>
|
||||
GtkGridView
|
||||
gtk_grid_view_new
|
||||
gtk_grid_view_new_with_factory
|
||||
gtk_grid_view_set_model
|
||||
gtk_grid_view_get_model
|
||||
gtk_grid_view_set_max_columns
|
||||
@ -632,6 +637,8 @@ gtk_grid_view_set_single_click_activate
|
||||
gtk_grid_view_get_single_click_activate
|
||||
gtk_grid_view_set_enable_rubberband
|
||||
gtk_grid_view_get_enable_rubberband
|
||||
gtk_grid_view_set_factory
|
||||
gtk_grid_view_get_factory
|
||||
<SUBSECTION Standard>
|
||||
GTK_GRID_VIEW
|
||||
GTK_GRID_VIEW_CLASS
|
||||
@ -1471,8 +1478,6 @@ gtk_filter_get_strictness
|
||||
<SUBSECTION>
|
||||
GtkFilterChange
|
||||
gtk_filter_changed
|
||||
<SUBSECTION>
|
||||
gtk_custom_filter_new
|
||||
<SUBSECTION Standard>
|
||||
GTK_FILTER
|
||||
GTK_IS_FILTER
|
||||
@ -1490,6 +1495,7 @@ gtk_filter_get_type
|
||||
GtkCustomFilter
|
||||
GtkCustomFilterFunc
|
||||
gtk_custom_filter_new
|
||||
gtk_custom_filter_set_filter_func
|
||||
<SUBSECTION Standard>
|
||||
GTK_CUSTOM_FILTER
|
||||
GTK_IS_CUSTOM_FILTER
|
||||
@ -1553,6 +1559,9 @@ gtk_fixed_new
|
||||
gtk_fixed_put
|
||||
gtk_fixed_remove
|
||||
gtk_fixed_move
|
||||
gtk_fixed_get_child_position
|
||||
gtk_fixed_get_child_transform
|
||||
gtk_fixed_set_child_transform
|
||||
<SUBSECTION Standard>
|
||||
GTK_FIXED
|
||||
GTK_IS_FIXED
|
||||
@ -2766,6 +2775,8 @@ gtk_numeric_sorter_get_type
|
||||
<TITLE>GtkCustomSorter</TITLE>
|
||||
GtkCustomSorter
|
||||
gtk_custom_sorter_new
|
||||
|
||||
gtk_custom_sorter_set_sort_func
|
||||
<SUBSECTION Standard>
|
||||
GTK_CUSTOM_SORTER
|
||||
GTK_IS_CUSTOM_SORTER
|
||||
|
@ -4,9 +4,10 @@
|
||||
|
||||
GTK inspects a number of environment variables in addition to
|
||||
standard variables like `LANG`, `PATH`, `HOME` or `DISPLAY`; mostly
|
||||
to determine paths to look for certain files. The [X11]{#x11-envar},
|
||||
[Windows]{#win32-envar} and [Broadway]{#broadway-envar} GDK backends
|
||||
use some additional environment variables.
|
||||
to determine paths to look for certain files. The [X11](#x11-envar),
|
||||
[Wayland](#wayland-envar), [Windows](#win32-envar) and
|
||||
[Broadway](#broadway-envar) GDK backends use some additional
|
||||
environment variables.
|
||||
|
||||
### GTK_DEBUG {#GTK_Debug-Options}
|
||||
|
||||
|
@ -7,4 +7,13 @@ the Wayland backend by setting `GDK_BACKEND=wayland`.
|
||||
On UNIX, the Wayland backend is enabled by default, so you don't need to
|
||||
do anything special when compiling it, and everything should "just work."
|
||||
|
||||
Currently, the Wayland backend does not use any additional environment variables.
|
||||
## Wayland-specific environment variables {#wayland-envar}
|
||||
|
||||
### WAYLAND_DISPLAY
|
||||
|
||||
Specifies the name of the Wayland display to use. Typically, wayland-0
|
||||
or wayland-1.
|
||||
|
||||
### XDG_RUNTIME_DIR
|
||||
|
||||
Used to locate the Wayland socket to use.
|
||||
|
@ -16,7 +16,6 @@ variables.
|
||||
### GDK_IGNORE_WINTAB
|
||||
|
||||
If this variable is set, GTK doesn't use the Wintab API for tablet support.
|
||||
</para>
|
||||
|
||||
### GDK_USE_WINTAB
|
||||
|
||||
@ -37,10 +36,10 @@ can override GTK settings in the `settings.ini` file or at runtime in the
|
||||
GTK Inspector.
|
||||
|
||||
Themes are loaded from normal Windows variants of the XDG locations:
|
||||
`%HOME%/icons/THEME/cursors`,
|
||||
`%APPDATA%/icons/THEME/cursors`,
|
||||
`%HOME%/icons/THEME/cursors`,
|
||||
`%APPDATA%/icons/THEME/cursors`,
|
||||
`RUNTIME_PREFIX/share/icons/THEME/cursors`
|
||||
|
||||
The `gtk-cursor-theme-size`> setting is ignored, GTK will use
|
||||
The `gtk-cursor-theme-size` setting is ignored, GTK will use
|
||||
the cursor size that Windows tells it to use.
|
||||
|
||||
|
@ -40,4 +40,15 @@ void gdk_surface_set_widget (GdkSurface *surface,
|
||||
gpointer widget);
|
||||
gpointer gdk_surface_get_widget (GdkSurface *surface);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *key;
|
||||
guint value;
|
||||
const char *help;
|
||||
} GdkDebugKey;
|
||||
|
||||
guint gdk_parse_debug_var (const char *variable,
|
||||
const GdkDebugKey *keys,
|
||||
guint nkeys);
|
||||
|
||||
#endif /* __GDK__PRIVATE_H__ */
|
||||
|
146
gdk/gdk.c
146
gdk/gdk.c
@ -42,6 +42,8 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <fribidi.h>
|
||||
|
||||
@ -128,28 +130,28 @@ static int gdk_initialized = 0; /* 1 if the library is initi
|
||||
*/
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const GDebugKey gdk_debug_keys[] = {
|
||||
{ "misc", GDK_DEBUG_MISC },
|
||||
{ "events", GDK_DEBUG_EVENTS },
|
||||
{ "dnd", GDK_DEBUG_DND },
|
||||
{ "input", GDK_DEBUG_INPUT },
|
||||
{ "eventloop", GDK_DEBUG_EVENTLOOP },
|
||||
{ "frames", GDK_DEBUG_FRAMES },
|
||||
{ "settings", GDK_DEBUG_SETTINGS },
|
||||
{ "opengl", GDK_DEBUG_OPENGL },
|
||||
{ "vulkan", GDK_DEBUG_VULKAN },
|
||||
{ "selection", GDK_DEBUG_SELECTION },
|
||||
{ "clipboard", GDK_DEBUG_CLIPBOARD },
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE },
|
||||
{ "gl-software", GDK_DEBUG_GL_SOFTWARE },
|
||||
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS },
|
||||
static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "misc", GDK_DEBUG_MISC, "Miscellaneous information" },
|
||||
{ "events", GDK_DEBUG_EVENTS, "Information about events" },
|
||||
{ "dnd", GDK_DEBUG_DND, "Information about Drag-and-Drop" },
|
||||
{ "input", GDK_DEBUG_INPUT, "Information about input (Windows)" },
|
||||
{ "eventloop", GDK_DEBUG_EVENTLOOP, "Information about event loop operation (Quartz)" },
|
||||
{ "frames", GDK_DEBUG_FRAMES, "Information about the frame clock" },
|
||||
{ "settings", GDK_DEBUG_SETTINGS, "Information about xsettings" },
|
||||
{ "opengl", GDK_DEBUG_OPENGL, "Information about OpenGL" },
|
||||
{ "vulkan", GDK_DEBUG_VULKAN, "Information about Vulkan" },
|
||||
{ "selection", GDK_DEBUG_SELECTION, "Information about selections" },
|
||||
{ "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
|
||||
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Use a GLES OpenGL context" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -199,6 +201,93 @@ gdk_ensure_resources (void)
|
||||
g_once (®ister_resources_once, register_resources, NULL);
|
||||
}
|
||||
|
||||
guint
|
||||
gdk_parse_debug_var (const char *variable,
|
||||
const GdkDebugKey *keys,
|
||||
guint nkeys)
|
||||
{
|
||||
guint i;
|
||||
guint result = 0;
|
||||
const char *string;
|
||||
const gchar *p;
|
||||
const gchar *q;
|
||||
gboolean invert;
|
||||
gboolean help;
|
||||
|
||||
string = g_getenv (variable);
|
||||
if (string == NULL)
|
||||
return 0;
|
||||
|
||||
p = string;
|
||||
invert = FALSE;
|
||||
help = FALSE;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
q = strpbrk (p, ":;, \t");
|
||||
if (!q)
|
||||
q = p + strlen (p);
|
||||
|
||||
if (3 == q - p && g_ascii_strncasecmp ("all", p, q - p) == 0)
|
||||
{
|
||||
invert = TRUE;
|
||||
}
|
||||
else if (4 == q - p && g_ascii_strncasecmp ("help", p, q - p) == 0)
|
||||
{
|
||||
help = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nkeys; i++)
|
||||
{
|
||||
if (strlen (keys[i].key) == q - p &&
|
||||
g_ascii_strncasecmp (keys[i].key, p, q - p) == 0)
|
||||
{
|
||||
result |= keys[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == nkeys)
|
||||
{
|
||||
char *val = g_strndup (p, q - p);
|
||||
fprintf (stderr, "Unrecognized value \"%s\". Try %s=help\n", val, variable);
|
||||
g_free (val);
|
||||
}
|
||||
}
|
||||
|
||||
p = q;
|
||||
if (*p)
|
||||
p++;
|
||||
}
|
||||
|
||||
if (help)
|
||||
{
|
||||
int max_width = 4;
|
||||
for (i = 0; i < nkeys; i++)
|
||||
max_width = MAX (max_width, strlen (keys[i].key));
|
||||
max_width += 4;
|
||||
|
||||
fprintf (stderr, "Supported %s values:\n", variable);
|
||||
for (i = 0; i < nkeys; i++)
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values");
|
||||
fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help");
|
||||
fprintf (stderr, "\nMultiple values can be given, separated by : or space.\n");
|
||||
}
|
||||
|
||||
if (invert)
|
||||
{
|
||||
guint all_flags = 0;
|
||||
|
||||
for (i = 0; i < nkeys; i++)
|
||||
all_flags |= keys[i].value;
|
||||
|
||||
result = all_flags & (~result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_pre_parse (void)
|
||||
{
|
||||
@ -207,13 +296,12 @@ gdk_pre_parse (void)
|
||||
gdk_ensure_resources ();
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
{
|
||||
gchar *debug_string = getenv("GDK_DEBUG");
|
||||
if (debug_string != NULL)
|
||||
_gdk_debug_flags = g_parse_debug_string (debug_string,
|
||||
(GDebugKey *) gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
}
|
||||
_gdk_debug_flags = gdk_parse_debug_var ("GDK_DEBUG",
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
#else
|
||||
if (g_getenv ("GDK_DEBUG"))
|
||||
g_warning ("GDK_DEBUG set but ignored because GTK isn't built with G_ENABLE_DEBUG");
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
if (g_getenv ("GTK_TRACE_FD"))
|
||||
|
@ -43,14 +43,12 @@ typedef struct _GdkTimeCoord GdkTimeCoord;
|
||||
* @GDK_SOURCE_CURSOR: the device is a graphics tablet “puck” or similar device.
|
||||
* @GDK_SOURCE_KEYBOARD: the device is a keyboard.
|
||||
* @GDK_SOURCE_TOUCHSCREEN: the device is a direct-input touch device, such
|
||||
* as a touchscreen or tablet. This device type has been added in 3.4.
|
||||
* as a touchscreen or tablet
|
||||
* @GDK_SOURCE_TOUCHPAD: the device is an indirect touch device, such
|
||||
* as a touchpad. This device type has been added in 3.4.
|
||||
* @GDK_SOURCE_TRACKPOINT: the device is a trackpoint. This device type has been
|
||||
* added in 3.22
|
||||
* as a touchpad
|
||||
* @GDK_SOURCE_TRACKPOINT: the device is a trackpoint
|
||||
* @GDK_SOURCE_TABLET_PAD: the device is a "pad", a collection of buttons,
|
||||
* rings and strips found in drawing tablets. This device type has been
|
||||
* added in 3.22.
|
||||
* rings and strips found in drawing tablets
|
||||
*
|
||||
* An enumeration describing the type of an input device in general terms.
|
||||
*/
|
||||
|
@ -1187,7 +1187,7 @@ gdk_event_get_surface (GdkEvent *event)
|
||||
|
||||
/**
|
||||
* gdk_event_get_seat:
|
||||
* @event: a #GdkEvent.
|
||||
* @event: a #GdkEvent
|
||||
*
|
||||
* Returns the seat that originated the event.
|
||||
*
|
||||
|
@ -2079,6 +2079,9 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
|
||||
{
|
||||
TranslationEntry *entry;
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, DEFAULT_SETTINGS))
|
||||
return FALSE;
|
||||
|
||||
if (GDK_WAYLAND_DISPLAY (display)->settings != NULL &&
|
||||
g_hash_table_size (GDK_WAYLAND_DISPLAY (display)->settings) == 0)
|
||||
return FALSE;
|
||||
|
@ -1,21 +1,22 @@
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gdk/gdk-private.h"
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const GDebugKey gsk_debug_keys[] = {
|
||||
{ "renderer", GSK_DEBUG_RENDERER },
|
||||
{ "cairo", GSK_DEBUG_CAIRO },
|
||||
{ "opengl", GSK_DEBUG_OPENGL },
|
||||
{ "shaders", GSK_DEBUG_SHADERS },
|
||||
{ "surface", GSK_DEBUG_SURFACE },
|
||||
{ "vulkan", GSK_DEBUG_VULKAN },
|
||||
{ "fallback", GSK_DEBUG_FALLBACK },
|
||||
{ "glyphcache", GSK_DEBUG_GLYPH_CACHE },
|
||||
{ "diff", GSK_DEBUG_DIFF },
|
||||
{ "geometry", GSK_DEBUG_GEOMETRY },
|
||||
{ "full-redraw", GSK_DEBUG_FULL_REDRAW},
|
||||
{ "sync", GSK_DEBUG_SYNC },
|
||||
{ "vulkan-staging-image", GSK_DEBUG_VULKAN_STAGING_IMAGE },
|
||||
{ "vulkan-staging-buffer", GSK_DEBUG_VULKAN_STAGING_BUFFER }
|
||||
static const GdkDebugKey gsk_debug_keys[] = {
|
||||
{ "renderer", GSK_DEBUG_RENDERER, "General renderer information" },
|
||||
{ "cairo", GSK_DEBUG_CAIRO, "Cairo renderer information" },
|
||||
{ "opengl", GSK_DEBUG_OPENGL, "OpenGL renderer information" },
|
||||
{ "vulkan", GSK_DEBUG_VULKAN, "Vulkan renderer information" },
|
||||
{ "shaders", GSK_DEBUG_SHADERS, "Information about shaders" },
|
||||
{ "surface", GSK_DEBUG_SURFACE, "Information about surfaces" },
|
||||
{ "fallback", GSK_DEBUG_FALLBACK, "Information about fallbacks" },
|
||||
{ "glyphcache", GSK_DEBUG_GLYPH_CACHE, "Information about glyph caching" },
|
||||
{ "diff", GSK_DEBUG_DIFF, "Show differences" },
|
||||
{ "geometry", GSK_DEBUG_GEOMETRY, "Show borders" },
|
||||
{ "full-redraw", GSK_DEBUG_FULL_REDRAW, "Force full redraws" },
|
||||
{ "sync", GSK_DEBUG_SYNC, "Sync after each frame" },
|
||||
{ "vulkan-staging-image", GSK_DEBUG_VULKAN_STAGING_IMAGE, "Use a staging image for Vulkan texture upload" },
|
||||
{ "vulkan-staging-buffer", GSK_DEBUG_VULKAN_STAGING_BUFFER, "Use a staging buffer for Vulkan texture upload" }
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -29,11 +30,9 @@ init_debug_flags (void)
|
||||
|
||||
if (g_once_init_enter (&gsk_debug_flags__set))
|
||||
{
|
||||
const char *env = g_getenv ("GSK_DEBUG");
|
||||
|
||||
gsk_debug_flags = g_parse_debug_string (env,
|
||||
(GDebugKey *) gsk_debug_keys,
|
||||
G_N_ELEMENTS (gsk_debug_keys));
|
||||
gsk_debug_flags = gdk_parse_debug_var ("GSK_DEBUG",
|
||||
gsk_debug_keys,
|
||||
G_N_ELEMENTS (gsk_debug_keys));
|
||||
|
||||
g_once_init_leave (&gsk_debug_flags__set, TRUE);
|
||||
}
|
||||
|
8
gtk.supp
8
gtk.supp
@ -269,3 +269,11 @@
|
||||
...
|
||||
fun:g_quark_*
|
||||
}
|
||||
{
|
||||
glib GQuark
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: definite
|
||||
fun:malloc
|
||||
...
|
||||
fun:g_intern_static_string
|
||||
}
|
||||
|
@ -25,9 +25,9 @@
|
||||
|
||||
/**
|
||||
* SECTION:gtkbitset
|
||||
* @Short_description: Sets of integers
|
||||
* @Title: GtkBitset
|
||||
* @See_also: GtkSelectionModel
|
||||
* @title: GtkBitset
|
||||
* @short_description: Sets of integers
|
||||
* @see_also: GtkSelectionModel
|
||||
*
|
||||
* #GtkBitset is a data structure for representing a set of unsigned integers.
|
||||
* Another name for this data structure is "bitmap".
|
||||
@ -42,7 +42,8 @@
|
||||
* The fastest way to iterate values in a bitset is #GtkBitsetIter which allows
|
||||
* quick iteration of all the values in a bitset.
|
||||
*
|
||||
* The main use case #GtkBitset is implementing complex selections for #GtkSelectionModel.
|
||||
* The main use case for #GtkBitset is implementing complex selections for
|
||||
* #GtkSelectionModel.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -273,7 +274,7 @@ gtk_bitset_add (GtkBitset *self,
|
||||
* @self: a #GtkBitset
|
||||
* @value: value to add
|
||||
*
|
||||
* Adds @value to @self if it wasn't part of it before.
|
||||
* Removes @value from @self if it was part of it before.
|
||||
*
|
||||
* Returns: %TRUE if @value was part of @self and @self
|
||||
* was changed.
|
||||
@ -293,8 +294,8 @@ gtk_bitset_remove (GtkBitset *self,
|
||||
* @start: first value to add
|
||||
* @n_items: number of consecutive values to add
|
||||
*
|
||||
* Adds all values from @start (inclusive) to @start + @n_items (exclusive)
|
||||
* in @self.
|
||||
* Adds all values from @start (inclusive) to @start + @n_items
|
||||
* (exclusive) in @self.
|
||||
**/
|
||||
void
|
||||
gtk_bitset_add_range (GtkBitset *self,
|
||||
@ -343,8 +344,8 @@ gtk_bitset_remove_range (GtkBitset *self,
|
||||
* @first: first value to add
|
||||
* @last: last value to add
|
||||
*
|
||||
* Adds the closed range [@first, @last], so @first, @last and all values inbetween.
|
||||
* @first must be smaller than @last.
|
||||
* Adds the closed range [@first, @last], so @first, @last and all
|
||||
* values inbetween. @first must be smaller than @last.
|
||||
**/
|
||||
void
|
||||
gtk_bitset_add_range_closed (GtkBitset *self,
|
||||
@ -363,8 +364,8 @@ gtk_bitset_add_range_closed (GtkBitset *self,
|
||||
* @first: first value to remove
|
||||
* @last: last value to remove
|
||||
*
|
||||
* Removes the closed range [@first, @last], so @first, @last and all values inbetween.
|
||||
* @first must be smaller than @last.
|
||||
* Removes the closed range [@first, @last], so @first, @last and all
|
||||
* values inbetween. @first must be smaller than @last.
|
||||
**/
|
||||
void
|
||||
gtk_bitset_remove_range_closed (GtkBitset *self,
|
||||
@ -383,7 +384,7 @@ gtk_bitset_remove_range_closed (GtkBitset *self,
|
||||
* @start: first value to add
|
||||
* @width: width of the rectangle
|
||||
* @height: height of the rectangle
|
||||
* @stride: rowstride of the rectangle
|
||||
* @stride: row stride of the grid
|
||||
*
|
||||
* Interprets the values as a 2-dimensional boolean grid with the given @stride
|
||||
* and inside that grid, adds a rectangle with the given @width and @height.
|
||||
@ -414,7 +415,7 @@ gtk_bitset_add_rectangle (GtkBitset *self,
|
||||
* @start: first value to remove
|
||||
* @width: width of the rectangle
|
||||
* @height: height of the rectangle
|
||||
* @stride: rowstride of the rectangle
|
||||
* @stride: row stride of the grid
|
||||
*
|
||||
* Interprets the values as a 2-dimensional boolean grid with the given @stride
|
||||
* and inside that grid, removes a rectangle with the given @width and @height.
|
||||
@ -468,8 +469,8 @@ gtk_bitset_union (GtkBitset *self,
|
||||
* @self: a #GtkBitset
|
||||
* @other: the #GtkBitset to intersect with
|
||||
*
|
||||
* Sets @self to be the intersection of @self and @other, that is remove all values
|
||||
* from @self that are not part of @other.
|
||||
* Sets @self to be the intersection of @self and @other, that is remove
|
||||
* all values from @self that are not part of @other.
|
||||
*
|
||||
* It is allowed for @self and @other to be the same bitset. Nothing will
|
||||
* happen in that case.
|
||||
@ -579,7 +580,7 @@ gtk_bitset_shift_left (GtkBitset *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_bitset_shift_left:
|
||||
* gtk_bitset_shift_right:
|
||||
* @self: a $GtkBitset
|
||||
* @amount: amount to shift all values to the right
|
||||
*
|
||||
@ -603,8 +604,8 @@ gtk_bitset_shift_right (GtkBitset *self,
|
||||
original = gtk_bitset_copy (self);
|
||||
gtk_bitset_remove_all (self);
|
||||
|
||||
for (loop = gtk_bitset_iter_init_at (&iter, original, amount, &value);
|
||||
loop && value >= G_MAXUINT - amount;
|
||||
for (loop = gtk_bitset_iter_init_first (&iter, original, &value);
|
||||
loop && value <= G_MAXUINT - amount;
|
||||
loop = gtk_bitset_iter_next (&iter, &value))
|
||||
{
|
||||
gtk_bitset_add (self, value + amount);
|
||||
@ -629,7 +630,7 @@ gtk_bitset_shift_right (GtkBitset *self,
|
||||
*
|
||||
* Then, it "pastes" new room into the bitset by shifting all values
|
||||
* larger than @position by @added spaces to the right. This frees
|
||||
* up space that can then be filled using
|
||||
* up space that can then be filled.
|
||||
**/
|
||||
void
|
||||
gtk_bitset_slice (GtkBitset *self,
|
||||
@ -668,10 +669,10 @@ G_STATIC_ASSERT (sizeof (GtkBitsetIter) >= sizeof (roaring_uint32_iterator_t));
|
||||
* @value: (out) (optional): Set to the first value in @set
|
||||
*
|
||||
* Initializes an iterator for @set and points it to the first
|
||||
* value in @set. If @set is empty, %FALSE is returned and @value is set to
|
||||
* %G_MAXUINT.
|
||||
* value in @set. If @set is empty, %FALSE is returned and @value
|
||||
* is set to %G_MAXUINT.
|
||||
*
|
||||
* Returns: %TRUE if a @set isn't empty.
|
||||
* Returns: %TRUE if @set isn't empty.
|
||||
**/
|
||||
gboolean
|
||||
gtk_bitset_iter_init_first (GtkBitsetIter *iter,
|
||||
@ -700,7 +701,7 @@ gtk_bitset_iter_init_first (GtkBitsetIter *iter,
|
||||
* Initializes an iterator for @set and points it to the last
|
||||
* value in @set. If @set is empty, %FALSE is returned.
|
||||
*
|
||||
* Returns: %TRUE if a @set isn't empty.
|
||||
* Returns: %TRUE if @set isn't empty.
|
||||
**/
|
||||
gboolean
|
||||
gtk_bitset_iter_init_last (GtkBitsetIter *iter,
|
||||
@ -723,6 +724,7 @@ gtk_bitset_iter_init_last (GtkBitsetIter *iter,
|
||||
/**
|
||||
* gtk_bitset_iter_init_at:
|
||||
* @iter: a #GtkBitsetIter
|
||||
* @set: a #GtkBitset
|
||||
* @target: target value to start iterating at
|
||||
* @value: (out) (optional): Set to the found value in @set
|
||||
*
|
||||
@ -759,7 +761,7 @@ gtk_bitset_iter_init_at (GtkBitsetIter *iter,
|
||||
|
||||
/**
|
||||
* gtk_bitset_iter_next:
|
||||
* @iter: (out): a pointer to a valid #GtkBitsetIter
|
||||
* @iter: a pointer to a valid #GtkBitsetIter
|
||||
* @value: (out) (optional): Set to the next value
|
||||
*
|
||||
* Moves @iter to the next value in the set. If it was already
|
||||
@ -791,7 +793,7 @@ gtk_bitset_iter_next (GtkBitsetIter *iter,
|
||||
|
||||
/**
|
||||
* gtk_bitset_iter_previous:
|
||||
* @iter: (out): a pointer to a valid #GtkBitsetIter
|
||||
* @iter: a pointer to a valid #GtkBitsetIter
|
||||
* @value: (out) (optional): Set to the previous value
|
||||
*
|
||||
* Moves @iter to the previous value in the set. If it was already
|
||||
|
@ -45,15 +45,14 @@ typedef enum {
|
||||
GTK_DEBUG_BUILDER = 1 << 7,
|
||||
GTK_DEBUG_SIZE_REQUEST = 1 << 8,
|
||||
GTK_DEBUG_NO_CSS_CACHE = 1 << 9,
|
||||
GTK_DEBUG_SHORTCUTS = 1 << 10,
|
||||
GTK_DEBUG_INTERACTIVE = 1 << 11,
|
||||
GTK_DEBUG_TOUCHSCREEN = 1 << 12,
|
||||
GTK_DEBUG_ACTIONS = 1 << 13,
|
||||
GTK_DEBUG_RESIZE = 1 << 14,
|
||||
GTK_DEBUG_LAYOUT = 1 << 15,
|
||||
GTK_DEBUG_SNAPSHOT = 1 << 16,
|
||||
GTK_DEBUG_CONSTRAINTS = 1 << 17,
|
||||
GTK_DEBUG_BUILDER_OBJECTS = 1 << 18,
|
||||
GTK_DEBUG_INTERACTIVE = 1 << 10,
|
||||
GTK_DEBUG_TOUCHSCREEN = 1 << 11,
|
||||
GTK_DEBUG_ACTIONS = 1 << 12,
|
||||
GTK_DEBUG_RESIZE = 1 << 13,
|
||||
GTK_DEBUG_LAYOUT = 1 << 14,
|
||||
GTK_DEBUG_SNAPSHOT = 1 << 15,
|
||||
GTK_DEBUG_CONSTRAINTS = 1 << 16,
|
||||
GTK_DEBUG_BUILDER_OBJECTS = 1 << 17,
|
||||
} GtkDebugFlag;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
@ -159,26 +159,25 @@ DisplayDebugFlags debug_flags[N_DEBUG_DISPLAYS];
|
||||
gboolean any_display_debug_flags_set = FALSE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const GDebugKey gtk_debug_keys[] = {
|
||||
{ "text", GTK_DEBUG_TEXT },
|
||||
{ "tree", GTK_DEBUG_TREE },
|
||||
{ "keybindings", GTK_DEBUG_KEYBINDINGS },
|
||||
{ "modules", GTK_DEBUG_MODULES },
|
||||
{ "geometry", GTK_DEBUG_GEOMETRY },
|
||||
{ "icontheme", GTK_DEBUG_ICONTHEME },
|
||||
{ "printing", GTK_DEBUG_PRINTING} ,
|
||||
{ "builder", GTK_DEBUG_BUILDER },
|
||||
{ "builder-objects", GTK_DEBUG_BUILDER_OBJECTS },
|
||||
{ "size-request", GTK_DEBUG_SIZE_REQUEST },
|
||||
{ "no-css-cache", GTK_DEBUG_NO_CSS_CACHE },
|
||||
{ "shortcuts", GTK_DEBUG_SHORTCUTS },
|
||||
{ "interactive", GTK_DEBUG_INTERACTIVE },
|
||||
{ "touchscreen", GTK_DEBUG_TOUCHSCREEN },
|
||||
{ "actions", GTK_DEBUG_ACTIONS },
|
||||
{ "resize", GTK_DEBUG_RESIZE },
|
||||
{ "layout", GTK_DEBUG_LAYOUT },
|
||||
{ "snapshot", GTK_DEBUG_SNAPSHOT },
|
||||
{ "constraints", GTK_DEBUG_CONSTRAINTS },
|
||||
static const GdkDebugKey gtk_debug_keys[] = {
|
||||
{ "keybindings", GTK_DEBUG_KEYBINDINGS, "Information about keyboard shortcuts" },
|
||||
{ "modules", GTK_DEBUG_MODULES, "Information about modules and extensions" },
|
||||
{ "icontheme", GTK_DEBUG_ICONTHEME, "Information about icon themes" },
|
||||
{ "printing", GTK_DEBUG_PRINTING, "Information about printing" },
|
||||
{ "geometry", GTK_DEBUG_GEOMETRY, "Information about size allocation" },
|
||||
{ "size-request", GTK_DEBUG_SIZE_REQUEST, "Information about size requests" },
|
||||
{ "actions", GTK_DEBUG_ACTIONS, "Information about actions and menu models" },
|
||||
{ "constraints", GTK_DEBUG_CONSTRAINTS, "Information about constraints" },
|
||||
{ "text", GTK_DEBUG_TEXT, "Information about GtkTextView" },
|
||||
{ "tree", GTK_DEBUG_TREE, "Information about GtkTreeView" },
|
||||
{ "builder", GTK_DEBUG_BUILDER, "Trace GtkBuilder operation" },
|
||||
{ "builder-objects", GTK_DEBUG_BUILDER_OBJECTS, "Log unused GtkBuilder objects" },
|
||||
{ "no-css-cache", GTK_DEBUG_NO_CSS_CACHE, "Disable style property cache" },
|
||||
{ "interactive", GTK_DEBUG_INTERACTIVE, "Enable the GTK inspector" },
|
||||
{ "touchscreen", GTK_DEBUG_TOUCHSCREEN, "Pretend the pointer is a touchscreen" },
|
||||
{ "resize", GTK_DEBUG_RESIZE, "Highlight resizing widgets" },
|
||||
{ "layout", GTK_DEBUG_LAYOUT, "Show layout borders" },
|
||||
{ "snapshot", GTK_DEBUG_SNAPSHOT, "Generate debug render nodes" },
|
||||
};
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
@ -603,19 +602,15 @@ do_pre_parse_initialization (void)
|
||||
|
||||
gdk_pre_parse ();
|
||||
|
||||
env_string = g_getenv ("GTK_DEBUG");
|
||||
if (env_string != NULL)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
debug_flags[0].flags = g_parse_debug_string (env_string,
|
||||
gtk_debug_keys,
|
||||
G_N_ELEMENTS (gtk_debug_keys));
|
||||
any_display_debug_flags_set = debug_flags[0].flags > 0;
|
||||
debug_flags[0].flags = gdk_parse_debug_var ("GTK_DEBUG",
|
||||
gtk_debug_keys,
|
||||
G_N_ELEMENTS (gtk_debug_keys));
|
||||
any_display_debug_flags_set = debug_flags[0].flags > 0;
|
||||
#else
|
||||
g_warning ("GTK_DEBUG set but ignored because gtk isn't built with G_ENABLE_DEBUG");
|
||||
if (g_getenv ("GTK_DEBUG"))
|
||||
g_warning ("GTK_DEBUG set but ignored because GTK isn't built with G_ENABLE_DEBUG");
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
env_string = NULL;
|
||||
}
|
||||
|
||||
env_string = g_getenv ("GTK_SLOWDOWN");
|
||||
if (env_string)
|
||||
|
@ -27,18 +27,12 @@
|
||||
|
||||
/**
|
||||
* SECTION:gtkmultiselection
|
||||
* @Short_description: A selection model that allows selecting a multiple items
|
||||
* @Short_description: A selection model that allows selecting multiple items
|
||||
* @Title: GtkMultiSelection
|
||||
* @see_also: #GtkSelectionModel
|
||||
*
|
||||
* GtkMultiSelection is an implementation of the #GtkSelectionModel interface
|
||||
* that allows selecting multiple elements.
|
||||
*
|
||||
* Note that due to the way the selection is stored, newly added items are
|
||||
* always unselected, even if they were just removed from the model, and were
|
||||
* selected before. In particular this means that changing the sort order of
|
||||
* an underlying sort model will clear the selection. In other words, the
|
||||
* selection is *not persistent*.
|
||||
*/
|
||||
|
||||
struct _GtkMultiSelection
|
||||
|
@ -159,7 +159,7 @@ gtk_shortcut_action_activate (GtkShortcutAction *self,
|
||||
g_return_val_if_fail (GTK_IS_SHORTCUT_ACTION (self), FALSE);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
||||
|
||||
GTK_NOTE (SHORTCUTS, {
|
||||
GTK_NOTE (KEYBINDINGS, {
|
||||
char *act = gtk_shortcut_action_to_string (self);
|
||||
g_print ("Shortcut action activate on %s: %s\n", G_OBJECT_TYPE_NAME (widget), act);
|
||||
g_free (act);
|
||||
|
@ -31,12 +31,9 @@ G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* GtkSorterOrder:
|
||||
* @GTK_SORTER_ORDER_PARTIAL: A partial order. And #GtkOrdering is possible.
|
||||
* @GTK_SORTER_ORDER_INVALID: An invalid order. gtk_sorter_compare() will
|
||||
* always return %GTK_ORDERING_INVALID if both items are unequal.
|
||||
* @GTK_SORTER_ORDER_PARTIAL: A partial order. Any #GtkOrdering is possible.
|
||||
* @GTK_SORTER_ORDER_NONE: No order, all elements are considered equal.
|
||||
* gtk_sorter_compare() will only return %GTK_ORDERING_EQUAL or
|
||||
* %GTK_ORDERING_INVALID.
|
||||
* gtk_sorter_compare() will only return %GTK_ORDERING_EQUAL.
|
||||
* @GTK_SORTER_ORDER_TOTAL: A total order. gtk_sorter_compare() will only
|
||||
* return %GTK_ORDERING_EQUAL if an item is compared with itself. Two
|
||||
* different items will never cause this value to be returned.
|
||||
|
@ -1504,16 +1504,16 @@ gtk_stack_get_child_by_name (GtkStack *stack,
|
||||
|
||||
/**
|
||||
* gtk_stack_page_get_child:
|
||||
* @page: a #GtkStackPage
|
||||
* @self: a #GtkStackPage
|
||||
*
|
||||
* Returns the stack child to which @page belongs.
|
||||
* Returns the stack child to which @self belongs.
|
||||
*
|
||||
* Returns: (transfer none): the child to which @page belongs
|
||||
* Returns: (transfer none): the child to which @self belongs
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_stack_page_get_child (GtkStackPage *page)
|
||||
gtk_stack_page_get_child (GtkStackPage *self)
|
||||
{
|
||||
return page->widget;
|
||||
return self->widget;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2456,11 +2456,13 @@ gtk_stack_get_pages (GtkStack *stack)
|
||||
|
||||
/**
|
||||
* gtk_stack_page_get_visible:
|
||||
* @page: a #GtkStackPage
|
||||
* @self: a #GtkStackPage
|
||||
*
|
||||
* Returns whether @page is visible in its #GtkStack.
|
||||
* This is independent from the #GtkWidget:visible value of its
|
||||
* #GtkWidget.
|
||||
*
|
||||
* Returns: %TRUE if @page is visible
|
||||
*/
|
||||
gboolean
|
||||
gtk_stack_page_get_visible (GtkStackPage *self)
|
||||
@ -2472,7 +2474,7 @@ gtk_stack_page_get_visible (GtkStackPage *self)
|
||||
|
||||
/**
|
||||
* gtk_stack_page_set_visible:
|
||||
* @page: a #GtkStackPage
|
||||
* @self: a #GtkStackPage
|
||||
* @visible: The new property value
|
||||
*
|
||||
* Sets the new value of the #GtkStackPage:visible property
|
||||
|
@ -73,7 +73,7 @@ typedef enum {
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_stack_page_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_stack_page_get_child (GtkStackPage *page);
|
||||
GtkWidget * gtk_stack_page_get_child (GtkStackPage *self);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_stack_page_get_visible (GtkStackPage *self);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@ -146,11 +146,6 @@ void gtk_stack_set_visible_child_full (GtkStack
|
||||
const gchar *name,
|
||||
GtkStackTransitionType transition);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_stack_set_homogeneous (GtkStack *stack,
|
||||
gboolean homogeneous);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_stack_get_homogeneous (GtkStack *stack);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_stack_set_hhomogeneous (GtkStack *stack,
|
||||
gboolean hhomogeneous);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -587,7 +587,7 @@ gtk_string_list_remove (GtkStringList *self,
|
||||
/**
|
||||
* gtk_string_list_get_string:
|
||||
* @self: a #GtkStringList
|
||||
* @position:
|
||||
* @position: the position to get the string for
|
||||
*
|
||||
* Gets the string that is at @position in @self. @position
|
||||
* must be smaller than the current length of the list.
|
||||
|
@ -7539,9 +7539,11 @@ _gtk_widget_synthesize_crossing (GtkWidget *from,
|
||||
g_return_if_fail (from != NULL || to != NULL);
|
||||
|
||||
crossing.type = GTK_CROSSING_POINTER;
|
||||
crossing.old_target = from;
|
||||
crossing.new_target = to;
|
||||
crossing.mode = mode;
|
||||
crossing.old_target = from;
|
||||
crossing.old_descendent = NULL;
|
||||
crossing.new_target = to;
|
||||
crossing.new_descendent = NULL;
|
||||
|
||||
if (from)
|
||||
{
|
||||
|
@ -26,13 +26,6 @@ GArray *contents;
|
||||
|
||||
static char next_value = 'A';
|
||||
|
||||
static void
|
||||
test_init (void)
|
||||
{
|
||||
if (g_file_test ("../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
||||
g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE);
|
||||
}
|
||||
|
||||
G_GNUC_PRINTF (1, 2) static void
|
||||
combochange_log (const char *fmt,
|
||||
...)
|
||||
@ -200,8 +193,6 @@ main (int argc, char **argv)
|
||||
GtkWidget *combo;
|
||||
GtkCellRenderer *cell_renderer;
|
||||
|
||||
test_init ();
|
||||
|
||||
gtk_init ();
|
||||
|
||||
model = gtk_list_store_new (1, G_TYPE_STRING);
|
||||
|
@ -493,13 +493,6 @@ popsite_leave (GtkDropControllerMotion *motion)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_init (void)
|
||||
{
|
||||
if (g_file_test ("../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
||||
g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
quit_cb (GtkWidget *widget,
|
||||
gpointer data)
|
||||
@ -528,8 +521,6 @@ main (int argc, char **argv)
|
||||
GtkEventController *controller;
|
||||
gboolean done = FALSE;
|
||||
|
||||
test_init ();
|
||||
|
||||
gtk_init ();
|
||||
|
||||
window = gtk_window_new ();
|
||||
|
@ -5987,13 +5987,6 @@ create_main_window (void)
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
|
||||
static void
|
||||
test_init (void)
|
||||
{
|
||||
if (g_file_test ("../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
||||
g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE);
|
||||
}
|
||||
|
||||
static char *
|
||||
pad (const char *str, int to)
|
||||
{
|
||||
@ -6110,9 +6103,7 @@ main (int argc, char *argv[])
|
||||
|
||||
srand (time (NULL));
|
||||
|
||||
test_init ();
|
||||
|
||||
g_set_application_name ("GTK+ Test Program");
|
||||
g_set_application_name ("GTK Test Program");
|
||||
|
||||
#ifdef GTK_SRCDIR
|
||||
g_chdir (GTK_SRCDIR);
|
||||
|
@ -350,6 +350,74 @@ test_subtract (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_shift_left (void)
|
||||
{
|
||||
guint i, j, k, min, max;
|
||||
GtkBitset *iset, *testset;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (bitsets); i++)
|
||||
{
|
||||
iset = bitsets[i].create();
|
||||
|
||||
for (j = 1; j < 10000000; j *= 10)
|
||||
{
|
||||
testset = gtk_bitset_copy (iset);
|
||||
|
||||
gtk_bitset_shift_left (testset, j);
|
||||
|
||||
min = MIN (gtk_bitset_get_minimum (iset), gtk_bitset_get_minimum (testset));
|
||||
max = MAX (gtk_bitset_get_maximum (iset), gtk_bitset_get_maximum (testset));
|
||||
|
||||
for (k = min; k <= max; k++)
|
||||
{
|
||||
if (k >= j)
|
||||
g_assert_cmpint (gtk_bitset_contains (iset, k), ==, gtk_bitset_contains (testset, k - j));
|
||||
}
|
||||
|
||||
gtk_bitset_unref (testset);
|
||||
}
|
||||
|
||||
gtk_bitset_unref (iset);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_shift_right (void)
|
||||
{
|
||||
guint i, j, k, min, max;
|
||||
GtkBitset *iset, *testset;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (bitsets); i++)
|
||||
{
|
||||
iset = bitsets[i].create();
|
||||
|
||||
for (j = 1; j < 10000000; j *= 10)
|
||||
{
|
||||
testset = gtk_bitset_copy (iset);
|
||||
|
||||
gtk_bitset_shift_right (testset, j);
|
||||
|
||||
min = MIN (gtk_bitset_get_minimum (iset), gtk_bitset_get_minimum (testset));
|
||||
max = MAX (gtk_bitset_get_maximum (iset), gtk_bitset_get_maximum (testset));
|
||||
|
||||
for (k = min; k <= max; k++)
|
||||
{
|
||||
if (k <= G_MAXUINT - j)
|
||||
{
|
||||
if (gtk_bitset_contains (iset, k) != gtk_bitset_contains (testset, k + j))
|
||||
g_print ("right-shift fail set %u shift %u test %u\n", i, j, k);
|
||||
g_assert_cmpint (gtk_bitset_contains (iset, k), ==, gtk_bitset_contains (testset, k + j));
|
||||
}
|
||||
}
|
||||
|
||||
gtk_bitset_unref (testset);
|
||||
}
|
||||
|
||||
gtk_bitset_unref (iset);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@ -364,6 +432,8 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/bitset/intersect", test_intersect);
|
||||
g_test_add_func ("/bitset/difference", test_difference);
|
||||
g_test_add_func ("/bitset/subtract", test_subtract);
|
||||
g_test_add_func ("/bitset/shift-left", test_shift_left);
|
||||
g_test_add_func ("/bitset/shift-right", test_shift_right);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
@ -119,6 +119,7 @@ foreach t : tests
|
||||
test(test_name, test_exe,
|
||||
args: [ '--tap', '-k' ],
|
||||
protocol: 'tap',
|
||||
timeout: 60,
|
||||
env: [
|
||||
'NO_AT_BRIDGE=1',
|
||||
'GSK_RENDERER=cairo',
|
||||
@ -169,7 +170,8 @@ focus_chain_tests = [
|
||||
[ 'widget-factory', 'up' ],
|
||||
[ 'widget-factory', 'down' ],
|
||||
[ 'widget-factory', 'left' ],
|
||||
[ 'widget-factory', 'right' ],
|
||||
# this one is flaky in ci, for unclear reasons
|
||||
#[ 'widget-factory', 'right' ],
|
||||
[ 'widget-factory2', 'tab' ],
|
||||
[ 'widget-factory2', 'tab-backward' ],
|
||||
# in ci, we don't show a color picker, so the focus chain
|
||||
|
@ -9,12 +9,15 @@ diff = find_program('diff', required: true)
|
||||
common_env = [
|
||||
'GIO_USE_VOLUME_MONITOR=unix',
|
||||
'GSETTINGS_BACKEND=memory',
|
||||
'GDK_DEBUG=default-settings',
|
||||
'GTK_CSD=1',
|
||||
'G_ENABLE_DIAGNOSTIC=0',
|
||||
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
|
||||
]
|
||||
|
||||
if get_option('debug')
|
||||
common_env += [ 'GDK_DEBUG=default-settings' ]
|
||||
endif
|
||||
|
||||
add_test_setup ('x11',
|
||||
is_default: true,
|
||||
env: common_env + [
|
||||
|
Loading…
Reference in New Issue
Block a user