changeset 14351:fb2ce4ebc871

ubackout 1.3 and 1.4
author Geoff Voelker <voelker@cs.washington.edu>
date Thu, 25 Jan 1996 03:05:03 +0000
parents 654081a41047
children a05133ebf2bf
files src/w32term.c
diffstat 1 files changed, 38 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32term.c	Thu Jan 25 01:17:24 1996 +0000
+++ b/src/w32term.c	Thu Jan 25 03:05:03 1996 +0000
@@ -195,6 +195,7 @@
 {
   HDC hdc;
   HBRUSH hb;
+  HANDLE oldobj;
   RECT rect;
   
   if (_hdc)
@@ -202,15 +203,18 @@
   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 @@
      FRAME_PTR f;
 {
   RECT rect;
-
+    
   GetClientRect (FRAME_WIN32_WINDOW (f), &rect);
   win32_clear_rect (f, NULL, &rect);
 }
@@ -245,14 +249,6 @@
 
   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 @@
   int orig_left = left;
   HDC hdc;
 
-  hdc = GetFrameDC (f);
+  hdc = my_get_dc (window);
 
   while (n > 0)
     {
@@ -575,7 +571,7 @@
       }
     }
 
-  ReleaseFrameDC (f, hdc);
+  ReleaseDC (window, hdc);
 }
 
 
@@ -832,7 +828,7 @@
 
   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 @@
 	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 @@
   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 @@
 	  }
 	  
 	  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 @@
 	      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 @@
   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 @@
       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 @@
     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 @@
 	 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 @@
 
 /* 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 @@
 
   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 @@
   char *defaultvalue;
   struct win32_display_info *dpyinfo;
   HDC hdc;
-
+  
   BLOCK_INPUT;
   
   if (!win32_initialized)
@@ -3538,7 +3531,7 @@
   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 @@
      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 @@
   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 @@
   
   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 @@
 	}
     }
 
-  /* 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);
 }