~ubuntu-branches/ubuntu/karmic/emacs-snapshot/karmic

« back to all changes in this revision

Viewing changes to src/w32term.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-04-05 09:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090405091430-nw07lynn2arotjbe
Tags: upstream-20090320
ImportĀ upstreamĀ versionĀ 20090320

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Implementation of GUI terminal on the Microsoft W32 API.
2
2
   Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998,
3
3
                 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4
 
                 2006, 2007, 2008 Free Software Foundation, Inc.
 
4
                 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
5
5
 
6
6
This file is part of GNU Emacs.
7
7
 
31
31
 
32
32
#include <ctype.h>
33
33
#include <errno.h>
34
 
#include <setjmp.h>
35
34
#include <sys/stat.h>
36
35
 
37
36
#include "charset.h"
439
438
  else if (INTEGERP (Vframe_alpha_lower_limit))
440
439
    alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;
441
440
 
442
 
  if (alpha < 0.0 || 1.0 < alpha)
 
441
  if (alpha < 0.0)
 
442
    return;
 
443
  else if (alpha > 1.0)
443
444
    alpha = 1.0;
444
445
  else if (alpha < alpha_min && alpha_min <= 1.0)
445
446
    alpha = alpha_min;
463
464
x_display_pixel_height (dpyinfo)
464
465
     struct w32_display_info *dpyinfo;
465
466
{
466
 
  return GetDeviceCaps (GetDC (GetDesktopWindow ()), VERTRES);
 
467
  HDC dc = GetDC (NULL);
 
468
  int pixels = GetDeviceCaps (dc, VERTRES);
 
469
  ReleaseDC (NULL, dc);
 
470
  return pixels;
467
471
}
468
472
 
469
473
int
470
474
x_display_pixel_width (dpyinfo)
471
475
     struct w32_display_info *dpyinfo;
472
476
{
473
 
  return GetDeviceCaps (GetDC (GetDesktopWindow ()), HORZRES);
 
477
  HDC dc = GetDC (NULL);
 
478
  int pixels = GetDeviceCaps (dc, HORZRES);
 
479
  ReleaseDC (NULL, dc);
 
480
  return pixels;
474
481
}
475
482
 
476
483
 
1524
1531
  return 1;
1525
1532
}
1526
1533
 
 
1534
/* On frame F, translate pixel colors to RGB values for the NCOLORS
 
1535
   colors in COLORS.  On W32, we no longer try to map colors to
 
1536
   a palette.  */
 
1537
void
 
1538
x_query_colors (f, colors, ncolors)
 
1539
     struct frame *f;
 
1540
     XColor *colors;
 
1541
     int ncolors;
 
1542
{
 
1543
  int i;
 
1544
 
 
1545
  for (i = 0; i < ncolors; i++)
 
1546
    {
 
1547
      DWORD pixel = colors[i].pixel;
 
1548
      /* Convert to a 16 bit value in range 0 - 0xffff. */
 
1549
      colors[i].red = GetRValue (pixel) * 257;
 
1550
      colors[i].green = GetGValue (pixel) * 257;
 
1551
      colors[i].blue = GetBValue (pixel) * 257;
 
1552
    }
 
1553
}
 
1554
 
 
1555
void
 
1556
x_query_color (f, color)
 
1557
     struct frame *f;
 
1558
     XColor *color;
 
1559
{
 
1560
  x_query_colors (f, color, 1);
 
1561
}
 
1562
 
1527
1563
 
1528
1564
/* Set up the foreground color for drawing relief lines of glyph
1529
1565
   string S.  RELIEF is a pointer to a struct relief containing the GC
2239
2275
    {
2240
2276
      int width;
2241
2277
      struct glyph_string *next;
2242
 
      for (width = 0, next = s->next; next;
 
2278
      for (width = 0, next = s->next;
 
2279
           next && width < s->right_overhang;
2243
2280
           width += next->width, next = next->next)
2244
2281
        if (next->first_glyph->type != IMAGE_GLYPH)
2245
2282
          {
2246
2283
            x_set_glyph_string_gc (next);
2247
2284
            x_set_glyph_string_clipping (next);
2248
 
            x_draw_glyph_string_background (next, 1);
 
2285
            if (next->first_glyph->type == STRETCH_GLYPH)
 
2286
              x_draw_stretch_glyph_string (next);
 
2287
            else
 
2288
              x_draw_glyph_string_background (next, 1);
2249
2289
            next->num_clips = 0;
2250
2290
          }
2251
2291
    }
4065
4105
 
4066
4106
      switch (msg.msg.message)
4067
4107
        {
4068
 
        case WM_PAINT:
 
4108
        case WM_EMACS_PAINT:
4069
4109
          f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
4070
4110
 
4071
4111
          if (f)
4985
5025
          w32_fill_area (f, hdc, cursor_color, x,
4986
5026
                         WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
4987
5027
                                                  row->height - width),
4988
 
                         cursor_glyph->pixel_width, width);
 
5028
                         min (FRAME_COLUMN_WIDTH (f), cursor_glyph->pixel_width),
 
5029
                         width);
4989
5030
        }
4990
5031
 
4991
5032
      w32_set_clip_rectangle (hdc, NULL);
5222
5263
  if (FRAME_FONT (f) == font)
5223
5264
    /* This font is already set in frame F.  There's nothing more to
5224
5265
       do.  */
5225
 
    return fontset_name (fontset);
5226
 
 
5227
 
  BLOCK_INPUT;
 
5266
    return font_object;
5228
5267
 
5229
5268
  FRAME_FONT (f) = font;
5230
5269
  FRAME_BASELINE_OFFSET (f) = font->baseline_offset;
5257
5296
        x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
5258
5297
    }
5259
5298
 
5260
 
#ifdef HAVE_X_I18N
5261
 
  if (FRAME_XIC (f)
5262
 
      && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea)))
5263
 
    xic_set_xfontset (f, SDATA (fontset_ascii (fontset)));
5264
 
#endif
5265
 
 
5266
 
  UNBLOCK_INPUT;
5267
 
 
5268
 
  return fontset_name (fontset);
 
5299
  /* X version sets font of input methods here also.  */
 
5300
 
 
5301
  return font_object;
5269
5302
}
5270
5303
 
5271
5304
 
6144
6177
  struct w32_display_info *dpyinfo = terminal->display_info.w32;
6145
6178
  int i;
6146
6179
 
6147
 
  /* Protect against recursive calls.  Fdelete_frame in
 
6180
  /* Protect against recursive calls.  delete_frame in
6148
6181
     delete_terminal calls us back when it deletes our last frame.  */
6149
6182
  if (!terminal->name)
6150
6183
    return;
6189
6222
  dpyinfo->next = x_display_list;
6190
6223
  x_display_list = dpyinfo;
6191
6224
 
6192
 
  hdc = GetDC (GetDesktopWindow ());
 
6225
  hdc = GetDC (NULL);
6193
6226
 
6194
6227
  dpyinfo->root_window = GetDesktopWindow ();
6195
6228
  dpyinfo->n_planes = GetDeviceCaps (hdc, PLANES);
6197
6230
  dpyinfo->resx = GetDeviceCaps (hdc, LOGPIXELSX);
6198
6231
  dpyinfo->resy = GetDeviceCaps (hdc, LOGPIXELSY);
6199
6232
  dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE;
6200
 
  dpyinfo->terminal->image_cache = make_image_cache ();
6201
 
  ReleaseDC (GetDesktopWindow (), hdc);
 
6233
  ReleaseDC (NULL, hdc);
6202
6234
 
6203
6235
  /* initialise palette with white and black */
6204
6236
  {