Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
f50def91
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f50def91
编写于
5月 19, 2014
作者:
G
Gerd Hoffmann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gtk: factor out gtk3 grab into the new gd_grab_devices function
Signed-off-by:
N
Gerd Hoffmann
<
kraxel@redhat.com
>
上级
0a337ed0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
64 deletion
+36
-64
ui/gtk.c
ui/gtk.c
+36
-64
未找到文件。
ui/gtk.c
浏览文件 @
f50def91
...
...
@@ -1162,28 +1162,39 @@ static void gd_menu_zoom_fit(GtkMenuItem *item, void *opaque)
gd_update_full_redraw
(
vc
);
}
static
void
gd_grab_keyboard
(
VirtualConsole
*
vc
)
{
#if GTK_CHECK_VERSION(3, 0, 0)
static
void
gd_grab_devices
(
VirtualConsole
*
vc
,
bool
grab
,
GdkInputSource
source
,
GdkEventMask
mask
,
GdkCursor
*
cursor
)
{
GdkDisplay
*
display
=
gtk_widget_get_display
(
vc
->
gfx
.
drawing_area
);
GdkDeviceManager
*
mgr
=
gdk_display_get_device_manager
(
display
);
GList
*
dev
ices
=
gdk_device_manager_list_devices
(
mgr
,
GDK_DEVICE_TYPE_MASTER
)
;
GList
*
tmp
=
devices
;
while
(
tmp
)
{
GList
*
dev
s
=
gdk_device_manager_list_devices
(
mgr
,
GDK_DEVICE_TYPE_MASTER
);
GList
*
tmp
=
devs
;
for
(
tmp
=
devs
;
tmp
;
tmp
=
tmp
->
next
)
{
GdkDevice
*
dev
=
tmp
->
data
;
if
(
gdk_device_get_source
(
dev
)
==
GDK_SOURCE_KEYBOARD
)
{
gdk_device_grab
(
dev
,
gtk_widget_get_window
(
vc
->
gfx
.
drawing_area
),
GDK_OWNERSHIP_NONE
,
FALSE
,
GDK_KEY_PRESS_MASK
|
GDK_KEY_RELEASE_MASK
,
NULL
,
GDK_CURRENT_TIME
);
if
(
gdk_device_get_source
(
dev
)
!=
source
)
{
continue
;
}
if
(
grab
)
{
GdkWindow
*
win
=
gtk_widget_get_window
(
vc
->
gfx
.
drawing_area
);
gdk_device_grab
(
dev
,
win
,
GDK_OWNERSHIP_NONE
,
FALSE
,
mask
,
cursor
,
GDK_CURRENT_TIME
);
}
else
{
gdk_device_ungrab
(
dev
,
GDK_CURRENT_TIME
);
}
tmp
=
tmp
->
next
;
}
g_list_free
(
devices
);
g_list_free
(
devs
);
}
#endif
static
void
gd_grab_keyboard
(
VirtualConsole
*
vc
)
{
#if GTK_CHECK_VERSION(3, 0, 0)
gd_grab_devices
(
vc
,
true
,
GDK_SOURCE_KEYBOARD
,
GDK_KEY_PRESS_MASK
|
GDK_KEY_RELEASE_MASK
,
NULL
);
#else
gdk_keyboard_grab
(
gtk_widget_get_window
(
vc
->
gfx
.
drawing_area
),
FALSE
,
...
...
@@ -1203,20 +1214,7 @@ static void gd_ungrab_keyboard(GtkDisplayState *s)
s
->
kbd_owner
=
NULL
;
#if GTK_CHECK_VERSION(3, 0, 0)
GdkDisplay
*
display
=
gtk_widget_get_display
(
vc
->
gfx
.
drawing_area
);
GdkDeviceManager
*
mgr
=
gdk_display_get_device_manager
(
display
);
GList
*
devices
=
gdk_device_manager_list_devices
(
mgr
,
GDK_DEVICE_TYPE_MASTER
);
GList
*
tmp
=
devices
;
while
(
tmp
)
{
GdkDevice
*
dev
=
tmp
->
data
;
if
(
gdk_device_get_source
(
dev
)
==
GDK_SOURCE_KEYBOARD
)
{
gdk_device_ungrab
(
dev
,
GDK_CURRENT_TIME
);
}
tmp
=
tmp
->
next
;
}
g_list_free
(
devices
);
gd_grab_devices
(
vc
,
false
,
GDK_SOURCE_KEYBOARD
,
0
,
NULL
);
#else
gdk_keyboard_ungrab
(
GDK_CURRENT_TIME
);
#endif
...
...
@@ -1228,28 +1226,13 @@ static void gd_grab_pointer(VirtualConsole *vc)
GdkDisplay
*
display
=
gtk_widget_get_display
(
vc
->
gfx
.
drawing_area
);
#if GTK_CHECK_VERSION(3, 0, 0)
GdkDeviceManager
*
mgr
=
gdk_display_get_device_manager
(
display
);
GList
*
devices
=
gdk_device_manager_list_devices
(
mgr
,
GDK_DEVICE_TYPE_MASTER
);
GList
*
tmp
=
devices
;
while
(
tmp
)
{
GdkDevice
*
dev
=
tmp
->
data
;
if
(
gdk_device_get_source
(
dev
)
==
GDK_SOURCE_MOUSE
)
{
gdk_device_grab
(
dev
,
gtk_widget_get_window
(
vc
->
gfx
.
drawing_area
),
GDK_OWNERSHIP_NONE
,
FALSE
,
/* All events to come to our
window directly */
GDK_POINTER_MOTION_MASK
|
GDK_BUTTON_PRESS_MASK
|
GDK_BUTTON_RELEASE_MASK
|
GDK_BUTTON_MOTION_MASK
|
GDK_SCROLL_MASK
,
vc
->
s
->
null_cursor
,
GDK_CURRENT_TIME
);
}
tmp
=
tmp
->
next
;
}
g_list_free
(
devices
);
gd_grab_devices
(
vc
,
true
,
GDK_SOURCE_MOUSE
,
GDK_POINTER_MOTION_MASK
|
GDK_BUTTON_PRESS_MASK
|
GDK_BUTTON_RELEASE_MASK
|
GDK_BUTTON_MOTION_MASK
|
GDK_SCROLL_MASK
,
vc
->
s
->
null_cursor
);
gdk_device_get_position
(
gdk_device_manager_get_client_pointer
(
mgr
),
NULL
,
&
vc
->
s
->
grab_x_root
,
&
vc
->
s
->
grab_y_root
);
#else
...
...
@@ -1282,18 +1265,7 @@ static void gd_ungrab_pointer(GtkDisplayState *s)
GdkDisplay
*
display
=
gtk_widget_get_display
(
vc
->
gfx
.
drawing_area
);
#if GTK_CHECK_VERSION(3, 0, 0)
GdkDeviceManager
*
mgr
=
gdk_display_get_device_manager
(
display
);
GList
*
devices
=
gdk_device_manager_list_devices
(
mgr
,
GDK_DEVICE_TYPE_MASTER
);
GList
*
tmp
=
devices
;
while
(
tmp
)
{
GdkDevice
*
dev
=
tmp
->
data
;
if
(
gdk_device_get_source
(
dev
)
==
GDK_SOURCE_MOUSE
)
{
gdk_device_ungrab
(
dev
,
GDK_CURRENT_TIME
);
}
tmp
=
tmp
->
next
;
}
g_list_free
(
devices
);
gd_grab_devices
(
vc
,
false
,
GDK_SOURCE_MOUSE
,
0
,
NULL
);
gdk_device_warp
(
gdk_device_manager_get_client_pointer
(
mgr
),
gtk_widget_get_screen
(
vc
->
gfx
.
drawing_area
),
vc
->
s
->
grab_x_root
,
vc
->
s
->
grab_y_root
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录