comparison src/event-msw.c @ 269:b2472a1930f2 r20-5b33

Import from CVS: tag r20-5b33
author cvs
date Mon, 13 Aug 2007 10:27:19 +0200
parents 727739f917cb
children c5d627a313b1
comparison
equal deleted inserted replaced
268:6ced69ccd85f 269:b2472a1930f2
997 magic events to run these hooks instead - kkm */ 997 magic events to run these hooks instead - kkm */
998 998
999 if (wParam==SIZE_MINIMIZED) 999 if (wParam==SIZE_MINIMIZED)
1000 { 1000 {
1001 /* Iconified */ 1001 /* Iconified */
1002 FRAME_VISIBLE_P (frame) = 0; 1002 FRAME_VISIBLE_P (frame) = 0;
1003 mswindows_enqueue_magic_event (hwnd, XM_UNMAPFRAME); 1003 mswindows_enqueue_magic_event (hwnd, XM_UNMAPFRAME);
1004 Fframe_iconified_p (fobj);
1005 } 1004 }
1006 else 1005 else
1007 { 1006 {
1008 int was_visible = FRAME_VISIBLE_P (frame);
1009 if (!msframe->sizing && !was_visible)
1010 mswindows_enqueue_magic_event (hwnd, XM_MAPFRAME);
1011
1012 GetClientRect(hwnd, &rect); 1007 GetClientRect(hwnd, &rect);
1013 FRAME_VISIBLE_P(frame) = 1;
1014 FRAME_PIXWIDTH(frame) = rect.right; 1008 FRAME_PIXWIDTH(frame) = rect.right;
1015 FRAME_PIXHEIGHT(frame) = rect.bottom; 1009 FRAME_PIXHEIGHT(frame) = rect.bottom;
1010
1011 pixel_to_real_char_size (frame, rect.right, rect.bottom,
1012 &MSWINDOWS_FRAME_CHARWIDTH (frame),
1013 &MSWINDOWS_FRAME_CHARHEIGHT (frame));
1014
1016 pixel_to_char_size (frame, rect.right, rect.bottom, &columns, &rows); 1015 pixel_to_char_size (frame, rect.right, rect.bottom, &columns, &rows);
1017 change_frame_size (frame, rows, columns, 1); 1016 change_frame_size (frame, rows, columns, 1);
1018 1017
1019 if (msframe->sizing && mswindows_dynamic_frame_resize) 1018 /* If we are inside frame creation, we have to apply geometric
1020 redisplay (); 1019 properties now. */
1020 if (mswindows_frame_target_rect.left >= 0
1021 || mswindows_frame_target_rect.top >= 0
1022 || mswindows_frame_target_rect.width >= 0
1023 || mswindows_frame_target_rect.height >= 0)
1024 {
1025 /* Yes, we have to size again */
1026 XEMACS_RECT_WH geom;
1027
1028 geom.left = mswindows_frame_target_rect.left;
1029 geom.top = mswindows_frame_target_rect.top;
1030 char_to_real_pixel_size (frame,
1031 mswindows_frame_target_rect.width,
1032 mswindows_frame_target_rect.height,
1033 &geom.width, &geom.height);
1034 if (mswindows_frame_target_rect.width < 0)
1035 geom.width = -1;
1036 if (mswindows_frame_target_rect.height < 0)
1037 geom.height = -1;
1038
1039 /* Reset to we do not get here again */
1040 mswindows_frame_target_rect.left = -1;
1041 mswindows_frame_target_rect.top = -1;
1042 mswindows_frame_target_rect.width = -1;
1043 mswindows_frame_target_rect.height = -1;
1044
1045 /* Size the rectangle to the actual size */
1046 GetWindowRect (hwnd, &rect);
1047 SetWindowPos
1048 (hwnd, NULL,
1049 geom.left >= 0 ? geom.left : rect.left,
1050 geom.top >= 0 ? geom.top : rect.top,
1051 geom.width >= 0 ? geom.width : rect.right - rect.left,
1052 geom.height >= 0 ? geom.height : rect.bottom - rect.top,
1053 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING
1054 | ((geom.left >= 0 || geom.top >= 0) ? 0 : SWP_NOMOVE)
1055 | ((geom.width >= 0 || geom.height >= 0) ? 0 : SWP_NOSIZE));
1056 }
1057 else
1058 {
1059 if (!msframe->sizing && !FRAME_VISIBLE_P (frame))
1060 mswindows_enqueue_magic_event (hwnd, XM_MAPFRAME);
1061 FRAME_VISIBLE_P (frame) = 1;
1062
1063 if (!msframe->sizing || mswindows_dynamic_frame_resize)
1064 redisplay ();
1065 }
1021 } 1066 }
1022 } 1067 }
1023 break; 1068 break;
1024 1069
1025 /* Misc magic events which only require that the frame be identified */ 1070 /* Misc magic events which only require that the frame be identified */
1033 WINDOWPOS *wp = (LPWINDOWPOS) lParam; 1078 WINDOWPOS *wp = (LPWINDOWPOS) lParam;
1034 WINDOWPLACEMENT wpl = { sizeof(WINDOWPLACEMENT) }; 1079 WINDOWPLACEMENT wpl = { sizeof(WINDOWPLACEMENT) };
1035 GetWindowPlacement(hwnd, &wpl); 1080 GetWindowPlacement(hwnd, &wpl);
1036 1081
1037 /* Only interested if size is changing and we're not being iconified */ 1082 /* Only interested if size is changing and we're not being iconified */
1038 if ((wpl.showCmd != SW_SHOWMINIMIZED) && !(wp->flags & SWP_NOSIZE)) 1083 if (wpl.showCmd != SW_SHOWMINIMIZED
1084 && wpl.showCmd != SW_SHOWMAXIMIZED
1085 && !(wp->flags & SWP_NOSIZE))
1039 { 1086 {
1040 RECT ncsize = { 0, 0, 0, 0 }; 1087 RECT ncsize = { 0, 0, 0, 0 };
1041 int pixwidth, pixheight; 1088 int pixwidth, pixheight;
1042 AdjustWindowRectEx (&ncsize, GetWindowLong (hwnd, GWL_STYLE), 1089 AdjustWindowRectEx (&ncsize, GetWindowLong (hwnd, GWL_STYLE),
1043 GetMenu(hwnd) != NULL, 1090 GetMenu(hwnd) != NULL,
1044 GetWindowLong (hwnd, GWL_EXSTYLE)); 1091 GetWindowLong (hwnd, GWL_EXSTYLE));
1045 1092
1046 round_size_to_char (XFRAME (mswindows_find_frame (hwnd)), 1093 round_size_to_real_char (XFRAME (mswindows_find_frame (hwnd)),
1047 wp->cx - (ncsize.right - ncsize.left), 1094 wp->cx - (ncsize.right - ncsize.left),
1048 wp->cy - (ncsize.bottom - ncsize.top), 1095 wp->cy - (ncsize.bottom - ncsize.top),
1049 &pixwidth, &pixheight); 1096 &pixwidth, &pixheight);
1050 1097
1051 /* Convert client sizes to window sizes */ 1098 /* Convert client sizes to window sizes */
1052 pixwidth += (ncsize.right - ncsize.left); 1099 pixwidth += (ncsize.right - ncsize.left);
1053 pixheight += (ncsize.bottom - ncsize.top); 1100 pixheight += (ncsize.bottom - ncsize.top);
1054 1101
1066 } 1113 }
1067 1114
1068 wp->cx = pixwidth; 1115 wp->cx = pixwidth;
1069 wp->cy = pixheight; 1116 wp->cy = pixheight;
1070 } 1117 }
1071 } 1118 /* DefWindowProc sends useful WM_GETMINMAXINFO message, and adjusts
1072 break; 1119 window position if the user tries to track window too small */
1120 }
1121 goto defproc;
1073 1122
1074 case WM_ENTERSIZEMOVE: 1123 case WM_ENTERSIZEMOVE:
1075 msframe = FRAME_MSWINDOWS_DATA (XFRAME (mswindows_find_frame (hwnd))); 1124 msframe = FRAME_MSWINDOWS_DATA (XFRAME (mswindows_find_frame (hwnd)));
1076 msframe->sizing = 1; 1125 msframe->sizing = 1;
1077 return 0; 1126 return 0;
1143 1192
1144 #ifdef HAVE_TOOLBARS 1193 #ifdef HAVE_TOOLBARS
1145 /* O Toolbar Implementor, this place may have something for you!;*/ 1194 /* O Toolbar Implementor, this place may have something for you!;*/
1146 #endif 1195 #endif
1147 1196
1148 /* Bite me - a spurious command. No abort(), for safety */ 1197 /* Bite me - a spurious command. This cannot happen. */
1149 /* #### Perhaps, this message should be changed */ 1198 error ("XEMACS BUG: Cannot decode command message");
1150 error ("Cannot decode command. Tell kkm he's a parallelogramm, if you know"
1151 " what does that mean!");
1152 } 1199 }
1153 break; 1200 break;
1154 1201
1155 case WM_DROPFILES: /* implementation ripped-off from event-Xt.c */ 1202 case WM_DROPFILES: /* implementation ripped-off from event-Xt.c */
1156 { 1203 {
1226 static void 1273 static void
1227 mswindows_set_chord_timer (HWND hwnd) 1274 mswindows_set_chord_timer (HWND hwnd)
1228 { 1275 {
1229 int interval; 1276 int interval;
1230 1277
1231 /* We get half system threshold as it seems to 1278 /* We get one third half system double click threshold */
1232 long before drag-selection is shown */
1233 if (mswindows_button2_chord_time <= 0) 1279 if (mswindows_button2_chord_time <= 0)
1234 interval = GetDoubleClickTime () / 2; 1280 interval = GetDoubleClickTime () / 3;
1235 else 1281 else
1236 interval = mswindows_button2_chord_time; 1282 interval = mswindows_button2_chord_time;
1237 1283
1238 SetTimer (hwnd, BUTTON_2_TIMER_ID, interval, 0); 1284 SetTimer (hwnd, BUTTON_2_TIMER_ID, interval, 0);
1239 } 1285 }
1400 * Find the frame that matches the supplied mswindows window handle 1446 * Find the frame that matches the supplied mswindows window handle
1401 */ 1447 */
1402 static Lisp_Object 1448 static Lisp_Object
1403 mswindows_find_frame (HWND hwnd) 1449 mswindows_find_frame (HWND hwnd)
1404 { 1450 {
1405 return (Lisp_Object) GetWindowLong (hwnd, XWL_FRAMEOBJ); 1451 LONG l = GetWindowLong (hwnd, XWL_FRAMEOBJ);
1406 } 1452 Lisp_Object f;
1407 1453 if (l == 0)
1454 {
1455 /* We are in progress of frame creation. Return the frame
1456 being created, as it still not remembered in the window
1457 extra storage. */
1458 assert (!NILP (mswindows_frame_being_created));
1459 return mswindows_frame_being_created;
1460 }
1461 VOID_TO_LISP (f, l);
1462 return f;
1463 }
1408 1464
1409 1465
1410 /************************************************************************/ 1466 /************************************************************************/
1411 /* methods */ 1467 /* methods */
1412 /************************************************************************/ 1468 /************************************************************************/