diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0bfbd713fe..f25044c116 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,7 @@ stages: # Common variables variables: - COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false" + COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpcre2:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false" BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true" FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled" MESON_TEST_TIMEOUT_MULTIPLIER: 3 @@ -274,7 +274,7 @@ vs2017-x64: - win32-ps needs: [] script: - - .gitlab-ci/test-msvc.bat + - .gitlab-ci/test-msvc.bat ${COMMON_MESON_FLAGS} artifacts: when: always paths: diff --git a/.gitlab-ci/test-msvc.bat b/.gitlab-ci/test-msvc.bat index 4d54a0881a..f8c20a254f 100644 --- a/.gitlab-ci/test-msvc.bat +++ b/.gitlab-ci/test-msvc.bat @@ -4,9 +4,8 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64 @echo on -:: FIXME: make warnings fatal pip3 install --upgrade --user meson~=1.2 || goto :error -meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled -Dvulkan=disabled _build || goto :error +meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled -Dvulkan=disabled %~1 _build || goto :error ninja -C _build || goto :error goto :EOF diff --git a/demos/gtk-demo/font_features.c b/demos/gtk-demo/font_features.c index 206836817f..fa2709a2da 100644 --- a/demos/gtk-demo/font_features.c +++ b/demos/gtk-demo/font_features.c @@ -811,7 +811,7 @@ tag_pair_equal (gconstpointer a, gconstpointer b) } -static GtkOrdering +static int script_sort (const void *item1, const void *item2, void *data) diff --git a/gdk/gdkmemoryformatprivate.h b/gdk/gdkmemoryformatprivate.h index 994e8e845c..6fbd3363cc 100644 --- a/gdk/gdkmemoryformatprivate.h +++ b/gdk/gdkmemoryformatprivate.h @@ -22,6 +22,11 @@ #include "gdkenums.h" #include "gdktypes.h" +/* epoxy needs this, see https://github.com/anholt/libepoxy/issues/299 */ +#ifdef GDK_WINDOWING_WIN32 +#include +#endif + #include #ifdef GDK_RENDERING_VULKAN diff --git a/gdk/win32/gdkclipdrop-win32.c b/gdk/win32/gdkclipdrop-win32.c index 3e082b1dec..c927607d54 100644 --- a/gdk/win32/gdkclipdrop-win32.c +++ b/gdk/win32/gdkclipdrop-win32.c @@ -1454,22 +1454,22 @@ failed: static gpointer _gdk_win32_clipboard_thread_main (gpointer data) { + GdkWin32Clipdrop *self = data; MSG msg; - clipdrop_thread_items *items = (clipdrop_thread_items*) data; - GAsyncQueue *queue = items->queue; - GAsyncQueue *render_queue = (GAsyncQueue *) g_async_queue_pop (queue); + GAsyncQueue *queue = self->clipboard_open_thread_queue; + GAsyncQueue *render_queue = self->clipboard_render_queue; + + g_assert (self->clipboard_thread_items == NULL); - g_assert (items->clipdrop->clipboard_thread_items == NULL); + self->clipboard_thread_items = g_new0 (GdkWin32ClipboardThread, 1); + CLIPDROP_CB_THREAD_MEMBER (self, input_queue) = queue; + CLIPDROP_CB_THREAD_MEMBER (self, render_queue) = render_queue; + CLIPDROP_CB_THREAD_MEMBER (self, clipboard_opened_for) = INVALID_HANDLE_VALUE; - items->clipdrop->clipboard_thread_items = g_new0 (GdkWin32ClipboardThread, 1); - CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, input_queue) = queue; - CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, render_queue) = render_queue; - CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, clipboard_opened_for) = INVALID_HANDLE_VALUE; - - if (!register_clipboard_notification (items->clipdrop)) + if (!register_clipboard_notification (self)) { g_async_queue_unref (queue); - g_clear_pointer (&items->clipdrop->clipboard_thread_items, g_free); + g_clear_pointer (&self->clipboard_thread_items, g_free); return NULL; } @@ -1481,10 +1481,9 @@ _gdk_win32_clipboard_thread_main (gpointer data) } /* Just in case, as this should only happen when we shut down */ - DestroyWindow (CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, clipboard_hwnd)); - CloseHandle (CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, clipboard_hwnd)); - g_async_queue_unref (queue); - g_clear_pointer (&items->clipdrop->clipboard_thread_items, g_free); + DestroyWindow (CLIPDROP_CB_THREAD_MEMBER (self, clipboard_hwnd)); + CloseHandle (CLIPDROP_CB_THREAD_MEMBER (self, clipboard_hwnd)); + g_clear_pointer (&self->clipboard_thread_items, g_free); return NULL; } @@ -1521,8 +1520,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) GArray *comp; GdkWin32ContentFormatPair fmt; HMODULE user32; - clipdrop_thread_items cb_items, dnd_items; - + win32_clipdrop->thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP"); user32 = LoadLibrary (L"user32.dll"); @@ -1810,22 +1808,14 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) win32_clipdrop->clipboard_open_thread_queue = g_async_queue_new (); win32_clipdrop->clipboard_render_queue = g_async_queue_new (); - /* Out of sheer laziness, we just push the extra queue through the - * main queue, instead of allocating a struct with two queue - * pointers and then passing *that* to the thread. - */ - g_async_queue_push (win32_clipdrop->clipboard_open_thread_queue, g_async_queue_ref (win32_clipdrop->clipboard_render_queue)); - cb_items.clipdrop = dnd_items.clipdrop = win32_clipdrop; - cb_items.queue = g_async_queue_ref (win32_clipdrop->clipboard_open_thread_queue); win32_clipdrop->clipboard_open_thread = g_thread_new ("GDK Win32 Clipboard Thread", _gdk_win32_clipboard_thread_main, - &cb_items); + win32_clipdrop); win32_clipdrop->dnd_queue = g_async_queue_new (); - dnd_items.queue = g_async_queue_ref (win32_clipdrop->dnd_queue); win32_clipdrop->dnd_thread = g_thread_new ("GDK Win32 DnD Thread", _gdk_win32_dnd_thread_main, - &dnd_items); + win32_clipdrop); win32_clipdrop->dnd_thread_id = GPOINTER_TO_UINT (g_async_queue_pop (win32_clipdrop->dnd_queue)); } diff --git a/gdk/win32/gdkclipdrop-win32.h b/gdk/win32/gdkclipdrop-win32.h index c48d9a17f2..4b0893c37a 100644 --- a/gdk/win32/gdkclipdrop-win32.h +++ b/gdk/win32/gdkclipdrop-win32.h @@ -113,15 +113,6 @@ typedef enum _GdkWin32CFIndex GdkWin32CFIndex; typedef struct _GdkWin32Clipdrop GdkWin32Clipdrop; typedef struct _GdkWin32ClipdropClass GdkWin32ClipdropClass; -/* this is shared with gdkdrag-win32.c as well */ -struct _clipdrop_thread_items -{ - GdkWin32Clipdrop *clipdrop; - GAsyncQueue *queue; -}; - -typedef struct _clipdrop_thread_items clipdrop_thread_items; - typedef BOOL (WINAPI * GetUpdatedClipboardFormatsFunc)( _Out_ PUINT lpuiFormats, _In_ UINT cFormats, diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c index 0b1799507d..87fc0ae1c8 100644 --- a/gdk/win32/gdkdrag-win32.c +++ b/gdk/win32/gdkdrag-win32.c @@ -637,10 +637,8 @@ do_drag_drop (GdkWin32DnDThreadDoDragDrop *ddd) gpointer _gdk_win32_dnd_thread_main (gpointer data) { - - clipdrop_thread_items *clipdrop_items = (clipdrop_thread_items *) data; - GAsyncQueue *queue = clipdrop_items->queue; - GdkWin32Clipdrop *clipdrop = clipdrop_items->clipdrop; + GdkWin32Clipdrop *clipdrop = data; + GAsyncQueue *queue = clipdrop->dnd_queue; GdkWin32DnDThreadQueueItem *item; MSG msg; HRESULT hr; diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 62c090d328..2a114dc4dc 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -1780,19 +1780,19 @@ gdk_event_translate (MSG *msg, { /* XXX Handle WM_QUIT here ? */ if (msg->message == WM_QUIT) - { - GDK_NOTE (EVENTS, g_print (" %d", (int) msg->wParam)); - exit (msg->wParam); - } + { + GDK_NOTE (EVENTS, g_print (" %d", (int) msg->wParam)); + exit (msg->wParam); + } else if (msg->message == WM_CREATE) - { - surface = (UNALIGNED GdkSurface*) (((LPCREATESTRUCTW) msg->lParam)->lpCreateParams); - GDK_SURFACE_HWND (surface) = msg->hwnd; - } + { + surface = (GdkSurface*) (((LPCREATESTRUCTW) msg->lParam)->lpCreateParams); + GDK_SURFACE_HWND (surface) = msg->hwnd; + } else - { - GDK_NOTE (EVENTS, g_print (" (no GdkSurface)")); - } + { + GDK_NOTE (EVENTS, g_print (" (no GdkSurface)")); + } return FALSE; } @@ -2302,8 +2302,8 @@ gdk_event_translate (MSG *msg, * */ if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER && - ( (msg->time - win32_display->device_manager->last_digitizer_time) < 200 || - -(msg->time - win32_display->device_manager->last_digitizer_time) < 200 )) + ((msg->time - win32_display->device_manager->last_digitizer_time) < 200 || + (win32_display->device_manager->last_digitizer_time - msg->time) < 200 )) break; win32_display->device_manager->pen_touch_input = FALSE; diff --git a/gdk/win32/gdkglcontext-win32.h b/gdk/win32/gdkglcontext-win32.h index c3c8c1a8d5..0f4c7c2535 100644 --- a/gdk/win32/gdkglcontext-win32.h +++ b/gdk/win32/gdkglcontext-win32.h @@ -21,6 +21,10 @@ #pragma once #ifndef DONT_INCLUDE_LIBEPOXY +#ifdef GDK_WINDOWING_WIN32 +/* epoxy needs this, see https://github.com/anholt/libepoxy/issues/299 */ +#include +#endif #include #include diff --git a/gdk/win32/gdkkeys-win32.c b/gdk/win32/gdkkeys-win32.c index 8243daa5a6..912747191d 100644 --- a/gdk/win32/gdkkeys-win32.c +++ b/gdk/win32/gdkkeys-win32.c @@ -254,11 +254,15 @@ _get_keyboard_layout_file (const char *layout_name) status = RegOpenKeyExA (HKEY_LOCAL_MACHINE, (LPCSTR) kbdKeyPath, 0, KEY_QUERY_VALUE, &hkey); - if (status != ERROR_SUCCESS) + if (status == ERROR_FILE_NOT_FOUND) + { + return NULL; + } + else if (status != ERROR_SUCCESS) { g_warning("Could not open registry key '%s'. Error code: %d", kbdKeyPath, (int)status); - goto fail1; + return NULL; } /* Get sizes */ @@ -268,14 +272,14 @@ _get_keyboard_layout_file (const char *layout_name) { g_warning("Could not query registry key '%s\\Layout File'. Error code: %d", kbdKeyPath, (int)status); - goto fail2; + goto fail_close_key; } dir_len = GetSystemDirectoryA (0, 0); /* includes \0 */ if (dir_len == 0) { g_warning("GetSystemDirectoryA failed. Error: %d", (int)GetLastError()); - goto fail2; + goto fail_close_key; } /* Allocate buffer */ @@ -284,7 +288,7 @@ _get_keyboard_layout_file (const char *layout_name) /* Append system directory. The -1 is because dir_len includes \0 */ if (GetSystemDirectoryA (&result[0], dir_len) != dir_len - 1) - goto fail3; + goto fail_free_result; /* Append directory separator */ result[dir_len - 1] = '\\'; @@ -293,20 +297,17 @@ _get_keyboard_layout_file (const char *layout_name) status = RegQueryValueExA (hkey, "Layout File", 0, &var_type, (LPBYTE) &result[dir_len], &file_name_len); if (status != ERROR_SUCCESS) - { - goto fail3; - } + goto fail_free_result; result[dir_len + file_name_len] = '\0'; RegCloseKey (hkey); return result; -fail3: +fail_free_result: g_free (result); -fail2: +fail_close_key: RegCloseKey (hkey); -fail1: return NULL; } diff --git a/gdk/win32/gdkwin32misc.c b/gdk/win32/gdkwin32misc.c index c8ede75061..4b7d087813 100644 --- a/gdk/win32/gdkwin32misc.c +++ b/gdk/win32/gdkwin32misc.c @@ -27,6 +27,7 @@ #include "gdkprivate-win32.h" #include "gdkdisplay-win32.h" +#undef STRICT #include struct _GdkWin32ALPNSink diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c index 4421cf02a0..ae4ee16686 100644 --- a/gsk/gl/gskglcommandqueue.c +++ b/gsk/gl/gskglcommandqueue.c @@ -1087,25 +1087,25 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self, glEnableVertexAttribArray (0); glVertexAttribPointer (0, 2, GL_FLOAT, GL_FALSE, sizeof (GskGLDrawVertex), - (void *) G_STRUCT_OFFSET (GskGLDrawVertex, position)); + GSIZE_TO_POINTER ((gsize) G_STRUCT_OFFSET (GskGLDrawVertex, position))); /* 1 = texture coord location */ glEnableVertexAttribArray (1); glVertexAttribPointer (1, 2, GL_FLOAT, GL_FALSE, sizeof (GskGLDrawVertex), - (void *) G_STRUCT_OFFSET (GskGLDrawVertex, uv)); + GSIZE_TO_POINTER ((gsize) G_STRUCT_OFFSET (GskGLDrawVertex, uv))); /* 2 = color location */ glEnableVertexAttribArray (2); glVertexAttribPointer (2, 4, GL_HALF_FLOAT, GL_FALSE, sizeof (GskGLDrawVertex), - (void *) G_STRUCT_OFFSET (GskGLDrawVertex, color)); + GSIZE_TO_POINTER ((gsize) G_STRUCT_OFFSET (GskGLDrawVertex, color))); /* 3 = color2 location */ glEnableVertexAttribArray (3); glVertexAttribPointer (3, 4, GL_HALF_FLOAT, GL_FALSE, sizeof (GskGLDrawVertex), - (void *) G_STRUCT_OFFSET (GskGLDrawVertex, color2)); + GSIZE_TO_POINTER ((gsize) G_STRUCT_OFFSET (GskGLDrawVertex, color2))); /* Setup initial scissor clip */ if (scissor != NULL && cairo_region_num_rectangles (scissor) > 0) diff --git a/gsk/gl/gskgltypesprivate.h b/gsk/gl/gskgltypesprivate.h index c16c22c5a0..301a232bf1 100644 --- a/gsk/gl/gskgltypesprivate.h +++ b/gsk/gl/gskgltypesprivate.h @@ -20,10 +20,14 @@ #pragma once -#include -#include #include #include +#ifdef GDK_WINDOWING_WIN32 +/* epoxy needs this, see https://github.com/anholt/libepoxy/issues/299 */ +#include +#endif +#include +#include G_BEGIN_DECLS diff --git a/gsk/gpu/gskgpucache.c b/gsk/gpu/gskgpucache.c index 7cc8898b82..b1d62b486b 100644 --- a/gsk/gpu/gskgpucache.c +++ b/gsk/gpu/gskgpucache.c @@ -846,7 +846,7 @@ typedef struct { guint n_items; guint n_stale; -} CacheData; +} GskGpuCacheData; static void print_cache_stats (GskGpuCache *self) @@ -860,10 +860,10 @@ print_cache_stats (GskGpuCache *self) for (cached = self->first_cached; cached != NULL; cached = cached->next) { - CacheData *cache_data = g_hash_table_lookup (classes, cached->class); + GskGpuCacheData *cache_data = g_hash_table_lookup (classes, cached->class); if (cache_data == NULL) { - cache_data = g_new0 (CacheData, 1); + cache_data = g_new0 (GskGpuCacheData, 1); g_hash_table_insert (classes, (gpointer) cached->class, cache_data); } cache_data->n_items++; @@ -892,7 +892,7 @@ print_cache_stats (GskGpuCache *self) while (g_hash_table_iter_next (&iter, &key, &value)) { const GskGpuCachedClass *class = key; - const CacheData *cache_data = value; + const GskGpuCacheData *cache_data = value; g_string_append_printf (message, "\n %s:%*s%5u (%u stale)", class->name, 12 - MIN (12, (int) strlen (class->name)), "", cache_data->n_items, cache_data->n_stale); diff --git a/gsk/gpu/gskgpuuploadop.c b/gsk/gpu/gskgpuuploadop.c index df2ea0a3a6..030fb5f174 100644 --- a/gsk/gpu/gskgpuuploadop.c +++ b/gsk/gpu/gskgpuuploadop.c @@ -665,7 +665,7 @@ void gsk_gpu_upload_glyph_op (GskGpuFrame *frame, GskGpuImage *image, PangoFont *font, - const PangoGlyph glyph, + PangoGlyph glyph, const cairo_rectangle_int_t *area, const graphene_point_t *origin) { diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c index 45cac210f5..814bd4ed57 100644 --- a/gsk/gskrenderer.c +++ b/gsk/gskrenderer.c @@ -53,25 +53,12 @@ #include #include "gdk/gdkdebugprivate.h" -#ifdef GDK_WINDOWING_X11 -#include -#endif #ifdef GDK_WINDOWING_WAYLAND #include #endif #ifdef GDK_WINDOWING_BROADWAY #include "broadway/gskbroadwayrenderer.h" #endif -#ifdef GDK_WINDOWING_MACOS -#include -#endif -#ifdef GDK_WINDOWING_WIN32 -#include - -/* Remove these lines when OpenGL/ES 2.0 shader is ready */ -#include "win32/gdkprivate-win32.h" -#include "win32/gdkdisplay-win32.h" -#endif typedef struct { diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c index 268fdb933e..12d7fcfcd0 100644 --- a/gsk/gskrendernodeparser.c +++ b/gsk/gskrendernodeparser.c @@ -55,6 +55,10 @@ #ifdef HAVE_PANGOFT #include #endif +#ifdef HAVE_PANGOWIN32 +#undef STRICT +#include +#endif #include @@ -1135,7 +1139,6 @@ create_ascii_glyphs (PangoFont *font) } #ifdef HAVE_PANGOFT - static void delete_file (gpointer data) { @@ -1144,25 +1147,31 @@ delete_file (gpointer data) g_remove (path); g_free (path); } +#endif static void ensure_fontmap (Context *context) { - FcConfig *config; - GPtrArray *files; - if (context->fontmap) return; context->fontmap = pango_cairo_font_map_new (); - config = FcConfigCreate (); - pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (context->fontmap), config); - FcConfigDestroy (config); +#ifdef HAVE_PANGOFT + if (PANGO_IS_FC_FONT_MAP (context->fontmap)) + { + FcConfig *config; + GPtrArray *files; - files = g_ptr_array_new_with_free_func (delete_file); + config = FcConfigCreate (); + pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (context->fontmap), config); + FcConfigDestroy (config); - g_object_set_data_full (G_OBJECT (context->fontmap), "font-files", files, (GDestroyNotify) g_ptr_array_unref); + files = g_ptr_array_new_with_free_func (delete_file); + + g_object_set_data_full (G_OBJECT (context->fontmap), "font-files", files, (GDestroyNotify) g_ptr_array_unref); + } +#endif } static gboolean @@ -1170,37 +1179,53 @@ add_font_from_file (Context *context, const char *path, GError **error) { - FcConfig *config; - GPtrArray *files; - ensure_fontmap (context); - if (!PANGO_IS_FC_FONT_MAP (context->fontmap)) +#ifdef HAVE_PANGOFT + if (PANGO_IS_FC_FONT_MAP (context->fontmap)) { + FcConfig *config; + GPtrArray *files; + + config = pango_fc_font_map_get_config (PANGO_FC_FONT_MAP (context->fontmap)); + + if (!FcConfigAppFontAddFile (config, (FcChar8 *) path)) + { + g_set_error (error, + GTK_CSS_PARSER_ERROR, + GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE, + "Failed to load font"); + return FALSE; + } + + files = (GPtrArray *) g_object_get_data (G_OBJECT (context->fontmap), "font-files"); + g_ptr_array_add (files, g_strdup (path)); + + pango_fc_font_map_config_changed (PANGO_FC_FONT_MAP (context->fontmap)); + + return TRUE; + } + else +#endif +#ifdef HAVE_PANGOWIN32 + if (g_type_is_a (G_OBJECT_TYPE (context->fontmap), g_type_from_name ("PangoWin32FontMap"))) + { + gboolean result; + + result = pango_win32_font_map_add_font_file (context->fontmap, path, error); + g_remove (path); + return result; + } + else +#endif + { + g_remove (path); g_set_error (error, GTK_CSS_PARSER_ERROR, GTK_CSS_PARSER_ERROR_FAILED, "Custom fonts are not implemented for %s", G_OBJECT_TYPE_NAME (context->fontmap)); return FALSE; } - - config = pango_fc_font_map_get_config (PANGO_FC_FONT_MAP (context->fontmap)); - - if (!FcConfigAppFontAddFile (config, (FcChar8 *) path)) - { - g_set_error (error, - GTK_CSS_PARSER_ERROR, - GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE, - "Failed to load font"); - return FALSE; - } - - files = (GPtrArray *) g_object_get_data (G_OBJECT (context->fontmap), "font-files"); - g_ptr_array_add (files, g_strdup (path)); - - pango_fc_font_map_config_changed (PANGO_FC_FONT_MAP (context->fontmap)); - - return TRUE; } static gboolean @@ -1236,22 +1261,6 @@ add_font_from_bytes (Context *context, return result; } -#else /* !HAVE_PANGOFT */ - -static gboolean -add_font_from_bytes (Context *context, - GBytes *bytes, - GError **error) -{ - g_set_error (error, - GTK_CSS_PARSER_ERROR, - GTK_CSS_PARSER_ERROR_FAILED, - "Not implemented"); - return FALSE; -} - -#endif - static gboolean parse_font (GtkCssParser *parser, Context *context, diff --git a/gtk/deprecated/gtktreerbtree.c b/gtk/deprecated/gtktreerbtree.c index 06062ed159..9cfbdd8561 100644 --- a/gtk/deprecated/gtktreerbtree.c +++ b/gtk/deprecated/gtktreerbtree.c @@ -75,16 +75,6 @@ gtk_tree_rbnode_new (GtkTreeRBTree *tree, static void gtk_tree_rbnode_free (GtkTreeRBNode *node) { - if (GTK_DEBUG_CHECK (TREE)) - { - node->left = (gpointer) 0xdeadbeef; - node->right = (gpointer) 0xdeadbeef; - node->parent = (gpointer) 0xdeadbeef; - node->total_count = 56789; - node->offset = 56789; - node->count = 56789; - node->flags = 0; - } g_slice_free (GtkTreeRBNode, node); } @@ -1178,7 +1168,7 @@ gtk_tree_rbtree_remove_node (GtkTreeRBTree *tree, /* We need to clean up the validity of the tree. */ - gtk_rbnode_adjust (tree, y, -1, -y_total_count, -y_height); + gtk_rbnode_adjust (tree, y, -1, -(int) y_total_count, -y_height); if (GTK_TREE_RBNODE_GET_COLOR (y) == GTK_TREE_RBNODE_BLACK) gtk_tree_rbtree_remove_node_fixup (tree, x, y->parent); diff --git a/gtk/gtkapplicationaccels.c b/gtk/gtkapplicationaccels.c index 8ac33f8526..4b4f3d5fe8 100644 --- a/gtk/gtkapplicationaccels.c +++ b/gtk/gtkapplicationaccels.c @@ -119,7 +119,8 @@ gtk_application_accels_set_accels_for_action (GtkApplicationAccels *accels, for (i = 0; accelerators[i]; i++) { GtkShortcutTrigger *new_trigger; - guint key, modifier; + guint key; + GdkModifierType modifier; if (!gtk_accelerator_parse (accelerators[i], &key, &modifier)) { @@ -267,7 +268,8 @@ gtk_application_accels_get_actions_for_accel (GtkApplicationAccels *accels, const char *accel) { GPtrArray *result; - guint key, modifiers; + guint key; + GdkModifierType modifiers; guint i; if (!gtk_accelerator_parse (accel, &key, &modifiers)) diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c index fb093b7b48..a216895c70 100644 --- a/gtk/gtkbuilderparser.c +++ b/gtk/gtkbuilderparser.c @@ -913,11 +913,13 @@ parse_property (ParserData *data, if (bind_flags_str) { - if (!_gtk_builder_flags_from_string (G_TYPE_BINDING_FLAGS, bind_flags_str, &bind_flags, error)) + guint flags; + if (!_gtk_builder_flags_from_string (G_TYPE_BINDING_FLAGS, bind_flags_str, &flags, error)) { _gtk_builder_prefix_error (data->builder, &data->ctx, error); return; } + bind_flags = flags; } gtk_buildable_parse_context_get_position (&data->ctx, &line, &col); diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 9337afbea2..e10bebda21 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -6959,7 +6959,7 @@ match_func (gpointer item, gpointer user_data) return g_file_info_get_attribute_boolean (G_FILE_INFO (item), "filechooser::visible"); } -static GtkOrdering +static int directory_sort_func (gconstpointer a, gconstpointer b, gpointer user_data) @@ -6980,13 +6980,13 @@ directory_sort_func (gconstpointer a, return GTK_ORDERING_EQUAL; } -static GtkOrdering +static int name_sort_func (gconstpointer a, gconstpointer b, gpointer user_data) { char *key_a, *key_b; - GtkOrdering result; + int result; /* FIXME: use sortkeys for these */ key_a = g_utf8_collate_key_for_filename (g_file_info_get_display_name ((GFileInfo *)a), -1); @@ -7026,7 +7026,7 @@ location_sort_func (gconstpointer a, return result; } -static GtkOrdering +static int size_sort_func (gconstpointer a, gconstpointer b, gpointer user_data) @@ -7044,14 +7044,14 @@ size_sort_func (gconstpointer a, return GTK_ORDERING_EQUAL; } -static GtkOrdering +static int type_sort_func (gconstpointer a, gconstpointer b, gpointer user_data) { GtkFileChooserWidget *impl = user_data; char *key_a, *key_b; - GtkOrdering result; + int result; /* FIXME: use sortkeys for these */ key_a = get_type_information (impl, (GFileInfo *)a); @@ -7065,7 +7065,7 @@ type_sort_func (gconstpointer a, return result; } -static GtkOrdering +static int time_sort_func (gconstpointer a, gconstpointer b, gpointer user_data) @@ -7094,12 +7094,12 @@ time_sort_func (gconstpointer a, return GTK_ORDERING_EQUAL; } -static GtkOrdering +static int recent_sort_func (gconstpointer a, gconstpointer b, gpointer user_data) { - GtkOrdering result; + int result; result = time_sort_func (a, b, user_data); @@ -7116,12 +7116,12 @@ recent_sort_func (gconstpointer a, return result; } -static GtkOrdering +static int search_sort_func (gconstpointer a, gconstpointer b, gpointer user_data) { - GtkOrdering result; + int result; result = location_sort_func (a, b, user_data); diff --git a/gtk/gtkimcontextime.c b/gtk/gtkimcontextime.c index 50eea0fe7e..9004948e4f 100644 --- a/gtk/gtkimcontextime.c +++ b/gtk/gtkimcontextime.c @@ -40,6 +40,7 @@ #include "gtk/deprecated/gtkstylecontextprivate.h" #include "gtkwidgetprivate.h" +#undef STRICT #include /* Determines what happens when focus is lost while preedit is in process. */ diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c index 58efb7ebe4..4429467860 100644 --- a/gtk/gtkmountoperation.c +++ b/gtk/gtkmountoperation.c @@ -828,7 +828,7 @@ call_password_proxy_cb (GObject *source, { _GtkMountOperationHandler *proxy = _GTK_MOUNT_OPERATION_HANDLER (source); GMountOperation *op = user_data; - GMountOperationResult result; + guint result; GVariant *result_details; GVariantIter iter; const char *key; @@ -983,7 +983,7 @@ call_question_proxy_cb (GObject *source, { _GtkMountOperationHandler *proxy = _GTK_MOUNT_OPERATION_HANDLER (source); GMountOperation *op = user_data; - GMountOperationResult result; + guint result; GVariant *result_details; GVariantIter iter; const char *key; @@ -1566,7 +1566,7 @@ call_processes_proxy_cb (GObject *source, { _GtkMountOperationHandler *proxy = _GTK_MOUNT_OPERATION_HANDLER (source); GMountOperation *op = user_data; - GMountOperationResult result; + guint result; GVariant *result_details; GVariantIter iter; const char *key; diff --git a/gtk/gtkroundedbox.c b/gtk/gtkroundedbox.c index 44f8f8312c..fa8a52f8e9 100644 --- a/gtk/gtkroundedbox.c +++ b/gtk/gtkroundedbox.c @@ -31,7 +31,7 @@ typedef struct { double angle1; double angle2; gboolean negative; -} Arc; +} ArcPath; static inline guint mem_hash (gconstpointer v, int len) @@ -49,14 +49,14 @@ mem_hash (gconstpointer v, int len) } static guint -arc_path_hash (Arc *arc) +arc_path_hash (ArcPath *arc) { - return mem_hash ((gconstpointer)arc, sizeof (Arc)); + return mem_hash ((gconstpointer)arc, sizeof (ArcPath)); } static gboolean -arc_path_equal (Arc *arc1, - Arc *arc2) +arc_path_equal (ArcPath *arc1, + ArcPath *arc2) { return arc1->angle1 == arc2->angle1 && arc1->angle2 == arc2->angle2 && @@ -80,10 +80,10 @@ static void append_arc (cairo_t *cr, double angle1, double angle2, gboolean negative) { static GHashTable *arc_path_cache; - Arc key; + ArcPath key; cairo_path_t *arc; - memset (&key, 0, sizeof (Arc)); + memset (&key, 0, sizeof (ArcPath)); key.angle1 = angle1; key.angle2 = angle2; key.negative = negative; diff --git a/gtk/gtkshortcutssection.c b/gtk/gtkshortcutssection.c index df7ebf89d3..58a76032ca 100644 --- a/gtk/gtkshortcutssection.c +++ b/gtk/gtkshortcutssection.c @@ -714,7 +714,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self) if (n_rows - height == 0) break; - if (ABS (n_rows - n) < ABS ((n_rows - height) - (n + height))) + if (n_rows - n < 2 * height) break; n_rows -= height; diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index bdc936c510..6c279fcecc 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -264,7 +264,7 @@ enum { /* Signals */ enum { - INPUT, + INPUT_, OUTPUT, VALUE_CHANGED, ACTIVATE, @@ -499,7 +499,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) * Returns: %TRUE for a successful conversion, %FALSE if the input * was not handled, and %GTK_INPUT_ERROR if the conversion failed. */ - spinbutton_signals[INPUT] = + spinbutton_signals[INPUT_] = g_signal_new (I_("input"), G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, @@ -508,7 +508,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) _gtk_marshal_INT__POINTER, G_TYPE_INT, 1, G_TYPE_POINTER); - g_signal_set_va_marshaller (spinbutton_signals[INPUT], + g_signal_set_va_marshaller (spinbutton_signals[INPUT_], G_TYPE_FROM_CLASS (gobject_class), _gtk_marshal_INT__POINTERv); @@ -2541,7 +2541,7 @@ gtk_spin_button_update (GtkSpinButton *spin_button) g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button)); return_val = FALSE; - g_signal_emit (spin_button, spinbutton_signals[INPUT], 0, &val, &return_val); + g_signal_emit (spin_button, spinbutton_signals[INPUT_], 0, &val, &return_val); if (return_val == FALSE) { return_val = gtk_spin_button_default_input (spin_button, &val); diff --git a/gtk/gtktextbtree.c b/gtk/gtktextbtree.c index ceb8c715a9..d3d9f0c074 100644 --- a/gtk/gtktextbtree.c +++ b/gtk/gtktextbtree.c @@ -1606,9 +1606,6 @@ _gtk_text_btree_remove_view (GtkTextBTree *tree, gtk_text_btree_node_remove_view (view, tree->root_node, view_id); - view->layout = (gpointer) 0xdeadbeef; - view->view_id = (gpointer) 0xdeadbeef; - g_free (view); } diff --git a/gtk/gtktexthistory.c b/gtk/gtktexthistory.c index 732973b99d..53cab1cbb6 100644 --- a/gtk/gtktexthistory.c +++ b/gtk/gtktexthistory.c @@ -1194,7 +1194,7 @@ gtk_text_history_text_deleted (GtkTextHistory *self, action->u.delete.end = end; action->u.delete.selection.insert = self->selection.insert; action->u.delete.selection.bound = self->selection.bound; - istring_set (&action->u.delete.istr, text, len, ABS (end - begin)); + istring_set (&action->u.delete.istr, text, len, MAX (end, begin) - MIN (end, begin)); gtk_text_history_push (self, action); } diff --git a/gtk/inspector/a11yoverlay.c b/gtk/inspector/a11yoverlay.c index b22137181e..db493bd208 100644 --- a/gtk/inspector/a11yoverlay.c +++ b/gtk/inspector/a11yoverlay.c @@ -48,9 +48,9 @@ G_DEFINE_TYPE (GtkA11yOverlay, gtk_a11y_overlay, GTK_TYPE_INSPECTOR_OVERLAY) typedef enum { - SEVERITY_GOOD, - SEVERITY_RECOMMENDATION, - SEVERITY_ERROR + FIX_SEVERITY_GOOD, + FIX_SEVERITY_RECOMMENDATION, + FIX_SEVERITY_ERROR } FixSeverity; typedef enum @@ -132,7 +132,7 @@ check_accessibility_errors (GtkATContext *context, if (gtk_accessible_role_is_abstract (role)) { *hint = g_strdup_printf ("%s is an abstract role", role_name); - return SEVERITY_ERROR; + return FIX_SEVERITY_ERROR; } /* Check for name and description */ @@ -142,12 +142,12 @@ check_accessibility_errors (GtkATContext *context, switch (gtk_accessible_role_get_naming (role)) { case GTK_ACCESSIBLE_NAME_ALLOWED: - return SEVERITY_GOOD; + return FIX_SEVERITY_GOOD; case GTK_ACCESSIBLE_NAME_REQUIRED: if (label_set) { - return SEVERITY_GOOD; + return FIX_SEVERITY_GOOD; } else { @@ -160,18 +160,18 @@ check_accessibility_errors (GtkATContext *context, g_free (name); *hint = g_strdup_printf ("%s must have text content or label", role_name); - return SEVERITY_ERROR; + return FIX_SEVERITY_ERROR; } else { - return SEVERITY_GOOD; + return FIX_SEVERITY_GOOD; } } else { *hint = g_strdup_printf ("%s must have label", role_name); - return SEVERITY_ERROR; + return FIX_SEVERITY_ERROR; } } break; @@ -181,37 +181,37 @@ check_accessibility_errors (GtkATContext *context, { *hint = g_strdup_printf ("%s can't have label", role_name); - return SEVERITY_ERROR; + return FIX_SEVERITY_ERROR; } else { - return SEVERITY_GOOD; + return FIX_SEVERITY_GOOD; } break; case GTK_ACCESSIBLE_NAME_RECOMMENDED: if (label_set) { - return SEVERITY_GOOD; + return FIX_SEVERITY_GOOD; } else { *hint = g_strdup_printf ("label recommended for %s", role_name); - return SEVERITY_RECOMMENDATION; + return FIX_SEVERITY_RECOMMENDATION; } break; case GTK_ACCESSIBLE_NAME_NOT_RECOMMENDED: if (!label_set) { - return SEVERITY_GOOD; + return FIX_SEVERITY_GOOD; } else { *hint = g_strdup_printf ("label not recommended for %s", role_name); - return SEVERITY_RECOMMENDATION; + return FIX_SEVERITY_RECOMMENDATION; } break; @@ -234,7 +234,7 @@ check_accessibility_errors (GtkATContext *context, if (!gtk_at_context_has_accessible_state (context, required_attributes[i].id)) { *hint = g_strdup_printf ("%s must have state %s", role_name, g_enum_get_value (states, required_attributes[i].id)->value_nick); - return SEVERITY_ERROR; + return FIX_SEVERITY_ERROR; } break; @@ -242,7 +242,7 @@ check_accessibility_errors (GtkATContext *context, if (!gtk_at_context_has_accessible_property (context, required_attributes[i].id)) { *hint = g_strdup_printf ("%s must have property %s", role_name, g_enum_get_value (properties, required_attributes[i].id)->value_nick); - return SEVERITY_ERROR; + return FIX_SEVERITY_ERROR; } break; @@ -250,7 +250,7 @@ check_accessibility_errors (GtkATContext *context, if (!gtk_at_context_has_accessible_relation (context, required_attributes[i].id)) { *hint = g_strdup_printf ("%s must have relation %s", role_name, g_enum_get_value (relations, required_attributes[i].id)->value_nick); - return SEVERITY_ERROR; + return FIX_SEVERITY_ERROR; } break; @@ -304,10 +304,10 @@ check_accessibility_errors (GtkATContext *context, g_string_free (s, TRUE); - return SEVERITY_ERROR; + return FIX_SEVERITY_ERROR; } - return SEVERITY_GOOD; + return FIX_SEVERITY_GOOD; } static FixSeverity @@ -342,7 +342,7 @@ recurse_child_widgets (GtkA11yOverlay *self, severity = check_widget_accessibility_errors (widget, self->context, &hint); - if (severity != SEVERITY_GOOD) + if (severity != FIX_SEVERITY_GOOD) { int width, height; GdkRGBA color; @@ -350,7 +350,7 @@ recurse_child_widgets (GtkA11yOverlay *self, width = gtk_widget_get_width (widget); height = gtk_widget_get_height (widget); - if (severity == SEVERITY_ERROR) + if (severity == FIX_SEVERITY_ERROR) color = self->error_color; else color = self->recommend_color; diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c index 3f2a2183a2..6823b59597 100644 --- a/gtk/inspector/actions.c +++ b/gtk/inspector/actions.c @@ -463,7 +463,7 @@ gtk_inspector_actions_observer_iface_init (GtkActionObserverInterface *iface) } static void -connect (GtkInspectorActions *sl) +gtk_inspector_actions_connect (GtkInspectorActions *sl) { if (G_IS_ACTION_GROUP (sl->object)) { @@ -494,7 +494,7 @@ connect (GtkInspectorActions *sl) } static void -disconnect (GtkInspectorActions *sl) +gtk_inspector_actions_disconnect (GtkInspectorActions *sl) { if (G_IS_ACTION_GROUP (sl->object)) { @@ -533,7 +533,7 @@ gtk_inspector_actions_set_object (GtkInspectorActions *sl, gtk_stack_page_set_visible (page, FALSE); if (sl->object) - disconnect (sl); + gtk_inspector_actions_disconnect (sl); g_set_object (&sl->object, object); @@ -542,7 +542,7 @@ gtk_inspector_actions_set_object (GtkInspectorActions *sl, gtk_stack_page_set_visible (page, loaded); if (sl->object) - connect (sl); + gtk_inspector_actions_connect (sl); } static void @@ -623,7 +623,7 @@ dispose (GObject *object) GtkInspectorActions *sl = GTK_INSPECTOR_ACTIONS (object); if (sl->object) - disconnect (sl); + gtk_inspector_actions_disconnect (sl); g_clear_object (&sl->sorted); g_clear_object (&sl->actions); diff --git a/gtk/meson.build b/gtk/meson.build index 5d2f2859fe..a662d53f7e 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -882,7 +882,7 @@ gtk_use_wayland_or_x11_c_sources = files([ ]) gtk_dbus_src = gnome.gdbus_codegen('gtkdbusgenerated', - 'gtkdbusinterfaces.xml', + sources:'gtkdbusinterfaces.xml', interface_prefix: 'org.Gtk.', namespace: '_Gtk', ) diff --git a/gtk/timsort/gtktimsort-impl.c b/gtk/timsort/gtktimsort-impl.c index 3e60706b21..9ec8482924 100644 --- a/gtk/timsort/gtktimsort-impl.c +++ b/gtk/timsort/gtktimsort-impl.c @@ -25,6 +25,7 @@ #define INCPTR(x) ((gpointer) ((char *) (x) + WIDTH)) #define DECPTR(x) ((gpointer) ((char *) (x) - WIDTH)) #define ELEM(a, i) ((char *) (a) + (i) * WIDTH) +#define ELEM_REV(a, i) ELEM(a, 0 - (i)) #define LEN(n) ((n) * WIDTH) #define CONCAT(x, y) gtk_tim_sort_ ## x ## _ ## y @@ -296,7 +297,7 @@ gtk_tim_sort(gallop_left) (GtkTimSort *self, const gsize max_ofs = hint + 1; gsize tmp; while (ofs < max_ofs - && gtk_tim_sort_compare (self, key, ELEM (hintp, -ofs)) <= 0) + && gtk_tim_sort_compare (self, key, ELEM_REV (hintp, ofs)) <= 0) { last_ofs = ofs; ofs = (ofs << 1) + 1; /* no need to check for overflow */ @@ -363,7 +364,7 @@ gtk_tim_sort(gallop_right) (GtkTimSort *self, gsize max_ofs = hint + 1; gsize tmp; while (ofs < max_ofs - && gtk_tim_sort_compare (self, key, ELEM (hintp, -ofs)) < 0) + && gtk_tim_sort_compare (self, key, ELEM_REV (hintp, ofs)) < 0) { last_ofs = ofs; ofs = (ofs << 1) + 1; /* no need to check for overflow */ @@ -622,13 +623,13 @@ gtk_tim_sort(merge_hi) (GtkTimSort *self, cursor1 = DECPTR (cursor1); if (--len1 == 0) { - memcpy (ELEM (dest, -(len2 - 1)), tmp, LEN (len2)); /* POP: can't overlap */ + memcpy (ELEM_REV (dest, (len2 - 1)), tmp, LEN (len2)); /* POP: can't overlap */ return; } if (len2 == 1) { - dest = ELEM (dest, -len1); - cursor1 = ELEM (cursor1, -len1); + dest = ELEM_REV (dest, len1); + cursor1 = ELEM_REV (cursor1, len1); memmove (ELEM (dest, 1), ELEM (cursor1, 1), LEN (len1)); /* POP: overlaps */ /* a[dest] = tmp[cursor2]; */ ASSIGN (dest, cursor2); @@ -684,8 +685,8 @@ gtk_tim_sort(merge_hi) (GtkTimSort *self, count1 = len1 - gtk_tim_sort(gallop_right) (self, cursor2, base1, len1, len1 - 1); if (count1 != 0) { - dest = ELEM (dest, -count1); - cursor1 = ELEM (cursor1, -count1); + dest = ELEM_REV (dest, count1); + cursor1 = ELEM_REV (cursor1, count1); len1 -= count1; memmove (INCPTR (dest), INCPTR (cursor1), LEN (count1)); /* POP: might overlap */ @@ -701,8 +702,8 @@ gtk_tim_sort(merge_hi) (GtkTimSort *self, count2 = len2 - gtk_tim_sort(gallop_left) (self, cursor1, tmp, len2, len2 - 1); if (count2 != 0) { - dest = ELEM (dest, -count2); - cursor2 = ELEM (cursor2, -count2); + dest = ELEM_REV (dest, count2); + cursor2 = ELEM_REV (cursor2, count2); len2 -= count2; memcpy (INCPTR (dest), INCPTR (cursor2), LEN (count2)); /* POP: can't overlap */ if (len2 <= 1) /* len2 == 1 || len2 == 0 */ @@ -725,8 +726,8 @@ outer: if (len2 == 1) { g_assert (len1 > 0); - dest = ELEM (dest, -len1); - cursor1 = ELEM (cursor1, -len1); + dest = ELEM_REV (dest, len1); + cursor1 = ELEM_REV (cursor1, len1); memmove (INCPTR (dest), INCPTR (cursor1), LEN (len1)); /* POP: might overlap */ /* a[dest] = tmp[cursor2]; // Move first elt of run2 to front of merge */ ASSIGN (dest, cursor2); @@ -740,7 +741,7 @@ outer: { g_assert (len1 == 0); g_assert (len2 > 0); - memcpy (ELEM (dest, -(len2 - 1)), tmp, LEN (len2)); /* POP: can't overlap */ + memcpy (ELEM_REV (dest, (len2 - 1)), tmp, LEN (len2)); /* POP: can't overlap */ } } @@ -802,7 +803,7 @@ gtk_tim_sort(merge_at) (GtkTimSort *self, gtk_tim_sort(merge_lo) (self, base1, self->max_merge_size, base2, len2); gtk_tim_sort_set_change (out_change, base1, self->max_merge_size + len2); self->run[i].len -= self->max_merge_size; - self->run[i + 1].base = ELEM (self->run[i + 1].base, - self->max_merge_size); + self->run[i + 1].base = ELEM_REV (self->run[i + 1].base, self->max_merge_size); self->run[i + 1].len += self->max_merge_size; g_assert (ELEM (self->run[i].base, self->run[i].len) == self->run[i + 1].base); return; diff --git a/meson.build b/meson.build index d39c8d2a9e..55c937eb6d 100644 --- a/meson.build +++ b/meson.build @@ -267,6 +267,14 @@ if cc.get_id() == 'msvc' '-D_USE_MATH_DEFINES', required_debug_cflags ] + # Extra warning flags and those that should be disabled because they are too common or + # break features. + test_cflags += [ + '/wd4068', # unknown pragma, triggers for all gcc/clang pragmas + '/wd4116', # breaks G_ALIGNOF() + '/wd4090', # VC2017 is way too aggressive with this + ] + msvc_supported_cflags = cc.get_supported_arguments(test_cflags) if debug required_cflags += required_debug_cflags @@ -339,6 +347,7 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang' 'write-strings', ] + if get_option('buildtype').startswith('debug') foreach warning: extra_warnings test_cflags += '-Werror=@0@'.format(warning) @@ -501,6 +510,10 @@ if have_egl endif cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found()) cdata.set('HAVE_PANGOFT', pangoft_dep.found()) +if win32_enabled + cdata.set('HAVE_PANGOWIN32', pangowin32_dep.found()) + cdata.set('CONST_VTABLE', 1) +endif wayland_pkgs = [] if wayland_enabled diff --git a/tests/testcalendar.c b/tests/testcalendar.c index b4edcac895..3ae4b48f40 100644 --- a/tests/testcalendar.c +++ b/tests/testcalendar.c @@ -1,6 +1,6 @@ /* example-start calendar calendar.c */ /* - * Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund + * Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund * Copyright (C) 2000 Tony Gale * * This library is free software; you can redistribute it and/or modify diff --git a/testsuite/css/parser/color-mix.css b/testsuite/css/parser/color-mix.css index 79dba1ddbd..29b17651a6 100644 --- a/testsuite/css/parser/color-mix.css +++ b/testsuite/css/parser/color-mix.css @@ -51,11 +51,11 @@ m { } n { - color: color-mix(in oklch shorter hue, red, blue); + color: color-mix(in oklch shorter hue, oklch(1 0 0), oklch(0 1 0)); } o { - color: color-mix(in oklab, red, blue); + color: color-mix(in oklab, oklab(1 0 0), oklab(0 1 0)); } p { diff --git a/testsuite/css/parser/color-mix.ref.css b/testsuite/css/parser/color-mix.ref.css index d17ff80b87..dd93325d46 100644 --- a/testsuite/css/parser/color-mix.ref.css +++ b/testsuite/css/parser/color-mix.ref.css @@ -51,11 +51,11 @@ m { } n { - color: oklch(0.539985 0.285449 326.643); + color: oklch(0.5 0.5 0); } o { - color: oklab(0.539985 0.096203 -0.0928409); + color: oklab(0.5 0.5 0); } v { diff --git a/testsuite/gdk/gltexture.c b/testsuite/gdk/gltexture.c index b186b674ad..860b2c5a3b 100644 --- a/testsuite/gdk/gltexture.c +++ b/testsuite/gdk/gltexture.c @@ -1,4 +1,8 @@ #include +#ifdef GDK_WINDOWING_WIN32 +/* epoxy needs this, see https://github.com/anholt/libepoxy/issues/299 */ +#include +#endif #include #include "gdk/gdktextureprivate.h" #include "gdk/gdkglcontextprivate.h" diff --git a/testsuite/gsk/compare-render.c b/testsuite/gsk/compare-render.c index 3ab9cc0ebe..b933ab544d 100644 --- a/testsuite/gsk/compare-render.c +++ b/testsuite/gsk/compare-render.c @@ -831,7 +831,7 @@ main (int argc, char **argv) if (argc <= 2) test->png_file = file_replace_extension (test->node_file, ".node", ".png"); else - test->png_file = g_strdup (argv[2]); + test->png_file = g_canonicalize_filename (argv[2], NULL); g_test_add_vtable (test->node_file, 0, diff --git a/testsuite/gsk/normalize.c b/testsuite/gsk/normalize.c index c7c66175a5..5ca51f32e3 100644 --- a/testsuite/gsk/normalize.c +++ b/testsuite/gsk/normalize.c @@ -6,7 +6,7 @@ static void test_normalize (GskRenderNode *node1, GskRenderNode *node2) { - GskRenderer *renderer = gsk_ngl_renderer_new (); + GskRenderer *renderer = gsk_cairo_renderer_new (); graphene_rect_t bounds1, bounds2; GdkTexture *texture1, *texture2, *diff; GError *error = NULL; diff --git a/testsuite/gtk/calendar.c b/testsuite/gtk/calendar.c index 86c1ad6be5..56dcd2af82 100644 --- a/testsuite/gtk/calendar.c +++ b/testsuite/gtk/calendar.c @@ -28,7 +28,7 @@ test_calendar_select_day (void) cal = gtk_calendar_new (); - tz = g_time_zone_new_identifier ("Europe/Brussels"); + tz = g_time_zone_new_offset (2 * 60 * 60); g_assert_nonnull (tz); dt = g_date_time_new (tz, 1970, 3, 1, 0, 0, 0); g_assert_nonnull (dt); diff --git a/testsuite/gtk/filefilter.c b/testsuite/gtk/filefilter.c index 524efa5fce..b01a2ca077 100644 --- a/testsuite/gtk/filefilter.c +++ b/testsuite/gtk/filefilter.c @@ -90,7 +90,7 @@ static void test_mime_type (void) { GtkFileFilter *filter; - char *attrs; + char *attrs, *content_type; GFileInfo *info; filter = gtk_file_filter_new (); @@ -100,15 +100,21 @@ test_mime_type (void) info = g_file_info_new (); g_file_info_set_display_name (info, "abracadabra"); - g_file_info_set_content_type (info, "text/plain"); + content_type = g_content_type_from_mime_type ("text/plain"); + g_file_info_set_content_type (info, content_type); + g_free (content_type); g_assert_false (gtk_filter_match (GTK_FILTER (filter), info)); g_file_info_set_display_name (info, "dro.png"); - g_file_info_set_content_type (info, "image/png"); + content_type = g_content_type_from_mime_type ("image/png"); + g_file_info_set_content_type (info, content_type); + g_free (content_type); g_assert_true (gtk_filter_match (GTK_FILTER (filter), info)); g_file_info_set_display_name (info, "dro.PNG"); - g_file_info_set_content_type (info, "image/png"); + content_type = g_content_type_from_mime_type ("image/png"); + g_file_info_set_content_type (info, content_type); + g_free (content_type); g_assert_true (gtk_filter_match (GTK_FILTER (filter), info)); g_object_unref (info); @@ -138,7 +144,11 @@ test_buildable (void) filter = GTK_FILE_FILTER (gtk_builder_get_object (builder, "filter")); v1 = gtk_file_filter_to_gvariant (filter); - v2 = g_variant_parse (NULL, "('Audio Files', [(1, 'audio/*')])", NULL, NULL, NULL); + s1 = g_content_type_from_mime_type ("audio/*"); + s2 = g_strdup_printf ("('Audio Files', [(1, '%s')])", s1); + v2 = g_variant_parse (NULL, s2, NULL, NULL, NULL); + g_free (s2); + g_free (s1); s1 = g_variant_print (v1, FALSE); s2 = g_variant_print (v2, FALSE); @@ -176,7 +186,11 @@ test_builder (void) filter = GTK_FILE_FILTER (gtk_builder_get_object (builder, "filter")); v1 = gtk_file_filter_to_gvariant (filter); - v2 = g_variant_parse (NULL, "('Audio Files', [(0, '*.x'), (0, '*.y'), (1, 'audio/*'), (0, '*.[bB][lL][aA][hH]')])", NULL, NULL, NULL); + s1 = g_content_type_from_mime_type ("audio/*"); + s2 = g_strdup_printf ("('Audio Files', [(0, '*.x'), (0, '*.y'), (1, '%s'), (0, '*.[bB][lL][aA][hH]')])", s1); + v2 = g_variant_parse (NULL, s2, NULL, NULL, NULL); + g_free (s2); + g_free (s1); s1 = g_variant_print (v1, FALSE); s2 = g_variant_print (v2, FALSE); diff --git a/testsuite/gtk/fnmatch.c b/testsuite/gtk/fnmatch.c index 25bbc7b0e6..f5738a2372 100644 --- a/testsuite/gtk/fnmatch.c +++ b/testsuite/gtk/fnmatch.c @@ -1,9 +1,7 @@ #include #include "gtk/gtkprivate.h" -#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN) -#define DO_ESCAPE 0 -#else +#if !defined(G_OS_WIN32) && !defined(G_WITH_CYGWIN) #define DO_ESCAPE 1 #endif @@ -25,17 +23,17 @@ static TestCase tests[] = { { "?", "a", TRUE, FALSE, TRUE }, { "?", ".", TRUE, FALSE, FALSE }, { "a?", "a.", TRUE, FALSE, TRUE }, - { "a/?", "a/b", TRUE, FALSE, TRUE }, - { "a/?", "a/.", TRUE, FALSE, FALSE }, - { "?", "/", TRUE, FALSE, FALSE }, + { "a" G_DIR_SEPARATOR_S "?", "a" G_DIR_SEPARATOR_S "b", TRUE, FALSE, TRUE }, + { "a" G_DIR_SEPARATOR_S "?", "a" G_DIR_SEPARATOR_S ".", TRUE, FALSE, FALSE }, + { "?", "" G_DIR_SEPARATOR_S "", TRUE, FALSE, FALSE }, /* Test what * matches */ { "*", "a", TRUE, FALSE, TRUE }, { "*", ".", TRUE, FALSE, FALSE }, { "a*", "a.", TRUE, FALSE, TRUE }, - { "a/*", "a/b", TRUE, FALSE, TRUE }, - { "a/*", "a/.", TRUE, FALSE, FALSE }, - { "*", "/", TRUE, FALSE, FALSE }, + { "a" G_DIR_SEPARATOR_S "*", "a" G_DIR_SEPARATOR_S "b", TRUE, FALSE, TRUE }, + { "a" G_DIR_SEPARATOR_S "*", "a" G_DIR_SEPARATOR_S ".", TRUE, FALSE, FALSE }, + { "*", "" G_DIR_SEPARATOR_S "", TRUE, FALSE, FALSE }, /* Range tests */ { "[ab]", "a", TRUE, FALSE, TRUE }, @@ -61,9 +59,9 @@ static TestCase tests[] = { /* Ranges and special no-wildcard matches */ { "[.]", ".", TRUE, FALSE, FALSE }, { "a[.]", "a.", TRUE, FALSE, TRUE }, - { "a/[.]", "a/.", TRUE, FALSE, FALSE }, - { "[/]", "/", TRUE, FALSE, FALSE }, - { "[^/]", "a", TRUE, FALSE, TRUE }, + { "a" G_DIR_SEPARATOR_S "[.]", "a" G_DIR_SEPARATOR_S ".", TRUE, FALSE, FALSE }, + { "[" G_DIR_SEPARATOR_S "]", "" G_DIR_SEPARATOR_S "", TRUE, FALSE, FALSE }, + { "[^" G_DIR_SEPARATOR_S "]", "a", TRUE, FALSE, TRUE }, /* Basic tests of * (and combinations of * and ?) */ { "a*b", "ab", TRUE, FALSE, TRUE }, @@ -81,8 +79,8 @@ static TestCase tests[] = { { "a*[cd]", "axc", TRUE, FALSE, TRUE }, { "a*[cd]", "axx", TRUE, FALSE, FALSE }, - { "a/[.]", "a/.", TRUE, FALSE, FALSE }, - { "a*[.]", "a/.", TRUE, FALSE, FALSE }, + { "a" G_DIR_SEPARATOR_S "[.]", "a" G_DIR_SEPARATOR_S ".", TRUE, FALSE, FALSE }, + { "a*[.]", "a" G_DIR_SEPARATOR_S ".", TRUE, FALSE, FALSE }, /* Test of UTF-8 */ diff --git a/testsuite/gtk/object.c b/testsuite/gtk/object.c index 96e9daa9cf..1dd841af0c 100644 --- a/testsuite/gtk/object.c +++ b/testsuite/gtk/object.c @@ -40,7 +40,7 @@ __dvalue == 0.5 ? "medium" : \ __dvalue > 0 && __dvalue < 1 ? "fractional" : \ "random") -#define MATCH_ANY_VALUE ((void*) 0xf1874c23) +#define MATCH_ANY_VALUE ((void*) (gsize) 0xf1874c23) /* --- ignored property names --- */ typedef struct { @@ -54,19 +54,19 @@ list_ignore_properties (gboolean buglist) /* currently untestable properties */ static const IgnoreProperty ignore_properties[] = { { "GtkWidget", "parent", NULL, }, /* needs working parent widget */ - { "GtkWidget", "has-default", (void*) TRUE, }, /* conflicts with toplevel-less widgets */ - { "GtkWidget", "display", (void*) MATCH_ANY_VALUE }, + { "GtkWidget", "has-default", (void*) (gsize) TRUE, }, /* conflicts with toplevel-less widgets */ + { "GtkWidget", "display", (void*) (gsize) MATCH_ANY_VALUE }, { "GtkCellView", "background", (void*) "", }, /* "" is not a valid background color */ { "GtkFileChooserWidget", "select-multiple", (void*) 0x1 }, /* property conflicts */ - { "GtkFileChooserDialog", "select-multiple", (void*) MATCH_ANY_VALUE }, /* property disabled */ - { "GtkTextView", "overwrite", (void*) MATCH_ANY_VALUE }, /* needs text buffer */ - { "GtkTreeView", "expander-column", (void*) MATCH_ANY_VALUE }, /* assertion list != NULL */ - { "GtkWindow", "display", (void*) MATCH_ANY_VALUE }, + { "GtkFileChooserDialog", "select-multiple", (void*) (gsize) MATCH_ANY_VALUE }, /* property disabled */ + { "GtkTextView", "overwrite", (void*) (gsize) MATCH_ANY_VALUE }, /* needs text buffer */ + { "GtkTreeView", "expander-column", (void*) (gsize) MATCH_ANY_VALUE }, /* assertion list != NULL */ + { "GtkWindow", "display", (void*) (gsize) MATCH_ANY_VALUE }, { NULL, NULL, NULL } }; /* properties suspected to be Gdk/Gtk+ bugs */ static const IgnoreProperty bug_properties[] = { - { "GtkComboBox", "active", (void*) MATCH_ANY_VALUE }, /* FIXME: triggers NULL model bug */ + { "GtkComboBox", "active", (void*) (gsize) MATCH_ANY_VALUE }, /* FIXME: triggers NULL model bug */ { NULL, NULL, NULL } }; if (buglist) diff --git a/testsuite/meson.build b/testsuite/meson.build index e4033e7c10..8fb7a99362 100644 --- a/testsuite/meson.build +++ b/testsuite/meson.build @@ -9,7 +9,6 @@ if catch.found() endif common_env = [ - 'GIO_USE_VOLUME_MONITOR=unix', 'GIO_USE_VFS=local', 'GSETTINGS_BACKEND=memory', 'GTK_CSD=1', @@ -20,6 +19,13 @@ common_env = [ ] exclude_unstable = ['flaky', 'failing'] +if os_win32 + common_env += [ 'GIO_USE_VOLUME_MONITOR=win32' ] +else + common_env += [ 'GIO_USE_VOLUME_MONITOR=unix' ] +endif + + setups = [ { 'backend': 'x11', 'if': x11_enabled, }, { 'backend': 'wayland', 'if': wayland_enabled, 'is_default': true, },