Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fcitx5-gtk for openSUSE:Factory checked in at 2022-07-05 12:09:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fcitx5-gtk (Old) and /work/SRC/openSUSE:Factory/.fcitx5-gtk.new.1548 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fcitx5-gtk" Tue Jul 5 12:09:56 2022 rev:4 rq:986787 version:5.0.16 Changes: -------- --- /work/SRC/openSUSE:Factory/fcitx5-gtk/fcitx5-gtk.changes 2022-03-12 17:16:16.786361322 +0100 +++ /work/SRC/openSUSE:Factory/.fcitx5-gtk.new.1548/fcitx5-gtk.changes 2022-07-05 12:10:29.856644408 +0200 @@ -1,0 +2,18 @@ +Mon Jul 4 13:07:24 UTC 2022 - Haochuan Chen <yjco...@mail.nankai.edu.cn> + +- Update to version 5.0.16 + * Also monitor user theme config file. + * Make sure we set client_window/widget to null if app set it. +- Update to version 5.0.15 + * gio unix is only im modules's dependency. + * Do now show size 0 window. + * Depend on gio-unix-2.0 (#18) +- Update to version 5.0.14 + * properly use g_cancellable in watcher. + * Free the address returned from g_dbus_address_get_for_bus_sync + * Change the dbus connection used by watcher + * Set no exit on close for the dbus connection used by fcitx im module. + * Add shadow margin support to gtk client side input panel + * fix: Compatible with glib 2.5.58 < 2.60 (#17) + +------------------------------------------------------------------- Old: ---- fcitx5-gtk-5.0.13.tar.xz New: ---- fcitx5-gtk-5.0.16.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fcitx5-gtk.spec ++++++ --- /var/tmp/diff_new_pack.oxJFu3/_old 2022-07-05 12:10:30.312645063 +0200 +++ /var/tmp/diff_new_pack.oxJFu3/_new 2022-07-05 12:10:30.316645069 +0200 @@ -17,7 +17,7 @@ Name: fcitx5-gtk -Version: 5.0.13 +Version: 5.0.16 Release: 0 Summary: Gtk im module for fcitx5 and glib based dbus client library License: LGPL-2.1-or-later ++++++ fcitx5-gtk-5.0.13.tar.xz -> fcitx5-gtk-5.0.16.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/CMakeLists.txt new/fcitx5-gtk-5.0.16/CMakeLists.txt --- old/fcitx5-gtk-5.0.13/CMakeLists.txt 2022-03-09 19:25:54.213611100 +0100 +++ new/fcitx5-gtk-5.0.16/CMakeLists.txt 2022-07-03 19:55:31.059709800 +0200 @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.6) -project(fcitx5-gtk VERSION 5.0.13) +project(fcitx5-gtk VERSION 5.0.16) find_package(ECM REQUIRED 1.0.0) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) @@ -28,6 +28,7 @@ find_package(XKBCommon) pkg_check_modules(GLib2 REQUIRED IMPORTED_TARGET "glib-2.0>=2.56") pkg_check_modules(Gio2 REQUIRED IMPORTED_TARGET "gio-2.0") +pkg_check_modules(GioUnix2 REQUIRED IMPORTED_TARGET "gio-unix-2.0") pkg_check_modules(GObject2 REQUIRED IMPORTED_TARGET "gobject-2.0") add_subdirectory(fcitx-gclient) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/fcitx-gclient/fcitxgwatcher.c new/fcitx5-gtk-5.0.16/fcitx-gclient/fcitxgwatcher.c --- old/fcitx5-gtk-5.0.13/fcitx-gclient/fcitxgwatcher.c 2020-06-06 18:53:49.012347000 +0200 +++ new/fcitx5-gtk-5.0.16/fcitx-gclient/fcitxgwatcher.c 2022-05-14 07:55:31.279727000 +0200 @@ -129,6 +129,27 @@ _fcitx_g_watcher_update_availability(self); } +static void _fcitx_g_watcher_start_watch(FcitxGWatcher *self) { + if (!self->priv->watched) { + return; + } + g_clear_object(&self->priv->cancellable); + self->priv->cancellable = g_cancellable_new(); + gchar *address = g_dbus_address_get_for_bus_sync( + G_BUS_TYPE_SESSION, self->priv->cancellable, NULL); + if (!address) { + g_clear_object(&self->priv->cancellable); + return; + } + g_object_ref(self); + g_dbus_connection_new_for_address( + address, + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | + G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION, + NULL, self->priv->cancellable, _fcitx_g_watcher_get_bus_finished, self); + g_free(address); +} + /** * fcitx_g_watcher_watch * @self: a #FcitxGWatcher @@ -138,12 +159,35 @@ void fcitx_g_watcher_watch(FcitxGWatcher *self) { g_return_if_fail(!self->priv->watched); - g_object_ref(self); - g_bus_get(G_BUS_TYPE_SESSION, self->priv->cancellable, - _fcitx_g_watcher_get_bus_finished, self); self->priv->watched = TRUE; + _fcitx_g_watcher_start_watch(self); }; +static gboolean _fcitx_g_watcher_recheck(gpointer user_data) { + FcitxGWatcher *self = user_data; + + _fcitx_g_watcher_start_watch(self); + return FALSE; +} + +void _fcitx_g_watcher_connection_closed( + GDBusConnection *connection G_GNUC_UNUSED, + gboolean remote_peer_vanished G_GNUC_UNUSED, GError *error G_GNUC_UNUSED, + gpointer user_data) { + + g_return_if_fail(user_data != NULL); + g_return_if_fail(FCITX_G_IS_WATCHER(user_data)); + + FcitxGWatcher *self = FCITX_G_WATCHER(user_data); + _fcitx_g_watcher_clean_up(self); + if (self->priv->watched) { + _fcitx_g_watcher_update_availability(self); + + g_timeout_add_full(G_PRIORITY_DEFAULT, 100, _fcitx_g_watcher_recheck, + g_object_ref(self), g_object_unref); + } +} + static void _fcitx_g_watcher_get_bus_finished(G_GNUC_UNUSED GObject *source_object, GAsyncResult *res, gpointer user_data) { @@ -151,11 +195,19 @@ g_return_if_fail(FCITX_G_IS_WATCHER(user_data)); FcitxGWatcher *self = FCITX_G_WATCHER(user_data); + // Need to call finish because clean up, otherwise cancellable will set the + // return value. + GDBusConnection *connection = + g_dbus_connection_new_for_address_finish(res, NULL); _fcitx_g_watcher_clean_up(self); - self->priv->connection = g_bus_get_finish(res, NULL); - if (!self->priv->connection) { + if (!connection) { + g_object_unref(self); return; } + self->priv->connection = connection; + g_dbus_connection_set_exit_on_close(self->priv->connection, FALSE); + g_signal_connect(self->priv->connection, "closed", + (GCallback)_fcitx_g_watcher_connection_closed, self); self->priv->watch_id = g_bus_watch_name(G_BUS_TYPE_SESSION, FCITX_MAIN_SERVICE_NAME, @@ -171,7 +223,7 @@ _fcitx_g_watcher_update_availability(self); - /* unref for fcitx_g_watcher_watch */ + /* unref for _fcitx_g_watcher_start_watch */ g_object_unref(self); } @@ -225,6 +277,9 @@ } void _fcitx_g_watcher_clean_up(FcitxGWatcher *self) { + if (self->priv->cancellable) { + g_cancellable_cancel(self->priv->cancellable); + } if (self->priv->watch_id) { g_bus_unwatch_name(self->priv->watch_id); self->priv->watch_id = 0; @@ -234,6 +289,10 @@ self->priv->portal_watch_id = 0; } + if (self->priv->connection) { + g_signal_handlers_disconnect_by_data(self->priv->connection, self); + } + g_clear_pointer(&self->priv->main_owner, g_free); g_clear_pointer(&self->priv->portal_owner, g_free); g_clear_object(&self->priv->cancellable); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/gtk2/fcitximcontext.cpp new/fcitx5-gtk-5.0.16/gtk2/fcitximcontext.cpp --- old/fcitx5-gtk-5.0.13/gtk2/fcitximcontext.cpp 2022-02-21 05:57:07.740442800 +0100 +++ new/fcitx5-gtk-5.0.16/gtk2/fcitximcontext.cpp 2022-06-30 06:09:22.981732600 +0200 @@ -430,7 +430,12 @@ g_clear_pointer(&context->preedit_string, g_free); g_clear_pointer(&context->surrounding_text, g_free); g_clear_pointer(&context->attrlist, pango_attr_list_unref); - g_queue_clear_full(&context->gdk_events, (GDestroyNotify)gdk_event_free); + /* https://github.com/GNOME/glib/blob/main/glib/gqueue.c#L164 + * Compatible with glib 2.5.58 < 2.60 + * g_queue_clear_full(&context->gdk_events, + * (GDestroyNotify)gdk_event_free);*/ + g_queue_foreach(&context->gdk_events, (GFunc)gdk_event_free, NULL); + g_queue_clear(&context->gdk_events); G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -439,10 +444,10 @@ static void fcitx_im_context_set_client_window(GtkIMContext *context, GdkWindow *client_window) { FcitxIMContext *fcitxcontext = FCITX_IM_CONTEXT(context); - if (!client_window) - return; - g_clear_object(&fcitxcontext->client_window); + if (!client_window) { + return; + } fcitxcontext->client_window = GDK_WINDOW(g_object_ref(client_window)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/gtk3/CMakeLists.txt new/fcitx5-gtk-5.0.16/gtk3/CMakeLists.txt --- old/fcitx5-gtk-5.0.13/gtk3/CMakeLists.txt 2022-02-21 05:57:07.740442800 +0100 +++ new/fcitx5-gtk-5.0.16/gtk3/CMakeLists.txt 2022-06-01 20:51:00.192110800 +0200 @@ -15,7 +15,7 @@ set_target_properties(im-fcitx5-gtk3 PROPERTIES PREFIX "" OUTPUT_NAME "im-fcitx5" COMPILE_FLAGS "-fno-exceptions") -target_link_libraries(im-fcitx5-gtk3 Fcitx5::GClient XKBCommon::XKBCommon PkgConfig::Gtk3) +target_link_libraries(im-fcitx5-gtk3 Fcitx5::GClient XKBCommon::XKBCommon PkgConfig::Gtk3 PkgConfig::GioUnix2) if (TARGET PkgConfig::Gdk3X11) target_link_libraries(im-fcitx5-gtk3 PkgConfig::Gdk3X11 X11Import) endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/gtk3/fcitximcontext.cpp new/fcitx5-gtk-5.0.16/gtk3/fcitximcontext.cpp --- old/fcitx5-gtk-5.0.13/gtk3/fcitximcontext.cpp 2022-02-21 05:57:07.740442800 +0100 +++ new/fcitx5-gtk-5.0.16/gtk3/fcitximcontext.cpp 2022-06-30 06:09:22.981732600 +0200 @@ -495,7 +495,12 @@ g_clear_pointer(&context->preedit_string, g_free); g_clear_pointer(&context->surrounding_text, g_free); g_clear_pointer(&context->attrlist, pango_attr_list_unref); - g_queue_clear_full(&context->gdk_events, (GDestroyNotify)gdk_event_free); + /* https://github.com/GNOME/glib/blob/main/glib/gqueue.c#L164 + * Compatible with glib 2.5.58 < 2.60 + * g_queue_clear_full(&context->gdk_events, + * (GDestroyNotify)gdk_event_free);*/ + g_queue_foreach(&context->gdk_events, (GFunc)gdk_event_free, NULL); + g_queue_clear(&context->gdk_events); G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -509,10 +514,11 @@ } delete fcitxcontext->candidate_window; fcitxcontext->candidate_window = nullptr; - if (!client_window) + g_clear_object(&fcitxcontext->client_window); + if (!client_window) { return; + } - g_clear_object(&fcitxcontext->client_window); fcitxcontext->client_window = GDK_WINDOW(g_object_ref(client_window)); _fcitx_im_context_set_capability(fcitxcontext, FALSE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/gtk3/fcitxtheme.cpp new/fcitx5-gtk-5.0.16/gtk3/fcitxtheme.cpp --- old/fcitx5-gtk-5.0.13/gtk3/fcitxtheme.cpp 2022-02-21 05:57:07.740442800 +0100 +++ new/fcitx5-gtk-5.0.16/gtk3/fcitxtheme.cpp 2022-07-03 02:22:02.846562400 +0200 @@ -743,6 +743,7 @@ prev.load(file, "InputPanel/PrevPage"); next.load(file, "InputPanel/NextPage"); blurMargin.load(file, "InputPanel/BlurMargin"); + shadowMargin.load(file, "InputPanel/ShadowMargin"); } void MarginConfig::load(GKeyFile *file, const char *group) { @@ -796,6 +797,7 @@ } ClassicUIConfig::~ClassicUIConfig() { + resetThemeFileMonitor(); if (monitor_) { g_signal_handlers_disconnect_by_func( monitor_.get(), @@ -807,9 +809,10 @@ void ClassicUIConfig::load() { UniqueCPtr<GKeyFile, g_key_file_unref> configFile{g_key_file_new()}; - auto file = locateXdgConfigFile("fcitx5/conf/classicui.conf"); + auto filename = locateXdgConfigFile("fcitx5/conf/classicui.conf"); gchar *content = nullptr; - if (file && g_file_get_contents(file.get(), &content, nullptr, nullptr)) { + if (filename && + g_file_get_contents(filename.get(), &content, nullptr, nullptr)) { UniqueCPtr<gchar, g_free> ini(g_strdup_printf("[Group]\n%s", content)); g_free(content); g_key_file_load_from_data(configFile.get(), ini.get(), -1, @@ -826,6 +829,32 @@ configFile.get(), "Group", "UseInputMethodLangaugeToDisplayText", true); theme_.load(themeName_); + + resetThemeFileMonitor(); + if (!theme_.name().empty()) { + UniqueCPtr<char, g_free> filename( + g_build_filename(g_get_user_data_dir(), "fcitx5/themes", + theme_.name().data(), "theme.conf", nullptr)); + GObjectUniquePtr<GFile> file(g_file_new_for_path(filename.get())); + themeFileMonitor_.reset(g_file_monitor_file( + file.get(), G_FILE_MONITOR_NONE, nullptr, nullptr)); + + g_signal_connect(themeFileMonitor_.get(), "changed", + G_CALLBACK(&ClassicUIConfig::configChangedCallback), + this); + } +} + +void ClassicUIConfig::resetThemeFileMonitor() { + if (!themeFileMonitor_) { + return; + } + g_signal_handlers_disconnect_by_func( + themeFileMonitor_.get(), + reinterpret_cast<gpointer>( + G_CALLBACK(&ClassicUIConfig::configChangedCallback)), + this); + themeFileMonitor_.reset(); } } // namespace fcitx::gtk diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/gtk3/fcitxtheme.h new/fcitx5-gtk-5.0.16/gtk3/fcitxtheme.h --- old/fcitx5-gtk-5.0.13/gtk3/fcitxtheme.h 2022-02-21 05:57:07.740442800 +0100 +++ new/fcitx5-gtk-5.0.16/gtk3/fcitxtheme.h 2022-07-03 02:22:02.879898300 +0200 @@ -79,6 +79,7 @@ ActionImageConfig prev; ActionImageConfig next; MarginConfig blurMargin; + MarginConfig shadowMargin; }; class ThemeImage { @@ -143,6 +144,8 @@ void paint(cairo_t *c, const ActionImageConfig &cfg, double alpha = 1.0); + const auto &name() const { return name_; } + private: std::unordered_map<const BackgroundImageConfig *, ThemeImage> backgroundImageTable_; @@ -165,6 +168,8 @@ Theme theme_; private: + void resetThemeFileMonitor(); + static void configChangedCallback(GFileMonitor *, GFile *, GFile *, GFileMonitorEvent event_type, gpointer user_data) { @@ -176,6 +181,7 @@ } GObjectUniquePtr<GFileMonitor> monitor_; + GObjectUniquePtr<GFileMonitor> themeFileMonitor_; }; inline void cairoSetSourceColor(cairo_t *cr, const GdkRGBA &color) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/gtk3/gtk3inputwindow.cpp new/fcitx5-gtk-5.0.16/gtk3/gtk3inputwindow.cpp --- old/fcitx5-gtk-5.0.13/gtk3/gtk3inputwindow.cpp 2022-02-21 06:25:33.487420600 +0100 +++ new/fcitx5-gtk-5.0.16/gtk3/gtk3inputwindow.cpp 2022-06-30 06:09:22.981732600 +0200 @@ -5,6 +5,7 @@ * */ #include "gtk3inputwindow.h" +#include "fcitxtheme.h" #include <gtk/gtk.h> namespace fcitx::gtk { @@ -18,6 +19,8 @@ g_signal_handlers_disconnect_by_data(window_.get(), this); window_.reset(); } + // Clean up weak pointer reference. + setParent(nullptr); } void Gtk3InputWindow::draw(cairo_t *cr) { paint(cr, width_, height_); } @@ -87,6 +90,18 @@ dpi_ = gdk_screen_get_resolution(gtk_widget_get_screen(window_.get())); pango_cairo_context_set_resolution(context_.get(), dpi_); std::tie(width_, height_) = sizeHint(); + if (width_ <= 0 || height_ <= 0) { + gtk_widget_hide(window_.get()); + return; + } + + if (auto gdkWindow = gtk_widget_get_window(window_.get())) { + gdk_window_set_shadow_width( + gdkWindow, config_->theme_.shadowMargin.marginLeft, + config_->theme_.shadowMargin.marginRight, + config_->theme_.shadowMargin.marginTop, + config_->theme_.shadowMargin.marginBottom); + } gtk_widget_realize(window_.get()); gtk_window_resize(GTK_WINDOW(window_.get()), width_, height_); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/gtk4/CMakeLists.txt new/fcitx5-gtk-5.0.16/gtk4/CMakeLists.txt --- old/fcitx5-gtk-5.0.13/gtk4/CMakeLists.txt 2022-02-21 05:57:07.743776000 +0100 +++ new/fcitx5-gtk-5.0.16/gtk4/CMakeLists.txt 2022-06-01 20:51:00.192110800 +0200 @@ -15,7 +15,7 @@ add_library(im-fcitx5-gtk4 MODULE ${FCITX_GTK4_IM_MODULE_SOURCES}) set_target_properties(im-fcitx5-gtk4 PROPERTIES OUTPUT_NAME "im-fcitx5" COMPILE_FLAGS "-fno-exceptions") -target_link_libraries(im-fcitx5-gtk4 Fcitx5::GClient XKBCommon::XKBCommon PkgConfig::Gtk4) +target_link_libraries(im-fcitx5-gtk4 Fcitx5::GClient XKBCommon::XKBCommon PkgConfig::Gtk4 PkgConfig::GioUnix2) if (TARGET PkgConfig::Gtk4X11) target_link_libraries(im-fcitx5-gtk4 PkgConfig::Gtk4X11 X11Import) endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/gtk4/fcitximcontext.cpp new/fcitx5-gtk-5.0.16/gtk4/fcitximcontext.cpp --- old/fcitx5-gtk-5.0.13/gtk4/fcitximcontext.cpp 2022-02-21 05:57:07.743776000 +0100 +++ new/fcitx5-gtk-5.0.16/gtk4/fcitximcontext.cpp 2022-06-30 06:09:22.981732600 +0200 @@ -448,10 +448,10 @@ delete fcitxcontext->candidate_window; fcitxcontext->candidate_window = nullptr; + g_clear_object(&fcitxcontext->client_widget); if (!client_widget) return; - g_clear_object(&fcitxcontext->client_widget); fcitxcontext->client_widget = GTK_WIDGET(g_object_ref(client_widget)); _fcitx_im_context_set_capability(fcitxcontext, FALSE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-gtk-5.0.13/gtk4/gtk4inputwindow.cpp new/fcitx5-gtk-5.0.16/gtk4/gtk4inputwindow.cpp --- old/fcitx5-gtk-5.0.13/gtk4/gtk4inputwindow.cpp 2022-02-21 06:25:33.487420600 +0100 +++ new/fcitx5-gtk-5.0.16/gtk4/gtk4inputwindow.cpp 2022-06-30 06:09:22.981732600 +0200 @@ -6,6 +6,7 @@ */ #include "gtk4inputwindow.h" #include <gtk/gtk.h> +#include <gtk3/fcitxtheme.h> namespace fcitx::gtk { @@ -19,6 +20,8 @@ g_signal_handlers_disconnect_by_data(window_.get(), this); gdk_surface_destroy(window_.release()); } + // Clean up weak pointer. + setParent(nullptr); } void Gtk4InputWindow::draw(cairo_t *cr) { paint(cr, width_, height_); } @@ -72,6 +75,10 @@ syncFontOptions(); std::tie(width_, height_) = sizeHint(); + if (width_ <= 0 || height_ <= 0) { + resetWindow(); + return; + } auto native = gtk_widget_get_native(parent_); if (!native) { return; @@ -143,6 +150,12 @@ gdk_popup_layout_set_anchor_hints( popupLayout, static_cast<GdkAnchorHints>(GDK_ANCHOR_SLIDE_X | GDK_ANCHOR_FLIP_Y)); + + gdk_popup_layout_set_shadow_width( + popupLayout, config_->theme_.shadowMargin.marginLeft, + config_->theme_.shadowMargin.marginRight, + config_->theme_.shadowMargin.marginTop, + config_->theme_.shadowMargin.marginBottom); gdk_popup_present(GDK_POPUP(window_.get()), width_, height_, popupLayout); gdk_popup_layout_unref(popupLayout); }