sync to 2.6.0-3

This commit is contained in:
liuxinhao 2024-04-09 16:16:16 +08:00
parent 755a3df853
commit b69197a743
10 changed files with 465 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 78d16412005f188c799dbf80bc9072bc77471fe2 Mon Sep 17 00:00:00 2001
From: yangfeng <yangfeng@kylinsec.com.cn>
Date: Mon, 11 Dec 2023 10:49:16 +0800
Subject: [PATCH 0/5] fix(tasklist-app-button):Fix touch screen taskbar button
click judged as drag
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复触摸屏任务栏按钮点击被判定为拖动
Related #23600
---
src/tasklist/tasklist-app-button.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/tasklist/tasklist-app-button.cpp b/src/tasklist/tasklist-app-button.cpp
index cd8b2c3..15c8cb0 100644
--- a/src/tasklist/tasklist-app-button.cpp
+++ b/src/tasklist/tasklist-app-button.cpp
@@ -397,6 +397,11 @@ void TasklistAppButton::on_gesture_drag_update(double x, double y)
{
Gtk::Allocation allocation;
+ if (x < 10 && y < 10)
+ {
+ return;
+ }
+
/* 设置拖动过程中的光标样式 */
auto cursor = Gdk::Cursor::create(get_display(), "move");
get_window()->set_cursor(cursor);
--
2.27.0

View File

@ -0,0 +1,30 @@
From fa552176bffd1878a688107cbbad871401b09417 Mon Sep 17 00:00:00 2001
From: yangfeng <yangfeng@kylinsec.com.cn>
Date: Thu, 21 Dec 2023 10:05:44 +0800
Subject: [PATCH 1/5] feature(menu): Other workspace Windows are not displayed
by default.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 默认不显示其他工作区窗口
---
data/com.kylinsec.kiran.taskbar.gschema.xml.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/data/com.kylinsec.kiran.taskbar.gschema.xml.in b/data/com.kylinsec.kiran.taskbar.gschema.xml.in
index f433706..dfde810 100644
--- a/data/com.kylinsec.kiran.taskbar.gschema.xml.in
+++ b/data/com.kylinsec.kiran.taskbar.gschema.xml.in
@@ -5,7 +5,7 @@
<default>['org.gnome.Software.desktop', 'firefox.desktop', 'caja.desktop', 'mate-terminal.desktop']</default>
</key>
<key name="show-active-workspace-apps" type="b">
- <default>false</default>
+ <default>true</default>
<summary>Whether only show apps for current active workspace on the taskbar</summary>
</key>
</schema>
--
2.27.0

View File

@ -0,0 +1,44 @@
From 43d27f12fff46595631802ea65b400df4ce44cd8 Mon Sep 17 00:00:00 2001
From: yangfeng <yangfeng@kylinsec.com.cn>
Date: Wed, 27 Dec 2023 14:41:52 +0800
Subject: [PATCH 2/5] fix(recent-files-list-box):Fixed an issue where recent
documents were not sorted
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复最近文档列表没有排序的问题
Related #24803
---
src/menu/recent-files-list-box.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/menu/recent-files-list-box.cpp b/src/menu/recent-files-list-box.cpp
index 3ae481e..5226123 100644
--- a/src/menu/recent-files-list-box.cpp
+++ b/src/menu/recent-files-list-box.cpp
@@ -17,6 +17,7 @@
#include "kiran-helper.h"
#include "kiran-opacity-menu.h"
#include "lib/base.h"
+#include <algorithm>
RecentFilesListBox::RecentFilesListBox() : filter_pattern("*")
{
@@ -50,7 +51,11 @@ void RecentFilesListBox::load()
delete row;
}
- for (auto info : Gtk::RecentManager::get_default()->get_items())
+ std::vector<Glib::RefPtr<Gtk::RecentInfo>> items = Gtk::RecentManager::get_default()->get_items();
+ std::sort(items.begin(), items.end(), [](Glib::RefPtr<Gtk::RecentInfo> a, Glib::RefPtr<Gtk::RecentInfo> b)
+ { return a->get_modified() > b->get_modified(); });
+
+ for (auto info : items)
{
Gtk::ListBoxRow *row = nullptr;
auto cell = create_recent_item(info);
--
2.27.0

View File

@ -0,0 +1,126 @@
From 85fd4546c3b2cdfb4e29e78366b375f4964abd70 Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Mon, 8 Jan 2024 09:40:13 +0800
Subject: [PATCH 3/5] fix(tray):Fixed an issue where the x11 tray icon did not
match the size of the icon container, causing the tray icon to display
abnormally
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复x11托盘图标高度与图标容器的高度不匹配导致的托盘图标显示异常的问题
Related #22117
---
src/tray/kiran-tray.c | 56 +++++++++++++++++++++++++++++++++-
src/tray/kiran-x11-tray-icon.h | 2 +-
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/src/tray/kiran-tray.c b/src/tray/kiran-tray.c
index 9f7a236..9744ccc 100644
--- a/src/tray/kiran-tray.c
+++ b/src/tray/kiran-tray.c
@@ -29,6 +29,7 @@
#include "kiran-x11-tray-manager.h"
#include "kiran-x11-tray-socket.h"
#include "tray-i.h"
+#include "kiran-x11-tray-icon.h"
#define ROOT_NODE_NAME "apps"
#define APP_NODE_NAME "app"
@@ -1035,6 +1036,32 @@ get_widget_geometry(GtkWidget *widget)
return data;
}
+void kiran_tray_resize_x11_icon_window(GdkDisplay *display,Window icon_window,GtkWidget *widget)
+{
+ XWindowAttributes window_attributes;
+ Status status = XGetWindowAttributes(GDK_DISPLAY_XDISPLAY(display),icon_window,&window_attributes);
+ if(status == 0)
+ {
+ g_info("get window attributes failed");
+ return;
+ }
+ g_debug("window attributes: widget: %d, height:%d ",window_attributes.width , window_attributes.height);
+
+ GtkAllocation icon_allocation;
+ gtk_widget_get_allocation(widget, &icon_allocation);
+ g_debug("icon container allocation height:%d",icon_allocation.height);
+
+ /**
+ * 这里只将window的高与图标容器的高保持一致暂不限制window的宽 (#22117)
+ */
+ if(window_attributes.height != icon_allocation.height)
+ {
+ g_debug("resize X window");
+ XResizeWindow(GDK_DISPLAY_XDISPLAY(display),icon_window,window_attributes.width,icon_allocation.height);
+ XFlush(GDK_DISPLAY_XDISPLAY(display));
+ }
+}
+
static void
icon_size_allocate_callback(GtkWidget *widget,
GdkRectangle *allocation,
@@ -1043,6 +1070,7 @@ icon_size_allocate_callback(GtkWidget *widget,
KiranTray *tray;
KiranTrayPrivate *priv;
gchar *geometry;
+ const char *id;
if (!gtk_widget_is_visible(widget))
return;
@@ -1051,11 +1079,37 @@ icon_size_allocate_callback(GtkWidget *widget,
priv = tray->priv;
geometry = get_widget_geometry(widget);
+
+ id = kiran_notify_icon_get_id(KIRAN_NOTIFY_ICON(widget));
+ g_debug("icon size allocate changed: id:%s, %s",id ? id : "NULL",geometry);
+
kiran_sn_manager_gen_emit_geometry_changed(KIRAN_SN_MANAGER_GEN(priv->skeleton),
kiran_notify_icon_get_id(KIRAN_NOTIFY_ICON(widget)),
geometry);
-
g_free(geometry);
+
+ if(KIRAN_IS_X11_TRAY_ICON(KIRAN_X11_TRAY_ICON(widget)))
+ {
+ Window icon_window;
+ icon_window = kiran_x11_tray_icon_get_icon_window(KIRAN_X11_TRAY_ICON(widget));
+ g_debug("%s is x11 tray icon, window id : %d",id ? id : "NULL",icon_window);
+
+ if(!icon_window)
+ {
+ return;
+ }
+
+ GdkDisplay *display;
+ GdkScreen *screen;
+ screen = gtk_widget_get_screen(GTK_WIDGET(user_data));
+ display = gdk_screen_get_display(screen);
+
+ gdk_x11_display_error_trap_push(display);
+
+ kiran_tray_resize_x11_icon_window(display,icon_window,widget);
+
+ gdk_x11_display_error_trap_pop(display);
+ }
}
static gboolean
diff --git a/src/tray/kiran-x11-tray-icon.h b/src/tray/kiran-x11-tray-icon.h
index dfeb1d9..544485c 100644
--- a/src/tray/kiran-x11-tray-icon.h
+++ b/src/tray/kiran-x11-tray-icon.h
@@ -23,7 +23,7 @@ G_BEGIN_DECLS
#define KIRAN_TYPE_X11_TRAY_ICON (kiran_x11_tray_icon_get_type())
#define KIRAN_X11_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), KIRAN_TYPE_X11_TRAY_ICON, KiranX11TrayIcon))
#define KIRAN_X11_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), KIRAN_TYPE_X11_TRAY_ICON, KiranX11TrayIconClass))
-#define KIRAN_IS_X11_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KIRAN_TYPE_X11_TRAY_ICON)
+#define KIRAN_IS_X11_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KIRAN_TYPE_X11_TRAY_ICON))
#define KIRAN_IS_X11_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), KIRAN_TYPE_X11_TRAY_ICON))
#define KIRAN_X11_TRAY_CION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), KIRAN_TYPE_X11_TRAY_ICON, KiranX11TrayIconClass))
--
2.27.0

View File

@ -0,0 +1,46 @@
From 05b478aa0b743794d3858c2c195574a09ba4075b Mon Sep 17 00:00:00 2001
From: yangfeng <yangfeng@kylinsec.com.cn>
Date: Mon, 8 Jan 2024 15:34:48 +0800
Subject: [PATCH 4/5] fix(common):Fix Pinyin search failed when
/etc/locale.conf is not LANG="zh_CN.UTF-8"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复当 /etc/locale.conf 不是 LANG="zh_CN.UTF-8" 时,拼音搜索失败
Related #21369
---
lib/common.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/common.cpp b/lib/common.cpp
index a2f8567..bcd0890 100644
--- a/lib/common.cpp
+++ b/lib/common.cpp
@@ -53,6 +53,12 @@ convert_chars_to_wchars(const std::string &contents)
size_t mbs_len;
wchar_t *wcs;
+ // mbstowcs 依赖全局 locale && GTK+中只认 UTF-8
+ // 当 /etc/locale.conf 为 zh_CN.utf8 时,结果正常; 当为 zh_CN.GB18030 时,结果不正常
+ // 所以此处需要设置为 utf-8
+ std::string prev_loc = std::setlocale(LC_CTYPE, nullptr);
+ setlocale(LC_CTYPE, "C.utf8");
+
mbs_len = mbstowcs(NULL, contents.c_str(), 0);
if (mbs_len == (size_t)-1)
{
@@ -70,6 +76,9 @@ convert_chars_to_wchars(const std::string &contents)
free(wcs);
return NULL;
}
+
+ // 还原
+ std::setlocale(LC_CTYPE, prev_loc.c_str());
return wcs;
}
--
2.27.0

View File

@ -0,0 +1,32 @@
From ce754635ffdfa8469db8214607a61c7bff840d96 Mon Sep 17 00:00:00 2001
From: yangfeng <yangfeng@kylinsec.com.cn>
Date: Tue, 16 Jan 2024 09:20:16 +0800
Subject: [PATCH 5/5] feat(menu): Replace "mate-panel --run-dialog" with
"kiran-panel --run-dialog"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 使用“kiran-panel --run-dialog”替换“mate-panel --run-dialog”
- Related #24810
---
src/menu/menu-applet-window.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/menu/menu-applet-window.cpp b/src/menu/menu-applet-window.cpp
index f495bb4..fdaea92 100644
--- a/src/menu/menu-applet-window.cpp
+++ b/src/menu/menu-applet-window.cpp
@@ -675,7 +675,7 @@ void MenuAppletWindow::add_sidebar_buttons()
launcher_btn = create_launcher_button("kiran-menu-run-symbolic",
_("Run"),
- "mate-panel --run-dialog");
+ "kiran-panel --run-dialog");
side_box->add(*launcher_btn);
launcher_btn = create_launcher_button("kiran-menu-search-files-symbolic",
--
2.27.0

View File

@ -0,0 +1,33 @@
From b4328f5e462cae744a74ed968088fc4118d46aab Mon Sep 17 00:00:00 2001
From: youzhengcai <youzhengcai@kylinsec.com.cn>
Date: Fri, 19 Jan 2024 18:08:57 +0800
Subject: [PATCH 1006/1008] fix(menu):Fixed the issue where the taskbar close
window used the wrong timestamp.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复了任务栏关闭窗口函数使用了错误的时间戳问题
Related #26368
---
lib/window.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/window.cpp b/lib/window.cpp
index 4a9d844..eaf2211 100644
--- a/lib/window.cpp
+++ b/lib/window.cpp
@@ -483,8 +483,7 @@ void Window::close()
KLOG_PROFILE("xid: %" PRIu64 ", name: %s.", this->get_xid(), this->get_name().c_str());
g_return_if_fail(this->wnck_window_ != nullptr);
- uint64_t now = Glib::DateTime::create_now_local().to_unix();
- wnck_window_close(this->wnck_window_, now);
+ wnck_window_close(this->wnck_window_, gtk_get_current_event_time());
}
WindowGeometry Window::get_geometry()
--
2.27.0

View File

@ -0,0 +1,48 @@
From 4c1ef83abc019a7ae1e39dde6f450fe2bef4e1e2 Mon Sep 17 00:00:00 2001
From: yangfeng <yangfeng@kylinsec.com.cn>
Date: Thu, 1 Feb 2024 15:37:15 +0800
Subject: [PATCH 1007/1008] fix(menu-applet-button):Fix win key popup Start
menu does not get focus, can not directly keyboard operation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复win键弹出开始菜单没有获得焦点无法直接键盘操作
Related #21246
---
src/menu/menu-applet-button.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/menu/menu-applet-button.cpp b/src/menu/menu-applet-button.cpp
index d2cd311..7b1b013 100644
--- a/src/menu/menu-applet-button.cpp
+++ b/src/menu/menu-applet-button.cpp
@@ -13,6 +13,7 @@
*/
#include "menu-applet-button.h"
+#include <gdk/gdkx.h>
#include <glibmm/i18n.h>
#include "kiran-helper.h"
#include "lib/base.h"
@@ -44,8 +45,14 @@ void MenuAppletButton::on_toggled()
{
if (this->get_active())
{
- // This may mean raising the window in the stacking order, deiconifying it, moving it to the current desktop,
- // and/or giving it the keyboard focus, possibly dependent on the users platform, window manager, and preferences.
+ window.show(); // 必须要先show,get_window才有值
+ auto gdk_window = window.get_window();
+ GdkWindow *gdk_x11_window = gdk_window->gobj();
+
+ // 当通过win快捷键触发时gtk_get_current_event_time 值为0
+ guint32 server_time = gdk_x11_get_server_time(gdk_x11_window);
+
+ gdk_x11_window_set_user_time(gdk_x11_window, server_time);
window.present();
}
else
--
2.27.0

View File

@ -0,0 +1,47 @@
From 0de2a19f3935fd25dffc7e6b4931bb5c4a377d6a Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Tue, 27 Feb 2024 11:06:34 +0800
Subject: [PATCH 1008/1008] fix(tray):when resize icon window, it is necessary
to consider the impact of the scale factor.The correct resize height is the
height of the container multiplied by the scale factor of the container.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在resize icon window时,需要考虑缩放率的影响,正确的resize高度为容器的高乘以容器的缩放率
Close #30889
---
src/tray/kiran-tray.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/tray/kiran-tray.c b/src/tray/kiran-tray.c
index 9744ccc..fc361d8 100644
--- a/src/tray/kiran-tray.c
+++ b/src/tray/kiran-tray.c
@@ -1049,15 +1049,19 @@ void kiran_tray_resize_x11_icon_window(GdkDisplay *display,Window icon_window,Gt
GtkAllocation icon_allocation;
gtk_widget_get_allocation(widget, &icon_allocation);
- g_debug("icon container allocation height:%d",icon_allocation.height);
+ int scale = gtk_widget_get_scale_factor(widget);
+ g_debug("icon container allocation height:%d , scale:%d",icon_allocation.height, scale);
/**
+ * NOTE:
* 这里只将window的高与图标容器的高保持一致暂不限制window的宽 (#22117)
+ * 匹配window的高和容器的高时需要考虑缩放率的影响。
+ * 例如缩放率设置为200%在X协议层会对icon window的高度进行缩放 ,但是icon container容器高度没有变化
*/
- if(window_attributes.height != icon_allocation.height)
+ if(window_attributes.height != (icon_allocation.height * scale))
{
g_debug("resize X window");
- XResizeWindow(GDK_DISPLAY_XDISPLAY(display),icon_window,window_attributes.width,icon_allocation.height);
+ XResizeWindow(GDK_DISPLAY_XDISPLAY(display),icon_window,window_attributes.width,icon_allocation.height * scale);
XFlush(GDK_DISPLAY_XDISPLAY(display));
}
}
--
2.27.0

View File

@ -1,11 +1,21 @@
Name: kiran-menu
Version: 2.6.0
Release: 1%{?dist}.kb1
Release: 3
Summary: Applets for mate panel from Kiran Desktop
License: MulanPSL-2.0
Source0: %{name}-%{version}.tar.gz
Patch1000: 0000-fix-tasklist-app-button-Fix-touch-screen-taskbar-but.patch
Patch1001: 0001-feature-menu-Other-workspace-Windows-are-not-display.patch
Patch1002: 0002-fix-recent-files-list-box-Fixed-an-issue-where-recen.patch
Patch1003: 0003-fix-tray-Fixed-an-issue-where-the-x11-tray-icon-did-.patch
Patch1004: 0004-fix-common-Fix-Pinyin-search-failed-when-etc-locale..patch
Patch1005: 0005-feat-menu-Replace-mate-panel-run-dialog-with-kiran-p.patch
Patch1006: 1006-fix-menu-Fixed-the-issue-where-the-taskbar-close-win.patch
Patch1007: 1007-fix-menu-applet-button-Fix-win-key-popup-Start-menu-.patch
Patch1008: 1008-fix-tray-when-resize-icon-window-it-is-necessary-to-.patch
BuildRequires: cmake > 3.0
BuildRequires: gcc-c++
BuildRequires: gtkmm30-devel
@ -96,6 +106,19 @@ gtk-update-icon-cache -f /usr/share/icons/hicolor/
%changelog
* Tue Mar 05 2024 luoqing <luoqing@kylinsec.com.cn> - 2.6.0-3
- KYOS-B: Fixed the issue where the taskbar close window used the wrong timestamp.(#26368)
- KYOS-B: Fix win key popup Start menu does not get focus, can not directly keyboard operation (#21246)
- KYOS-B: :when resize icon window, it is necessary to consider the impact of the scale factor.The correct resize height is the height of the container multiplied by the scale factor of the container (#30889)
* Thu Jan 18 2024 yangfeng <yangfeng@kylinsec.com.cn> - 2.6.0-2
- KYOS-B: Fix touch screen taskbar button click judged as drag.(#23600)
- KYOS-F: Other workspace Windows are not displayed by default.
- KYOS-B: Fixed an issue where recent documents were not sorted.(#24803)
- KYOS-B: Fixed an issue where the x11 tray icon did not match the size of the icon container, causing the tray icon to display abnormally.(#22117)
- KYOS-B: Fix Pinyin search failed when /etc/locale.conf is not LANG="zh_CN.UTF-8".(#21369)
- KYOS-F: Replace "mate-panel --run-dialog" with "kiran-panel --run-dialog".(#24810)
* Wed Dec 06 2023 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.6.0-1.kb1
- release 2.6,new start menu icon