Mercurial > mplayer.hg
comparison libvo/x11_common.c @ 18149:163fe5c2577d
Register for window-manager delete window events and quit MPlayer.
slightly modified patch from Rickard Narstrom (rickard narstrom at gmail com)
author | reimar |
---|---|
date | Wed, 19 Apr 2006 15:58:10 +0000 |
parents | d75953576ae4 |
children | 03bc3385a845 |
comparison
equal
deleted
inserted
replaced
18148:280f93388ac3 | 18149:163fe5c2577d |
---|---|
98 static Atom XA_NET_WM_PID; | 98 static Atom XA_NET_WM_PID; |
99 static Atom XA_WIN_PROTOCOLS; | 99 static Atom XA_WIN_PROTOCOLS; |
100 static Atom XA_WIN_LAYER; | 100 static Atom XA_WIN_LAYER; |
101 static Atom XA_WIN_HINTS; | 101 static Atom XA_WIN_HINTS; |
102 static Atom XA_BLACKBOX_PID; | 102 static Atom XA_BLACKBOX_PID; |
103 static Atom XAWM_PROTOCOLS; | |
104 static Atom XAWM_DELETE_WINDOW; | |
103 | 105 |
104 #define XA_INIT(x) XA##x = XInternAtom(mDisplay, #x, False) | 106 #define XA_INIT(x) XA##x = XInternAtom(mDisplay, #x, False) |
105 | 107 |
106 static int vo_old_x = 0; | 108 static int vo_old_x = 0; |
107 static int vo_old_y = 0; | 109 static int vo_old_y = 0; |
355 XA_INIT(_NET_WM_PID); | 357 XA_INIT(_NET_WM_PID); |
356 XA_INIT(_WIN_PROTOCOLS); | 358 XA_INIT(_WIN_PROTOCOLS); |
357 XA_INIT(_WIN_LAYER); | 359 XA_INIT(_WIN_LAYER); |
358 XA_INIT(_WIN_HINTS); | 360 XA_INIT(_WIN_HINTS); |
359 XA_INIT(_BLACKBOX_PID); | 361 XA_INIT(_BLACKBOX_PID); |
362 XA_INIT(WM_PROTOCOLS); | |
363 XA_INIT(WM_DELETE_WINDOW); | |
360 } | 364 } |
361 | 365 |
362 void update_xinerama_info(void) { | 366 void update_xinerama_info(void) { |
363 int screen = xinerama_screen; | 367 int screen = xinerama_screen; |
364 xinerama_x = xinerama_y = 0; | 368 xinerama_x = xinerama_y = 0; |
1135 case MapNotify: | 1139 case MapNotify: |
1136 vo_hint.win_gravity = old_gravity; | 1140 vo_hint.win_gravity = old_gravity; |
1137 XSetWMNormalHints(mDisplay, vo_window, &vo_hint); | 1141 XSetWMNormalHints(mDisplay, vo_window, &vo_hint); |
1138 vo_fs_flip = 0; | 1142 vo_fs_flip = 0; |
1139 break; | 1143 break; |
1144 case ClientMessage: | |
1145 if (Event.xclient.message_type == XAWM_PROTOCOLS && | |
1146 Event.xclient.data.l[0] == XAWM_DELETE_WINDOW) | |
1147 mplayer_put_key(KEY_CLOSE_WIN); | |
1148 break; | |
1140 } | 1149 } |
1141 } | 1150 } |
1142 return ret; | 1151 return ret; |
1143 } | 1152 } |
1144 | 1153 |
1239 xswa.bit_gravity = StaticGravity; | 1248 xswa.bit_gravity = StaticGravity; |
1240 | 1249 |
1241 ret_win = | 1250 ret_win = |
1242 XCreateWindow(mDisplay, mRootWin, x, y, width, height, 0, depth, | 1251 XCreateWindow(mDisplay, mRootWin, x, y, width, height, 0, depth, |
1243 CopyFromParent, vis, xswamask, &xswa); | 1252 CopyFromParent, vis, xswamask, &xswa); |
1253 XSetWMProtocols(mDisplay, ret_win, &XAWM_DELETE_WINDOW, 1); | |
1244 if (!f_gc) | 1254 if (!f_gc) |
1245 f_gc = XCreateGC(mDisplay, ret_win, 0, 0); | 1255 f_gc = XCreateGC(mDisplay, ret_win, 0, 0); |
1246 XSetForeground(mDisplay, f_gc, 0); | 1256 XSetForeground(mDisplay, f_gc, 0); |
1247 | 1257 |
1248 return ret_win; | 1258 return ret_win; |