comparison src/event-Xt.c @ 28:1917ad0d78d7 r19-15b97

Import from CVS: tag r19-15b97
author cvs
date Mon, 13 Aug 2007 08:51:55 +0200
parents 441bb1e64a06
children ec9a17fef872
comparison
equal deleted inserted replaced
27:0a3286277d9b 28:1917ad0d78d7
990 a frame is destroyed. */ 990 a frame is destroyed. */
991 return; 991 return;
992 handle_focus_event_1 (f, event->type == FocusIn); 992 handle_focus_event_1 (f, event->type == FocusIn);
993 } 993 }
994 994
995 /* both MapNotify and VisibilityNotify can cause this */
996 static void
997 change_frame_visibility (struct frame *f, int is_visible)
998 {
999 Lisp_Object frame = Qnil;
1000
1001 XSETFRAME (frame, f);
1002
1003 if (!FRAME_VISIBLE_P (f) && is_visible)
1004 {
1005 FRAME_VISIBLE_P (f) = 1;
1006 /* This improves the double flicker when uniconifying a frame
1007 some. A lot of it is not showing a buffer which has changed
1008 while the frame was iconified. To fix it further requires
1009 the good 'ol double redisplay structure. */
1010 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f);
1011 va_run_hook_with_args (Qmap_frame_hook, 1, frame);
1012 #ifdef EPOCH
1013 dispatch_epoch_event (f, event, Qx_map);
1014 #endif
1015 }
1016 else if (FRAME_VISIBLE_P (f) && !is_visible)
1017 {
1018 FRAME_VISIBLE_P (f) = 0;
1019 va_run_hook_with_args (Qunmap_frame_hook, 1, frame);
1020 #ifdef EPOCH
1021 dispatch_epoch_event (f, event, Qx_unmap);
1022 #endif
1023 }
1024 }
1025
995 static void 1026 static void
996 handle_map_event (struct frame *f, XEvent *event) 1027 handle_map_event (struct frame *f, XEvent *event)
997 { 1028 {
998 Lisp_Object frame = Qnil; 1029 Lisp_Object frame = Qnil;
999 1030
1046 Note that `frame-iconified-p' queries the server 1077 Note that `frame-iconified-p' queries the server
1047 to determine whether the frame is currently iconified, 1078 to determine whether the frame is currently iconified,
1048 rather than consulting some internal (and likely 1079 rather than consulting some internal (and likely
1049 inaccurate) state flag. Therefore, ignoring the MapNotify 1080 inaccurate) state flag. Therefore, ignoring the MapNotify
1050 is correct. */ 1081 is correct. */
1051 if (!f->visible && NILP (Fframe_iconified_p (frame))) 1082 if (!FRAME_VISIBLE_P (f) && NILP (Fframe_iconified_p (frame)))
1052 #endif 1083 #endif
1053 if (!f->visible) 1084 change_frame_visibility (f, 1);
1054 {
1055 f->visible = 1;
1056 /* This improves the double flicker when uniconifying a frame
1057 some. A lot of it is not showing a buffer which has changed
1058 while the frame was iconified. To fix it further requires
1059 the good 'ol double redisplay structure. */
1060 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f);
1061 va_run_hook_with_args (Qmap_frame_hook, 1, frame);
1062 #ifdef EPOCH
1063 dispatch_epoch_event (f, event, Qx_map);
1064 #endif
1065 }
1066 } 1085 }
1067 else 1086 else
1068 { 1087 {
1069 FRAME_X_TOTALLY_VISIBLE_P (f) = 0; 1088 FRAME_X_TOTALLY_VISIBLE_P (f) = 0;
1070 if (f->visible) 1089 change_frame_visibility (f, 0);
1071 {
1072 f->visible = 0;
1073 va_run_hook_with_args (Qunmap_frame_hook, 1, frame);
1074 #ifdef EPOCH
1075 dispatch_epoch_event (f, event, Qx_unmap);
1076 #endif
1077 }
1078
1079 /* Calling Fframe_iconified_p is the only way we have to 1090 /* Calling Fframe_iconified_p is the only way we have to
1080 correctly update FRAME_ICONIFIED_P */ 1091 correctly update FRAME_ICONIFIED_P */
1081 Fframe_iconified_p (frame); 1092 Fframe_iconified_p (frame);
1082 } 1093 }
1083 } 1094 }
1219 case ClientMessage: 1230 case ClientMessage:
1220 handle_client_message (f, event); 1231 handle_client_message (f, event);
1221 break; 1232 break;
1222 1233
1223 case VisibilityNotify: /* window visiblity has changed */ 1234 case VisibilityNotify: /* window visiblity has changed */
1224 #if 0 /* This causes all kinds of strange behavior I don't like. -sb */ 1235 if (event->xvisibility.window == XtWindow (FRAME_X_SHELL_WIDGET (f)))
1225 { 1236 {
1237 FRAME_X_TOTALLY_VISIBLE_P (f) =
1238 (event->xvisibility.state == VisibilityUnobscured);
1226 /* Note that the fvwm pager only sends VisibilityNotify when 1239 /* Note that the fvwm pager only sends VisibilityNotify when
1227 changing pages. Is this all we need to do ? JV */ 1240 changing pages. Is this all we need to do ? JV */
1228 FRAME_VISIBLE_P (f) = 1241 /* Nope. We must at least trigger a redisplay here.
1229 ( event->xvisibility.state != VisibilityFullyObscured); 1242 Since this case seems similar to MapNotify, I've
1230 FRAME_X_TOTALLY_VISIBLE_P (f) = 1243 factored out some code to change_frame_visibility().
1231 (event->xvisibility.state == VisibilityUnobscured); 1244 This triggers the necessary redisplay and runs
1245 (un)map-frame-hook. - dkindred@cs.cmu.edu */
1246 change_frame_visibility (f, (event->xvisibility.state
1247 != VisibilityFullyObscured));
1232 } 1248 }
1233 #else
1234 FRAME_X_TOTALLY_VISIBLE_P (f) =
1235 (event->xvisibility.state == VisibilityUnobscured);
1236 #endif
1237 break; 1249 break;
1238 1250
1239 case ConfigureNotify: 1251 case ConfigureNotify:
1240 #ifdef HAVE_XIM 1252 #ifdef HAVE_XIM
1241 XIM_SetGeometry (f); 1253 XIM_SetGeometry (f);