无边框GTkWindow的信号处理

陈着 posted @ Jul 12, 2010 12:15:11 AM in Osd-lyrics , 4742 阅读

今天继续改进osd-lyrics的scroll-mode显示,希望最终的效果图为:

首要把标准的gtkwindow的框去掉,设置成无窗口模式,ol_scroll_window继承自gtkwindow可以使用:

 gtk_window_set_decorated (GTK_WINDOW(scroll),FALSE);

如下图显示:

但是此时,ol_scroll_window不会响应button_press,button_release和motion_notify信号,也就是无法移动ol_scroll_window和改变ol_scroll_window的大小,经过测试:key_press等信号是可以响应的,于是怀疑gtkwindow将button_press,button_release和motion_notify信号屏蔽掉了。通过阅读gtkwindow.c源代码,发现其gtk_window_realize (GtkWidget *widget)中对无边框窗口屏蔽了button_press,button_release和motion_notify信号。(比较悲剧,不懂gtkwindow为什么这样设计)

解决方案为:

在ol_scroll_window_init (OlScrollWindow *self)中添加事件响应

  gtk_widget_add_events (GTK_WIDGET (self), GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_POINTER_MOTION_MASK);

但是问题解决得并不完美,发现在移动窗口的时候,在碰到其他窗口时scroll_window坐标会大幅度变动. google一下得到解决方案:

 gtk_widget_add_events (GTK_WIDGET (self), GDK_POINTER_MOTION_HINT_MASK);

最终问题得到解决,继续进一步的改进。

Head_small
Tiger Soldier 说:
Jan 10, 2011 01:59:36 AM

ft, 我给OSD Window找解决方案找到你这里来了……

Avatar_small
KVS KG1 Model Paper 说:
Sep 27, 2022 07:58:56 PM

Kendriya Vidyalaya Sangathan has provided the practice question paper for Preschool Kindergarten education subject-wise practice question paper with model sample paper for all LKG/PP1/KG1 students through KVS Teaching staff at all region schools across the Country. KVS KG1 Model Paper Kendriya Vidyalaya Sangathan has provided the practice question paper for Preschool Kindergarten education subject-wise practice question paper with model sample paper for all LKG/PP1/KG1 students through KVS Teaching staff at all region schools across the Country.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter