summaryrefslogtreecommitdiff
path: root/src/w32term.c
diff options
context:
space:
mode:
authorGeoff Voelker <voelker@cs.washington.edu>1996-01-25 03:05:03 +0000
committerGeoff Voelker <voelker@cs.washington.edu>1996-01-25 03:05:03 +0000
commitf2d5bf4da9835c945c8b4faf73c5ebc1042b5adb (patch)
tree3f7890fd01c7ea31be8afe634cef8e95cc172a06 /src/w32term.c
parent413b9d5865e9db3ba473e0b7f741e6e6c072204f (diff)
downloademacs-f2d5bf4da9835c945c8b4faf73c5ebc1042b5adb.tar.gz
ubackout 1.3 and 1.4
Diffstat (limited to 'src/w32term.c')
-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)
{
HDC hdc;
HBRUSH hb;
+ HANDLE oldobj;
RECT rect;
if (_hdc)
@@ -202,15 +203,18 @@ win32_fill_rect (f, _hdc, pix, lprect)
else
{
if (!f) return;
- hdc = GetFrameDC (f);
+ hdc = my_get_dc (FRAME_WIN32_WINDOW (f));
}
hb = CreateSolidBrush (pix);
+ oldobj = SelectObject (hdc, hb);
+
FillRect (hdc, lprect, hb);
+ SelectObject (hdc, oldobj);
DeleteObject (hb);
if (!_hdc)
- ReleaseFrameDC (f, hdc);
+ ReleaseDC (FRAME_WIN32_WINDOW (f), hdc);
}
void
@@ -218,7 +222,7 @@ win32_clear_window (f)
FRAME_PTR f;
{
RECT rect;
-
+
GetClientRect (FRAME_WIN32_WINDOW (f), &rect);
win32_clear_rect (f, NULL, &rect);
}
@@ -245,14 +249,6 @@ win32_update_begin (f)
BLOCK_INPUT;
- /* Regenerate display palette before drawing if list of requested
- colors has changed. */
- if (FRAME_WIN32_DISPLAY_INFO (f)->regen_palette)
- {
- win32_regenerate_palette (f);
- FRAME_WIN32_DISPLAY_INFO (f)->regen_palette = FALSE;
- }
-
if (f == FRAME_WIN32_DISPLAY_INFO (f)->mouse_face_mouse_frame)
{
/* Don't do highlighting for mouse motion during the update. */
@@ -422,7 +418,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
int orig_left = left;
HDC hdc;
- hdc = GetFrameDC (f);
+ hdc = my_get_dc (window);
while (n > 0)
{
@@ -575,7 +571,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
}
}
- ReleaseFrameDC (f, hdc);
+ ReleaseDC (window, hdc);
}
@@ -832,7 +828,7 @@ do_line_dance ()
x_display_cursor (updating_frame, 0);
- hdc = GetFrameDC (f);
+ hdc = my_get_dc (FRAME_WIN32_WINDOW (f));
for (i = 0; i < ht; ++i)
if (line_dance[i] != -1 && (distance = line_dance[i]-i) > 0)
@@ -866,7 +862,7 @@ do_line_dance ()
i = j+1;
}
- ReleaseFrameDC (f, hdc);
+ ReleaseDC (FRAME_WIN32_WINDOW (f), hdc);
for (i = 0; i < ht; ++i)
if (line_dance[i] == -1)
@@ -2276,7 +2272,7 @@ w32_read_socket (sd, bufp, numchars, waitp, expected)
if (numchars <= 0)
abort (); /* Don't think this happens. */
- while (get_next_msg (&msg, FALSE))
+ while (get_next_msg (&msg, 0))
{
switch (msg.msg.message)
{
@@ -2312,12 +2308,6 @@ w32_read_socket (sd, bufp, numchars, waitp, expected)
}
break;
- case WM_PALETTECHANGED:
- f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
- if (f)
- /* Realize palette - will force update if needed. */
- ReleaseFrameDC (f, GetFrameDC (f));
- break;
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
@@ -2453,7 +2443,7 @@ w32_read_socket (sd, bufp, numchars, waitp, expected)
int width;
int height;
- GetClientRect (msg.msg.hwnd, &rect);
+ GetClientRect(msg.msg.hwnd, &rect);
height = rect.bottom - rect.top + 1;
width = rect.right - rect.left + 1;
@@ -2646,19 +2636,25 @@ x_draw_box (f)
HBRUSH hb;
HDC hdc;
- hdc = GetFrameDC (f);
+ hdc = my_get_dc (FRAME_WIN32_WINDOW (f));
hb = CreateSolidBrush (f->output_data.win32->cursor_pixel);
rect.left = CHAR_TO_PIXEL_COL (f, curs_x);
rect.top = CHAR_TO_PIXEL_ROW (f, curs_y);
- rect.right = rect.left + FONT_WIDTH (f->output_data.win32->font);
- rect.bottom = rect.top + f->output_data.win32->line_height;
-
+ rect.right = rect.left + FONT_WIDTH (f->output_data.win32->font) - 1;
+ rect.bottom = rect.top + f->output_data.win32->line_height - 1;
+
+ /* rect.left++; */
+ /* rect.top++; */
+ rect.right--;
+ rect.bottom--;
+
FrameRect (hdc, &rect, hb);
+
DeleteObject (hb);
-
- ReleaseFrameDC (f, hdc);
+
+ ReleaseDC (FRAME_WIN32_WINDOW (f), hdc);
}
/* Clear the cursor of frame F to background color,
@@ -3020,8 +3016,8 @@ x_calc_absolute_position (f)
rt.left = rt.right = rt.top = rt.bottom = 0;
BLOCK_INPUT;
- AdjustWindowRect (&rt, f->output_data.win32->dwStyle,
- FRAME_EXTERNAL_MENU_BAR (f));
+ AdjustWindowRect(&rt, f->output_data.win32->dwStyle,
+ FRAME_EXTERNAL_MENU_BAR (f));
UNBLOCK_INPUT;
pt.x += (rt.right - rt.left);
@@ -3128,8 +3124,8 @@ x_set_window_size (f, change_gravity, cols, rows)
rect.right = pixelwidth;
rect.bottom = pixelheight;
- AdjustWindowRect (&rect, f->output_data.win32->dwStyle,
- FRAME_EXTERNAL_MENU_BAR (f));
+ AdjustWindowRect(&rect, f->output_data.win32->dwStyle,
+ FRAME_EXTERNAL_MENU_BAR (f));
/* All windows have an extra pixel */
@@ -3287,13 +3283,11 @@ x_make_frame_visible (f)
if we get to x_make_frame_visible a second time
before the window gets really visible. */
if (! FRAME_ICONIFIED_P (f)
- && ! f->output_data.win32->asked_for_visible) {
- x_set_offset (f, f->output_data.win32->left_pos,
- f->output_data.win32->top_pos, 0);
- SetForegroundWindow (FRAME_WIN32_WINDOW (f));
- }
+ && ! f->output_data.win32->asked_for_visible)
+ x_set_offset (f, f->output_data.win32->left_pos, f->output_data.win32->top_pos, 0);
f->output_data.win32->asked_for_visible = 1;
+
ShowWindow (FRAME_WIN32_WINDOW (f), SW_SHOW);
}
@@ -3374,8 +3368,7 @@ x_make_frame_invisible (f)
/* Change window state from mapped to iconified. */
-void
-x_iconify_frame (f)
+void x_iconify_frame (f)
struct frame *f;
{
int result;
@@ -3449,12 +3442,12 @@ x_wm_set_size_hint (f, flags, user_position)
flexlines = f->height;
- enter_crit (CRIT_MSG);
+ enter_crit ();
SetWindowLong (window, WND_X_UNITS_INDEX, FONT_WIDTH (f->output_data.win32->font));
SetWindowLong (window, WND_Y_UNITS_INDEX, f->output_data.win32->line_height);
- leave_crit (CRIT_MSG);
+ leave_crit ();
}
/* Window manager things */
@@ -3507,7 +3500,7 @@ win32_term_init (display_name, xrm_option, resource_name)
char *defaultvalue;
struct win32_display_info *dpyinfo;
HDC hdc;
-
+
BLOCK_INPUT;
if (!win32_initialized)
@@ -3538,7 +3531,7 @@ win32_term_init (display_name, xrm_option, resource_name)
win32_display_name_list = Fcons (Fcons (display_name, Qnil),
win32_display_name_list);
dpyinfo->name_list_element = XCONS (win32_display_name_list)->car;
-
+
dpyinfo->win32_id_name
= (char *) xmalloc (XSTRING (Vinvocation_name)->size
+ XSTRING (Vsystem_name)->size
@@ -3554,7 +3547,7 @@ win32_term_init (display_name, xrm_option, resource_name)
all versions. */
dpyinfo->xrdb = xrdb;
#endif
- hdc = GetDC (GetDesktopWindow ());
+ hdc = my_get_dc (GetDesktopWindow ());
dpyinfo->height = GetDeviceCaps (hdc, VERTRES);
dpyinfo->width = GetDeviceCaps (hdc, HORZRES);
@@ -3563,7 +3556,6 @@ win32_term_init (display_name, xrm_option, resource_name)
dpyinfo->n_cbits = GetDeviceCaps (hdc, BITSPIXEL);
dpyinfo->height_in = GetDeviceCaps (hdc, LOGPIXELSX);
dpyinfo->width_in = GetDeviceCaps (hdc, LOGPIXELSY);
- dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE;
dpyinfo->grabbed = 0;
dpyinfo->reference_count = 0;
dpyinfo->n_fonts = 0;
@@ -3585,13 +3577,6 @@ win32_term_init (display_name, xrm_option, resource_name)
ReleaseDC (GetDesktopWindow (), hdc);
- /* initialise palette with white and black */
- {
- COLORREF color;
- defined_color (0, "white", &color, 1);
- defined_color (0, "black", &color, 1);
- }
-
#ifndef F_SETOWN_BUG
#ifdef F_SETOWN
#ifdef F_SETOWN_SOCK_NEG
@@ -3641,21 +3626,6 @@ x_delete_display (dpyinfo)
}
}
- /* free palette table */
- {
- struct win32_palette_entry * plist;
-
- plist = dpyinfo->p_colors_in_use;
- while (plist)
- {
- struct win32_palette_entry * pentry = plist;
- plist = plist->next;
- xfree (pentry);
- }
- dpyinfo->p_colors_in_use = NULL;
- if (dpyinfo->h_palette)
- DeleteObject (dpyinfo->h_palette);
- }
xfree (dpyinfo->font_table);
xfree (dpyinfo->win32_id_name);
}