kiran-menu/1007-fix-menu-applet-button-Fix-win-key-popup-Start-menu-.patch

49 lines
1.7 KiB
Diff
Raw Normal View History

2024-04-09 16:16:16 +08:00
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