comparison src/event-Xt.c @ 104:cf808b4c4290 r20-1b4

Import from CVS: tag r20-1b4
author cvs
date Mon, 13 Aug 2007 09:16:51 +0200
parents a145efe76779
children 360340f9fd5f
comparison
equal deleted inserted replaced
103:30eda07fe280 104:cf808b4c4290
1099 a frame is destroyed. */ 1099 a frame is destroyed. */
1100 return; 1100 return;
1101 handle_focus_event_1 (f, event->type == FocusIn); 1101 handle_focus_event_1 (f, event->type == FocusIn);
1102 } 1102 }
1103 1103
1104 /* both MapNotify and VisibilityNotify can cause this */
1105 static void
1106 change_frame_visibility (struct frame *f, int is_visible)
1107 {
1108 Lisp_Object frame = Qnil;
1109
1110 XSETFRAME (frame, f);
1111
1112 if (!FRAME_VISIBLE_P (f) && is_visible)
1113 {
1114 FRAME_VISIBLE_P (f) = 1;
1115 /* This improves the double flicker when uniconifying a frame
1116 some. A lot of it is not showing a buffer which has changed
1117 while the frame was iconified. To fix it further requires
1118 the good 'ol double redisplay structure. */
1119 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f);
1120 va_run_hook_with_args (Qmap_frame_hook, 1, frame);
1121 #ifdef EPOCH
1122 dispatch_epoch_event (f, event, Qx_map);
1123 #endif
1124 }
1125 else if (FRAME_VISIBLE_P (f) && !is_visible)
1126 {
1127 FRAME_VISIBLE_P (f) = 0;
1128 va_run_hook_with_args (Qunmap_frame_hook, 1, frame);
1129 #ifdef EPOCH
1130 dispatch_epoch_event (f, event, Qx_unmap);
1131 #endif
1132 }
1133 }
1134
1104 static void 1135 static void
1105 handle_map_event (struct frame *f, XEvent *event) 1136 handle_map_event (struct frame *f, XEvent *event)
1106 { 1137 {
1107 Lisp_Object frame = Qnil; 1138 Lisp_Object frame = Qnil;
1108 1139
1155 Note that `frame-iconified-p' queries the server 1186 Note that `frame-iconified-p' queries the server
1156 to determine whether the frame is currently iconified, 1187 to determine whether the frame is currently iconified,
1157 rather than consulting some internal (and likely 1188 rather than consulting some internal (and likely
1158 inaccurate) state flag. Therefore, ignoring the MapNotify 1189 inaccurate) state flag. Therefore, ignoring the MapNotify
1159 is correct. */ 1190 is correct. */
1160 if (!f->visible && NILP (Fframe_iconified_p (frame))) 1191 if (!FRAME_VISIBLE_P (f) && NILP (Fframe_iconified_p (frame)))
1161 #endif 1192 #endif
1162 if (!f->visible) 1193 change_frame_visibility (f, 1);
1163 {
1164 f->visible = 1;
1165 /* This improves the double flicker when uniconifying a frame
1166 some. A lot of it is not showing a buffer which has changed
1167 while the frame was iconified. To fix it further requires
1168 the good 'ol double redisplay structure. */
1169 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f);
1170 va_run_hook_with_args (Qmap_frame_hook, 1, frame);
1171 #ifdef EPOCH
1172 dispatch_epoch_event (f, event, Qx_map);
1173 #endif
1174 }
1175 } 1194 }
1176 else 1195 else
1177 { 1196 {
1178 FRAME_X_TOTALLY_VISIBLE_P (f) = 0; 1197 FRAME_X_TOTALLY_VISIBLE_P (f) = 0;
1179 if (f->visible) 1198 change_frame_visibility (f, 0);
1180 {
1181 f->visible = 0;
1182 va_run_hook_with_args (Qunmap_frame_hook, 1, frame);
1183 #ifdef EPOCH
1184 dispatch_epoch_event (f, event, Qx_unmap);
1185 #endif
1186 }
1187
1188 /* Calling Fframe_iconified_p is the only way we have to 1199 /* Calling Fframe_iconified_p is the only way we have to
1189 correctly update FRAME_ICONIFIED_P */ 1200 correctly update FRAME_ICONIFIED_P */
1190 Fframe_iconified_p (frame); 1201 Fframe_iconified_p (frame);
1191 } 1202 }
1192 } 1203 }
1330 break; 1341 break;
1331 1342
1332 case VisibilityNotify: /* window visiblity has changed */ 1343 case VisibilityNotify: /* window visiblity has changed */
1333 if (event->xvisibility.window == XtWindow (FRAME_X_SHELL_WIDGET (f))) 1344 if (event->xvisibility.window == XtWindow (FRAME_X_SHELL_WIDGET (f)))
1334 { 1345 {
1335 #if 0 /* This causes all kinds of strange behavior I don't like. -sb */ 1346 FRAME_X_TOTALLY_VISIBLE_P (f) =
1347 (event->xvisibility.state == VisibilityUnobscured);
1336 /* Note that the fvwm pager only sends VisibilityNotify when 1348 /* Note that the fvwm pager only sends VisibilityNotify when
1337 changing pages. Is this all we need to do ? JV */ 1349 changing pages. Is this all we need to do ? JV */
1338 FRAME_VISIBLE_P (f) = 1350 /* Nope. We must at least trigger a redisplay here.
1339 ( event->xvisibility.state != VisibilityFullyObscured); 1351 Since this case seems similar to MapNotify, I've
1340 /* #else */ 1352 factored out some code to change_frame_visibility().
1341 FRAME_VISIBLE_P (f) && (FRAME_VISIBLE_P (f) = 1353 This triggers the necessary redisplay and runs
1342 ( event->xvisibility.state != VisibilityFullyObscured)); 1354 (un)map-frame-hook. - dkindred@cs.cmu.edu */
1343 #endif 1355 change_frame_visibility (f, (event->xvisibility.state
1344 FRAME_X_TOTALLY_VISIBLE_P (f) = 1356 != VisibilityFullyObscured));
1345 (event->xvisibility.state == VisibilityUnobscured);
1346 } 1357 }
1347 break; 1358 break;
1348 1359
1349 case ConfigureNotify: 1360 case ConfigureNotify:
1350 #ifdef HAVE_XIM 1361 #ifdef HAVE_XIM