aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeoff Voelker1996-01-25 03:05:03 +0000
committerGeoff Voelker1996-01-25 03:05:03 +0000
commit97c2385773cb0c7d739c208c4b0d303a0cb4c234 (patch)
treeb12675fa4c6e138e4a5d72a0018b004f18356fcc /src
parent2bcbf5107294909b1a39d3596125f9631c8bc188 (diff)
downloademacs-97c2385773cb0c7d739c208c4b0d303a0cb4c234.tar.gz
emacs-97c2385773cb0c7d739c208c4b0d303a0cb4c234.zip
backout 1996-01-21T00:21:35Z!voelker@cs.washington.edu
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c106
1 files changed, 38 insertions, 68 deletions
diff --git a/src/w32term.c b/src/w32term.c
index e3afeb97094..49a56b0e429 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -195,6 +195,7 @@ win32_fill_rect (f, _hdc, pix, lprect)
195{ 195{
196 HDC hdc; 196 HDC hdc;
197 HBRUSH hb; 197 HBRUSH hb;
198 HANDLE oldobj;
198 RECT rect; 199 RECT rect;
199 200
200 if (_hdc) 201 if (_hdc)
@@ -202,15 +203,18 @@ win32_fill_rect (f, _hdc, pix, lprect)
202 else 203 else
203 { 204 {
204 if (!f) return; 205 if (!f) return;
205 hdc = GetFrameDC (f); 206 hdc = my_get_dc (FRAME_WIN32_WINDOW (f));
206 } 207 }
207 208
208 hb = CreateSolidBrush (pix); 209 hb = CreateSolidBrush (pix);
210 oldobj = SelectObject (hdc, hb);
211
209 FillRect (hdc, lprect, hb); 212 FillRect (hdc, lprect, hb);
213 SelectObject (hdc, oldobj);
210 DeleteObject (hb); 214 DeleteObject (hb);
211 215
212 if (!_hdc) 216 if (!_hdc)
213 ReleaseFrameDC (f, hdc); 217 ReleaseDC (FRAME_WIN32_WINDOW (f), hdc);
214} 218}
215 219
216void 220void
@@ -218,7 +222,7 @@ win32_clear_window (f)
218 FRAME_PTR f; 222 FRAME_PTR f;
219{ 223{
220 RECT rect; 224 RECT rect;
221 225
222 GetClientRect (FRAME_WIN32_WINDOW (f), &rect); 226 GetClientRect (FRAME_WIN32_WINDOW (f), &rect);
223 win32_clear_rect (f, NULL, &rect); 227 win32_clear_rect (f, NULL, &rect);
224} 228}
@@ -245,14 +249,6 @@ win32_update_begin (f)
245 249
246 BLOCK_INPUT; 250 BLOCK_INPUT;
247 251
248 /* Regenerate display palette before drawing if list of requested
249 colors has changed. */
250 if (FRAME_WIN32_DISPLAY_INFO (f)->regen_palette)
251 {
252 win32_regenerate_palette (f);
253 FRAME_WIN32_DISPLAY_INFO (f)->regen_palette = FALSE;
254 }
255
256 if (f == FRAME_WIN32_DISPLAY_INFO (f)->mouse_face_mouse_frame) 252 if (f == FRAME_WIN32_DISPLAY_INFO (f)->mouse_face_mouse_frame)
257 { 253 {
258 /* Don't do highlighting for mouse motion during the update. */ 254 /* Don't do highlighting for mouse motion during the update. */
@@ -422,7 +418,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
422 int orig_left = left; 418 int orig_left = left;
423 HDC hdc; 419 HDC hdc;
424 420
425 hdc = GetFrameDC (f); 421 hdc = my_get_dc (window);
426 422
427 while (n > 0) 423 while (n > 0)
428 { 424 {
@@ -575,7 +571,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
575 } 571 }
576 } 572 }
577 573
578 ReleaseFrameDC (f, hdc); 574 ReleaseDC (window, hdc);
579} 575}
580 576
581 577
@@ -832,7 +828,7 @@ do_line_dance ()
832 828
833 x_display_cursor (updating_frame, 0); 829 x_display_cursor (updating_frame, 0);
834 830
835 hdc = GetFrameDC (f); 831 hdc = my_get_dc (FRAME_WIN32_WINDOW (f));
836 832
837 for (i = 0; i < ht; ++i) 833 for (i = 0; i < ht; ++i)
838 if (line_dance[i] != -1 && (distance = line_dance[i]-i) > 0) 834 if (line_dance[i] != -1 && (distance = line_dance[i]-i) > 0)
@@ -866,7 +862,7 @@ do_line_dance ()
866 i = j+1; 862 i = j+1;
867 } 863 }
868 864
869 ReleaseFrameDC (f, hdc); 865 ReleaseDC (FRAME_WIN32_WINDOW (f), hdc);
870 866
871 for (i = 0; i < ht; ++i) 867 for (i = 0; i < ht; ++i)
872 if (line_dance[i] == -1) 868 if (line_dance[i] == -1)
@@ -2276,7 +2272,7 @@ w32_read_socket (sd, bufp, numchars, waitp, expected)
2276 if (numchars <= 0) 2272 if (numchars <= 0)
2277 abort (); /* Don't think this happens. */ 2273 abort (); /* Don't think this happens. */
2278 2274
2279 while (get_next_msg (&msg, FALSE)) 2275 while (get_next_msg (&msg, 0))
2280 { 2276 {
2281 switch (msg.msg.message) 2277 switch (msg.msg.message)
2282 { 2278 {
@@ -2312,12 +2308,6 @@ w32_read_socket (sd, bufp, numchars, waitp, expected)
2312 } 2308 }
2313 2309
2314 break; 2310 break;
2315 case WM_PALETTECHANGED:
2316 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
2317 if (f)
2318 /* Realize palette - will force update if needed. */
2319 ReleaseFrameDC (f, GetFrameDC (f));
2320 break;
2321 case WM_KEYDOWN: 2311 case WM_KEYDOWN:
2322 case WM_SYSKEYDOWN: 2312 case WM_SYSKEYDOWN:
2323 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); 2313 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
@@ -2453,7 +2443,7 @@ w32_read_socket (sd, bufp, numchars, waitp, expected)
2453 int width; 2443 int width;
2454 int height; 2444 int height;
2455 2445
2456 GetClientRect (msg.msg.hwnd, &rect); 2446 GetClientRect(msg.msg.hwnd, &rect);
2457 2447
2458 height = rect.bottom - rect.top + 1; 2448 height = rect.bottom - rect.top + 1;
2459 width = rect.right - rect.left + 1; 2449 width = rect.right - rect.left + 1;
@@ -2646,19 +2636,25 @@ x_draw_box (f)
2646 HBRUSH hb; 2636 HBRUSH hb;
2647 HDC hdc; 2637 HDC hdc;
2648 2638
2649 hdc = GetFrameDC (f); 2639 hdc = my_get_dc (FRAME_WIN32_WINDOW (f));
2650 2640
2651 hb = CreateSolidBrush (f->output_data.win32->cursor_pixel); 2641 hb = CreateSolidBrush (f->output_data.win32->cursor_pixel);
2652 2642
2653 rect.left = CHAR_TO_PIXEL_COL (f, curs_x); 2643 rect.left = CHAR_TO_PIXEL_COL (f, curs_x);
2654 rect.top = CHAR_TO_PIXEL_ROW (f, curs_y); 2644 rect.top = CHAR_TO_PIXEL_ROW (f, curs_y);
2655 rect.right = rect.left + FONT_WIDTH (f->output_data.win32->font); 2645 rect.right = rect.left + FONT_WIDTH (f->output_data.win32->font) - 1;
2656 rect.bottom = rect.top + f->output_data.win32->line_height; 2646 rect.bottom = rect.top + f->output_data.win32->line_height - 1;
2657 2647
2648 /* rect.left++; */
2649 /* rect.top++; */
2650 rect.right--;
2651 rect.bottom--;
2652
2658 FrameRect (hdc, &rect, hb); 2653 FrameRect (hdc, &rect, hb);
2654
2659 DeleteObject (hb); 2655 DeleteObject (hb);
2660 2656
2661 ReleaseFrameDC (f, hdc); 2657 ReleaseDC (FRAME_WIN32_WINDOW (f), hdc);
2662} 2658}
2663 2659
2664/* Clear the cursor of frame F to background color, 2660/* Clear the cursor of frame F to background color,
@@ -3020,8 +3016,8 @@ x_calc_absolute_position (f)
3020 rt.left = rt.right = rt.top = rt.bottom = 0; 3016 rt.left = rt.right = rt.top = rt.bottom = 0;
3021 3017
3022 BLOCK_INPUT; 3018 BLOCK_INPUT;
3023 AdjustWindowRect (&rt, f->output_data.win32->dwStyle, 3019 AdjustWindowRect(&rt, f->output_data.win32->dwStyle,
3024 FRAME_EXTERNAL_MENU_BAR (f)); 3020 FRAME_EXTERNAL_MENU_BAR (f));
3025 UNBLOCK_INPUT; 3021 UNBLOCK_INPUT;
3026 3022
3027 pt.x += (rt.right - rt.left); 3023 pt.x += (rt.right - rt.left);
@@ -3128,8 +3124,8 @@ x_set_window_size (f, change_gravity, cols, rows)
3128 rect.right = pixelwidth; 3124 rect.right = pixelwidth;
3129 rect.bottom = pixelheight; 3125 rect.bottom = pixelheight;
3130 3126
3131 AdjustWindowRect (&rect, f->output_data.win32->dwStyle, 3127 AdjustWindowRect(&rect, f->output_data.win32->dwStyle,
3132 FRAME_EXTERNAL_MENU_BAR (f)); 3128 FRAME_EXTERNAL_MENU_BAR (f));
3133 3129
3134 /* All windows have an extra pixel */ 3130 /* All windows have an extra pixel */
3135 3131
@@ -3287,13 +3283,11 @@ x_make_frame_visible (f)
3287 if we get to x_make_frame_visible a second time 3283 if we get to x_make_frame_visible a second time
3288 before the window gets really visible. */ 3284 before the window gets really visible. */
3289 if (! FRAME_ICONIFIED_P (f) 3285 if (! FRAME_ICONIFIED_P (f)
3290 && ! f->output_data.win32->asked_for_visible) { 3286 && ! f->output_data.win32->asked_for_visible)
3291 x_set_offset (f, f->output_data.win32->left_pos, 3287 x_set_offset (f, f->output_data.win32->left_pos, f->output_data.win32->top_pos, 0);
3292 f->output_data.win32->top_pos, 0);
3293 SetForegroundWindow (FRAME_WIN32_WINDOW (f));
3294 }
3295 3288
3296 f->output_data.win32->asked_for_visible = 1; 3289 f->output_data.win32->asked_for_visible = 1;
3290
3297 ShowWindow (FRAME_WIN32_WINDOW (f), SW_SHOW); 3291 ShowWindow (FRAME_WIN32_WINDOW (f), SW_SHOW);
3298 } 3292 }
3299 3293
@@ -3374,8 +3368,7 @@ x_make_frame_invisible (f)
3374 3368
3375/* Change window state from mapped to iconified. */ 3369/* Change window state from mapped to iconified. */
3376 3370
3377void 3371void x_iconify_frame (f)
3378x_iconify_frame (f)
3379 struct frame *f; 3372 struct frame *f;
3380{ 3373{
3381 int result; 3374 int result;
@@ -3449,12 +3442,12 @@ x_wm_set_size_hint (f, flags, user_position)
3449 3442
3450 flexlines = f->height; 3443 flexlines = f->height;
3451 3444
3452 enter_crit (CRIT_MSG); 3445 enter_crit ();
3453 3446
3454 SetWindowLong (window, WND_X_UNITS_INDEX, FONT_WIDTH (f->output_data.win32->font)); 3447 SetWindowLong (window, WND_X_UNITS_INDEX, FONT_WIDTH (f->output_data.win32->font));
3455 SetWindowLong (window, WND_Y_UNITS_INDEX, f->output_data.win32->line_height); 3448 SetWindowLong (window, WND_Y_UNITS_INDEX, f->output_data.win32->line_height);
3456 3449
3457 leave_crit (CRIT_MSG); 3450 leave_crit ();
3458} 3451}
3459 3452
3460/* Window manager things */ 3453/* Window manager things */
@@ -3507,7 +3500,7 @@ win32_term_init (display_name, xrm_option, resource_name)
3507 char *defaultvalue; 3500 char *defaultvalue;
3508 struct win32_display_info *dpyinfo; 3501 struct win32_display_info *dpyinfo;
3509 HDC hdc; 3502 HDC hdc;
3510 3503
3511 BLOCK_INPUT; 3504 BLOCK_INPUT;
3512 3505
3513 if (!win32_initialized) 3506 if (!win32_initialized)
@@ -3538,7 +3531,7 @@ win32_term_init (display_name, xrm_option, resource_name)
3538 win32_display_name_list = Fcons (Fcons (display_name, Qnil), 3531 win32_display_name_list = Fcons (Fcons (display_name, Qnil),
3539 win32_display_name_list); 3532 win32_display_name_list);
3540 dpyinfo->name_list_element = XCONS (win32_display_name_list)->car; 3533 dpyinfo->name_list_element = XCONS (win32_display_name_list)->car;
3541 3534
3542 dpyinfo->win32_id_name 3535 dpyinfo->win32_id_name
3543 = (char *) xmalloc (XSTRING (Vinvocation_name)->size 3536 = (char *) xmalloc (XSTRING (Vinvocation_name)->size
3544 + XSTRING (Vsystem_name)->size 3537 + XSTRING (Vsystem_name)->size
@@ -3554,7 +3547,7 @@ win32_term_init (display_name, xrm_option, resource_name)
3554 all versions. */ 3547 all versions. */
3555 dpyinfo->xrdb = xrdb; 3548 dpyinfo->xrdb = xrdb;
3556#endif 3549#endif
3557 hdc = GetDC (GetDesktopWindow ()); 3550 hdc = my_get_dc (GetDesktopWindow ());
3558 3551
3559 dpyinfo->height = GetDeviceCaps (hdc, VERTRES); 3552 dpyinfo->height = GetDeviceCaps (hdc, VERTRES);
3560 dpyinfo->width = GetDeviceCaps (hdc, HORZRES); 3553 dpyinfo->width = GetDeviceCaps (hdc, HORZRES);
@@ -3563,7 +3556,6 @@ win32_term_init (display_name, xrm_option, resource_name)
3563 dpyinfo->n_cbits = GetDeviceCaps (hdc, BITSPIXEL); 3556 dpyinfo->n_cbits = GetDeviceCaps (hdc, BITSPIXEL);
3564 dpyinfo->height_in = GetDeviceCaps (hdc, LOGPIXELSX); 3557 dpyinfo->height_in = GetDeviceCaps (hdc, LOGPIXELSX);
3565 dpyinfo->width_in = GetDeviceCaps (hdc, LOGPIXELSY); 3558 dpyinfo->width_in = GetDeviceCaps (hdc, LOGPIXELSY);
3566 dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE;
3567 dpyinfo->grabbed = 0; 3559 dpyinfo->grabbed = 0;
3568 dpyinfo->reference_count = 0; 3560 dpyinfo->reference_count = 0;
3569 dpyinfo->n_fonts = 0; 3561 dpyinfo->n_fonts = 0;
@@ -3585,13 +3577,6 @@ win32_term_init (display_name, xrm_option, resource_name)
3585 3577
3586 ReleaseDC (GetDesktopWindow (), hdc); 3578 ReleaseDC (GetDesktopWindow (), hdc);
3587 3579
3588 /* initialise palette with white and black */
3589 {
3590 COLORREF color;
3591 defined_color (0, "white", &color, 1);
3592 defined_color (0, "black", &color, 1);
3593 }
3594
3595#ifndef F_SETOWN_BUG 3580#ifndef F_SETOWN_BUG
3596#ifdef F_SETOWN 3581#ifdef F_SETOWN
3597#ifdef F_SETOWN_SOCK_NEG 3582#ifdef F_SETOWN_SOCK_NEG
@@ -3641,21 +3626,6 @@ x_delete_display (dpyinfo)
3641 } 3626 }
3642 } 3627 }
3643 3628
3644 /* free palette table */
3645 {
3646 struct win32_palette_entry * plist;
3647
3648 plist = dpyinfo->p_colors_in_use;
3649 while (plist)
3650 {
3651 struct win32_palette_entry * pentry = plist;
3652 plist = plist->next;
3653 xfree (pentry);
3654 }
3655 dpyinfo->p_colors_in_use = NULL;
3656 if (dpyinfo->h_palette)
3657 DeleteObject (dpyinfo->h_palette);
3658 }
3659 xfree (dpyinfo->font_table); 3629 xfree (dpyinfo->font_table);
3660 xfree (dpyinfo->win32_id_name); 3630 xfree (dpyinfo->win32_id_name);
3661} 3631}