296 |
FARPROC track_mouse_event_fn; |
FARPROC track_mouse_event_fn; |
297 |
|
|
298 |
/* W95 mousewheel handler */ |
/* W95 mousewheel handler */ |
299 |
unsigned int msh_mousewheel = 0; |
unsigned int msh_mousewheel = 0; |
300 |
|
|
301 |
/* Timers */ |
/* Timers */ |
302 |
#define MOUSE_BUTTON_ID 1 |
#define MOUSE_BUTTON_ID 1 |
346 |
|
|
347 |
/* Nonzero if we can use mouse menus. |
/* Nonzero if we can use mouse menus. |
348 |
You should not call this unless HAVE_MENUS is defined. */ |
You should not call this unless HAVE_MENUS is defined. */ |
349 |
|
|
350 |
int |
int |
351 |
have_menus_p () |
have_menus_p () |
352 |
{ |
{ |
371 |
return f; |
return f; |
372 |
} |
} |
373 |
|
|
374 |
/* Let the user specify an display with a frame. |
/* Let the user specify a display with a frame. |
375 |
nil stands for the selected frame--or, if that is not a w32 frame, |
nil stands for the selected frame--or, if that is not a w32 frame, |
376 |
the first display on the list. */ |
the first display on the list. */ |
377 |
|
|
382 |
if (NILP (frame)) |
if (NILP (frame)) |
383 |
{ |
{ |
384 |
struct frame *sf = XFRAME (selected_frame); |
struct frame *sf = XFRAME (selected_frame); |
385 |
|
|
386 |
if (FRAME_W32_P (sf) && FRAME_LIVE_P (sf)) |
if (FRAME_W32_P (sf) && FRAME_LIVE_P (sf)) |
387 |
return FRAME_W32_DISPLAY_INFO (sf); |
return FRAME_W32_DISPLAY_INFO (sf); |
388 |
else |
else |
590 |
if (hinst == NULL) |
if (hinst == NULL) |
591 |
return -1; |
return -1; |
592 |
|
|
593 |
|
|
594 |
result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
595 |
filename, &width, &height, &bitmap, &xhot, &yhot); |
filename, &width, &height, &bitmap, &xhot, &yhot); |
596 |
if (result != BitmapSuccess) |
if (result != BitmapSuccess) |
863 |
They are independent of other properties, but other properties (e.g., |
They are independent of other properties, but other properties (e.g., |
864 |
cursor_color) are dependent upon them. */ |
cursor_color) are dependent upon them. */ |
865 |
/* Process default font as well, since fringe widths depends on it. */ |
/* Process default font as well, since fringe widths depends on it. */ |
866 |
for (p = 0; p < i; p++) |
for (p = 0; p < i; p++) |
867 |
{ |
{ |
868 |
Lisp_Object prop, val; |
Lisp_Object prop, val; |
869 |
|
|
882 |
if (NILP (Fequal (val, old_value))) |
if (NILP (Fequal (val, old_value))) |
883 |
{ |
{ |
884 |
store_frame_param (f, prop, val); |
store_frame_param (f, prop, val); |
885 |
|
|
886 |
param_index = Fget (prop, Qx_frame_parameter); |
param_index = Fget (prop, Qx_frame_parameter); |
887 |
if (NATNUMP (param_index) |
if (NATNUMP (param_index) |
888 |
&& (XFASTINT (param_index) |
&& (XFASTINT (param_index) |
978 |
position. Resize of the frame is taken care of in the code after |
position. Resize of the frame is taken care of in the code after |
979 |
this if-statement. */ |
this if-statement. */ |
980 |
int new_left, new_top; |
int new_left, new_top; |
981 |
|
|
982 |
x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); |
x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); |
983 |
x_fullscreen_move (f, new_top, new_left); |
x_fullscreen_move (f, new_top, new_left); |
984 |
} |
} |
1245 |
} |
} |
1246 |
|
|
1247 |
/* The default colors for the w32 color map */ |
/* The default colors for the w32 color map */ |
1248 |
typedef struct colormap_t |
typedef struct colormap_t |
1249 |
{ |
{ |
1250 |
char *name; |
char *name; |
1251 |
COLORREF colorref; |
COLORREF colorref; |
1252 |
} colormap_t; |
} colormap_t; |
1253 |
|
|
1254 |
colormap_t w32_color_map[] = |
colormap_t w32_color_map[] = |
1255 |
{ |
{ |
1256 |
{"snow" , PALETTERGB (255,250,250)}, |
{"snow" , PALETTERGB (255,250,250)}, |
1257 |
{"ghost white" , PALETTERGB (248,248,255)}, |
{"ghost white" , PALETTERGB (248,248,255)}, |
1502 |
int i; |
int i; |
1503 |
colormap_t *pc = w32_color_map; |
colormap_t *pc = w32_color_map; |
1504 |
Lisp_Object cmap; |
Lisp_Object cmap; |
1505 |
|
|
1506 |
BLOCK_INPUT; |
BLOCK_INPUT; |
1507 |
|
|
1508 |
cmap = Qnil; |
cmap = Qnil; |
1509 |
|
|
1510 |
for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]); |
for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]); |
1511 |
pc++, i++) |
pc++, i++) |
1512 |
cmap = Fcons (Fcons (build_string (pc->name), |
cmap = Fcons (Fcons (build_string (pc->name), |
1513 |
make_number (pc->colorref)), |
make_number (pc->colorref)), |
1514 |
cmap); |
cmap); |
1515 |
|
|
1516 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
1517 |
|
|
1518 |
return (cmap); |
return (cmap); |
1519 |
} |
} |
1520 |
|
|
1521 |
Lisp_Object |
Lisp_Object |
1522 |
w32_to_x_color (rgb) |
w32_to_x_color (rgb) |
1523 |
Lisp_Object rgb; |
Lisp_Object rgb; |
1524 |
{ |
{ |
1525 |
Lisp_Object color; |
Lisp_Object color; |
1526 |
|
|
1527 |
CHECK_NUMBER (rgb); |
CHECK_NUMBER (rgb); |
1528 |
|
|
1529 |
BLOCK_INPUT; |
BLOCK_INPUT; |
1530 |
|
|
1531 |
color = Frassq (rgb, Vw32_color_map); |
color = Frassq (rgb, Vw32_color_map); |
1532 |
|
|
1533 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
1534 |
|
|
1535 |
if (!NILP (color)) |
if (!NILP (color)) |
1536 |
return (Fcar (color)); |
return (Fcar (color)); |
1537 |
else |
else |
1570 |
return ret; |
return ret; |
1571 |
} |
} |
1572 |
|
|
1573 |
COLORREF |
COLORREF |
1574 |
x_to_w32_color (colorname) |
x_to_w32_color (colorname) |
1575 |
char * colorname; |
char * colorname; |
1576 |
{ |
{ |
1584 |
char *color; |
char *color; |
1585 |
int size; |
int size; |
1586 |
color = colorname + 1; |
color = colorname + 1; |
1587 |
|
|
1588 |
size = strlen(color); |
size = strlen(color); |
1589 |
if (size == 3 || size == 6 || size == 9 || size == 12) |
if (size == 3 || size == 6 || size == 9 || size == 12) |
1590 |
{ |
{ |
1593 |
pos = 0; |
pos = 0; |
1594 |
size /= 3; |
size /= 3; |
1595 |
colorval = 0; |
colorval = 0; |
1596 |
|
|
1597 |
for (i = 0; i < 3; i++) |
for (i = 0; i < 3; i++) |
1598 |
{ |
{ |
1599 |
char *end; |
char *end; |
1649 |
{ |
{ |
1650 |
char *end; |
char *end; |
1651 |
unsigned long value; |
unsigned long value; |
1652 |
|
|
1653 |
/* The check for 'x' in the following conditional takes into |
/* The check for 'x' in the following conditional takes into |
1654 |
account the fact that strtol allows a "0x" in front of |
account the fact that strtol allows a "0x" in front of |
1655 |
our numbers, and we don't. */ |
our numbers, and we don't. */ |
1712 |
if (value < 0.0 || value > 1.0) |
if (value < 0.0 || value > 1.0) |
1713 |
break; |
break; |
1714 |
val = (UINT)(0x100 * value); |
val = (UINT)(0x100 * value); |
1715 |
/* We used 0x100 instead of 0xFF to give an continuous |
/* We used 0x100 instead of 0xFF to give a continuous |
1716 |
range between 0.0 and 1.0 inclusive. The next statement |
range between 0.0 and 1.0 inclusive. The next statement |
1717 |
fixes the 1.0 case. */ |
fixes the 1.0 case. */ |
1718 |
if (val == 0x100) |
if (val == 0x100) |
1736 |
RGB. */ |
RGB. */ |
1737 |
|
|
1738 |
/* If we fail to lookup the color name in w32_color_map, then check the |
/* If we fail to lookup the color name in w32_color_map, then check the |
1739 |
colorname to see if it can be crudely approximated: If the X color |
colorname to see if it can be crudely approximated: If the X color |
1740 |
ends in a number (e.g., "darkseagreen2"), strip the number and |
ends in a number (e.g., "darkseagreen2"), strip the number and |
1741 |
return the result of looking up the base color name. */ |
return the result of looking up the base color name. */ |
1742 |
ret = w32_color_map_lookup (colorname); |
ret = w32_color_map_lookup (colorname); |
1743 |
if (NILP (ret)) |
if (NILP (ret)) |
1744 |
{ |
{ |
1745 |
int len = strlen (colorname); |
int len = strlen (colorname); |
1746 |
|
|
1747 |
if (isdigit (colorname[len - 1])) |
if (isdigit (colorname[len - 1])) |
1748 |
{ |
{ |
1749 |
char *ptr, *approx = alloca (len + 1); |
char *ptr, *approx = alloca (len + 1); |
1750 |
|
|
1751 |
strcpy (approx, colorname); |
strcpy (approx, colorname); |
1752 |
ptr = &approx[len - 1]; |
ptr = &approx[len - 1]; |
1753 |
while (ptr > approx && isdigit (*ptr)) |
while (ptr > approx && isdigit (*ptr)) |
1754 |
*ptr-- = '\0'; |
*ptr-- = '\0'; |
1755 |
|
|
1756 |
ret = w32_color_map_lookup (approx); |
ret = w32_color_map_lookup (approx); |
1757 |
} |
} |
1758 |
} |
} |
1759 |
|
|
1760 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
1761 |
return ret; |
return ret; |
1762 |
} |
} |
1911 |
|
|
1912 |
tem = x_to_w32_color (color); |
tem = x_to_w32_color (color); |
1913 |
|
|
1914 |
if (!NILP (tem)) |
if (!NILP (tem)) |
1915 |
{ |
{ |
1916 |
if (f) |
if (f) |
1917 |
{ |
{ |
1928 |
one_w32_display_info.color_list; |
one_w32_display_info.color_list; |
1929 |
struct w32_palette_entry ** prev = |
struct w32_palette_entry ** prev = |
1930 |
&one_w32_display_info.color_list; |
&one_w32_display_info.color_list; |
1931 |
|
|
1932 |
/* check if color is already mapped */ |
/* check if color is already mapped */ |
1933 |
while (entry) |
while (entry) |
1934 |
{ |
{ |
1964 |
|
|
1965 |
return 1; |
return 1; |
1966 |
} |
} |
1967 |
else |
else |
1968 |
{ |
{ |
1969 |
return 0; |
return 0; |
1970 |
} |
} |
2166 |
else |
else |
2167 |
hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch); |
hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch); |
2168 |
x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s"); |
x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s"); |
2169 |
|
|
2170 |
x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); |
x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); |
2171 |
if (!EQ (Qnil, Vx_mode_pointer_shape)) |
if (!EQ (Qnil, Vx_mode_pointer_shape)) |
2172 |
{ |
{ |
2249 |
&& f->output_data.w32->modeline_cursor != 0) |
&& f->output_data.w32->modeline_cursor != 0) |
2250 |
XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor); |
XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor); |
2251 |
f->output_data.w32->modeline_cursor = mode_cursor; |
f->output_data.w32->modeline_cursor = mode_cursor; |
2252 |
|
|
2253 |
if (cross_cursor != f->output_data.w32->cross_cursor |
if (cross_cursor != f->output_data.w32->cross_cursor |
2254 |
&& f->output_data.w32->cross_cursor != 0) |
&& f->output_data.w32->cross_cursor != 0) |
2255 |
XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor); |
XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor); |
2279 |
fore_pixel = FRAME_BACKGROUND_PIXEL (f); |
fore_pixel = FRAME_BACKGROUND_PIXEL (f); |
2280 |
|
|
2281 |
pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
2282 |
|
|
2283 |
/* Make sure that the cursor color differs from the background color. */ |
/* Make sure that the cursor color differs from the background color. */ |
2284 |
if (pixel == FRAME_BACKGROUND_PIXEL (f)) |
if (pixel == FRAME_BACKGROUND_PIXEL (f)) |
2285 |
{ |
{ |
2312 |
|
|
2313 |
/* Set the border-color of frame F to pixel value PIX. |
/* Set the border-color of frame F to pixel value PIX. |
2314 |
Note that this does not fully take effect if done before |
Note that this does not fully take effect if done before |
2315 |
F has an window. */ |
F has a window. */ |
2316 |
void |
void |
2317 |
x_set_border_pixel (f, pix) |
x_set_border_pixel (f, pix) |
2318 |
struct frame *f; |
struct frame *f; |
2369 |
if (NILP (arg) && NILP (oldval)) |
if (NILP (arg) && NILP (oldval)) |
2370 |
return; |
return; |
2371 |
|
|
2372 |
if (STRINGP (arg) && STRINGP (oldval) |
if (STRINGP (arg) && STRINGP (oldval) |
2373 |
&& EQ (Fstring_equal (oldval, arg), Qt)) |
&& EQ (Fstring_equal (oldval, arg), Qt)) |
2374 |
return; |
return; |
2375 |
|
|
2474 |
? x_new_fontset (f, SDATA (fontset_name)) |
? x_new_fontset (f, SDATA (fontset_name)) |
2475 |
: x_new_font (f, SDATA (arg))); |
: x_new_font (f, SDATA (arg))); |
2476 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
2477 |
|
|
2478 |
if (EQ (result, Qnil)) |
if (EQ (result, Qnil)) |
2479 |
error ("Font `%s' is not defined", SDATA (arg)); |
error ("Font `%s' is not defined", SDATA (arg)); |
2480 |
else if (EQ (result, Qt)) |
else if (EQ (result, Qt)) |
2741 |
Lisp_Object name; |
Lisp_Object name; |
2742 |
int explicit; |
int explicit; |
2743 |
{ |
{ |
2744 |
/* Make sure that requests from lisp code override requests from |
/* Make sure that requests from lisp code override requests from |
2745 |
Emacs redisplay code. */ |
Emacs redisplay code. */ |
2746 |
if (explicit) |
if (explicit) |
2747 |
{ |
{ |
2889 |
/* Put scroll bars on the right by default, as is conventional |
/* Put scroll bars on the right by default, as is conventional |
2890 |
on MS-Windows. */ |
on MS-Windows. */ |
2891 |
EQ (Qleft, arg) |
EQ (Qleft, arg) |
2892 |
? vertical_scroll_bar_left |
? vertical_scroll_bar_left |
2893 |
: vertical_scroll_bar_right; |
: vertical_scroll_bar_right; |
2894 |
|
|
2895 |
/* We set this parameter before creating the window for the |
/* We set this parameter before creating the window for the |
2930 |
} |
} |
2931 |
change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0); |
change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0); |
2932 |
XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0; |
XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0; |
2933 |
XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; |
XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; |
2934 |
} |
} |
2935 |
|
|
2936 |
/* Subroutines of creating an frame. */ |
/* Subroutines of creating a frame. */ |
2937 |
|
|
2938 |
/* Make sure that Vx_resource_name is set to a reasonable value. |
/* Make sure that Vx_resource_name is set to a reasonable value. |
2939 |
Fix it up, or set it to `emacs' if it is too hopeless. */ |
Fix it up, or set it to `emacs' if it is too hopeless. */ |
3160 |
if (!strcmp (SDATA (tem), "on") |
if (!strcmp (SDATA (tem), "on") |
3161 |
|| !strcmp (SDATA (tem), "true")) |
|| !strcmp (SDATA (tem), "true")) |
3162 |
return Qt; |
return Qt; |
3163 |
else |
else |
3164 |
return Qnil; |
return Qnil; |
3165 |
|
|
3166 |
case RES_TYPE_STRING: |
case RES_TYPE_STRING: |
3425 |
|
|
3426 |
extern LRESULT CALLBACK w32_wnd_proc (); |
extern LRESULT CALLBACK w32_wnd_proc (); |
3427 |
|
|
3428 |
BOOL |
BOOL |
3429 |
w32_init_class (hinst) |
w32_init_class (hinst) |
3430 |
HINSTANCE hinst; |
HINSTANCE hinst; |
3431 |
{ |
{ |
3445 |
return (RegisterClass (&wc)); |
return (RegisterClass (&wc)); |
3446 |
} |
} |
3447 |
|
|
3448 |
HWND |
HWND |
3449 |
w32_createscrollbar (f, bar) |
w32_createscrollbar (f, bar) |
3450 |
struct frame *f; |
struct frame *f; |
3451 |
struct scroll_bar * bar; |
struct scroll_bar * bar; |
3453 |
return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, |
return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, |
3454 |
/* Position and size of scroll bar. */ |
/* Position and size of scroll bar. */ |
3455 |
XINT(bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
XINT(bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
3456 |
XINT(bar->top), |
XINT(bar->top), |
3457 |
XINT(bar->width) - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
XINT(bar->width) - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
3458 |
XINT(bar->height), |
XINT(bar->height), |
3459 |
FRAME_W32_WINDOW (f), |
FRAME_W32_WINDOW (f), |
3462 |
NULL)); |
NULL)); |
3463 |
} |
} |
3464 |
|
|
3465 |
void |
void |
3466 |
w32_createwindow (f) |
w32_createwindow (f) |
3467 |
struct frame *f; |
struct frame *f; |
3468 |
{ |
{ |
3472 |
rect.left = rect.top = 0; |
rect.left = rect.top = 0; |
3473 |
rect.right = PIXEL_WIDTH (f); |
rect.right = PIXEL_WIDTH (f); |
3474 |
rect.bottom = PIXEL_HEIGHT (f); |
rect.bottom = PIXEL_HEIGHT (f); |
3475 |
|
|
3476 |
AdjustWindowRect (&rect, f->output_data.w32->dwStyle, |
AdjustWindowRect (&rect, f->output_data.w32->dwStyle, |
3477 |
FRAME_EXTERNAL_MENU_BAR (f)); |
FRAME_EXTERNAL_MENU_BAR (f)); |
3478 |
|
|
3479 |
/* Do first time app init */ |
/* Do first time app init */ |
3480 |
|
|
3481 |
if (!hprevinst) |
if (!hprevinst) |
3482 |
{ |
{ |
3483 |
w32_init_class (hinst); |
w32_init_class (hinst); |
3484 |
} |
} |
3485 |
|
|
3486 |
FRAME_W32_WINDOW (f) = hwnd |
FRAME_W32_WINDOW (f) = hwnd |
3487 |
= CreateWindow (EMACS_CLASS, |
= CreateWindow (EMACS_CLASS, |
3488 |
f->namebuf, |
f->namebuf, |
3506 |
|
|
3507 |
/* Enable drag-n-drop. */ |
/* Enable drag-n-drop. */ |
3508 |
DragAcceptFiles (hwnd, TRUE); |
DragAcceptFiles (hwnd, TRUE); |
3509 |
|
|
3510 |
/* Do this to discard the default setting specified by our parent. */ |
/* Do this to discard the default setting specified by our parent. */ |
3511 |
ShowWindow (hwnd, SW_HIDE); |
ShowWindow (hwnd, SW_HIDE); |
3512 |
} |
} |
3513 |
} |
} |
3514 |
|
|
3515 |
void |
void |
3516 |
my_post_msg (wmsg, hwnd, msg, wParam, lParam) |
my_post_msg (wmsg, hwnd, msg, wParam, lParam) |
3517 |
W32Msg * wmsg; |
W32Msg * wmsg; |
3518 |
HWND hwnd; |
HWND hwnd; |
3609 |
} |
} |
3610 |
|
|
3611 |
/* Emacs can lose focus while a modifier key has been pressed. When |
/* Emacs can lose focus while a modifier key has been pressed. When |
3612 |
it regains focus, be conservative and clear all modifiers since |
it regains focus, be conservative and clear all modifiers since |
3613 |
we cannot reconstruct the left and right modifier state. */ |
we cannot reconstruct the left and right modifier state. */ |
3614 |
static void |
static void |
3615 |
reset_modifiers () |
reset_modifiers () |
3664 |
if (!modifiers_recorded) |
if (!modifiers_recorded) |
3665 |
return; |
return; |
3666 |
|
|
3667 |
if (!(GetKeyState (VK_CONTROL) & 0x8000)) |
if (!(GetKeyState (VK_CONTROL) & 0x8000)) |
3668 |
modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; |
modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; |
3669 |
|
|
3670 |
if (!(GetKeyState (VK_MENU) & 0x8000)) |
if (!(GetKeyState (VK_MENU) & 0x8000)) |
3671 |
modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; |
modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; |
3672 |
} |
} |
3673 |
|
|
3877 |
HWND focus_window; |
HWND focus_window; |
3878 |
|
|
3879 |
msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL); |
msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL); |
3880 |
|
|
3881 |
while (GetMessage (&msg, NULL, 0, 0)) |
while (GetMessage (&msg, NULL, 0, 0)) |
3882 |
{ |
{ |
3883 |
if (msg.hwnd == NULL) |
if (msg.hwnd == NULL) |
4067 |
PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); |
PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); |
4068 |
} |
} |
4069 |
|
|
4070 |
DWORD |
DWORD |
4071 |
w32_msg_worker (dw) |
w32_msg_worker (dw) |
4072 |
DWORD dw; |
DWORD dw; |
4073 |
{ |
{ |
4075 |
deferred_msg dummy_buf; |
deferred_msg dummy_buf; |
4076 |
|
|
4077 |
/* Ensure our message queue is created */ |
/* Ensure our message queue is created */ |
4078 |
|
|
4079 |
PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); |
PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); |
4080 |
|
|
4081 |
if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) |
if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) |
4082 |
abort (); |
abort (); |
4083 |
|
|
4156 |
|
|
4157 |
/* Main window procedure */ |
/* Main window procedure */ |
4158 |
|
|
4159 |
LRESULT CALLBACK |
LRESULT CALLBACK |
4160 |
w32_wnd_proc (hwnd, msg, wParam, lParam) |
w32_wnd_proc (hwnd, msg, wParam, lParam) |
4161 |
HWND hwnd; |
HWND hwnd; |
4162 |
UINT msg; |
UINT msg; |
4185 |
w32_clear_rect, because these functions must obtain a DC handle |
w32_clear_rect, because these functions must obtain a DC handle |
4186 |
from the frame struct using get_frame_dc which is thread-aware. */ |
from the frame struct using get_frame_dc which is thread-aware. */ |
4187 |
|
|
4188 |
switch (msg) |
switch (msg) |
4189 |
{ |
{ |
4190 |
case WM_ERASEBKGND: |
case WM_ERASEBKGND: |
4191 |
f = x_window_to_frame (dpyinfo, hwnd); |
f = x_window_to_frame (dpyinfo, hwnd); |
4254 |
leave_crit (); |
leave_crit (); |
4255 |
|
|
4256 |
my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
4257 |
|
|
4258 |
return 0; |
return 0; |
4259 |
} |
} |
4260 |
|
|
4374 |
return 0; |
return 0; |
4375 |
break; |
break; |
4376 |
case VK_MENU: |
case VK_MENU: |
4377 |
if (NILP (Vw32_pass_alt_to_system)) |
if (NILP (Vw32_pass_alt_to_system)) |
4378 |
/* Prevent DefWindowProc from activating the menu bar if an |
/* Prevent DefWindowProc from activating the menu bar if an |
4379 |
Alt key is pressed and released by itself. */ |
Alt key is pressed and released by itself. */ |
4380 |
return 0; |
return 0; |
4381 |
windows_translate = 1; |
windows_translate = 1; |
4382 |
break; |
break; |
4383 |
case VK_CAPITAL: |
case VK_CAPITAL: |
4384 |
/* Decide whether to treat as modifier or function key. */ |
/* Decide whether to treat as modifier or function key. */ |
4385 |
if (NILP (Vw32_enable_caps_lock)) |
if (NILP (Vw32_enable_caps_lock)) |
4386 |
goto disable_lock_key; |
goto disable_lock_key; |
4417 |
w32_get_key_modifiers (wParam, lParam)); |
w32_get_key_modifiers (wParam, lParam)); |
4418 |
windows_translate = 1; |
windows_translate = 1; |
4419 |
break; |
break; |
4420 |
case VK_CONTROL: |
case VK_CONTROL: |
4421 |
case VK_SHIFT: |
case VK_SHIFT: |
4422 |
case VK_PROCESSKEY: /* Generated by IME. */ |
case VK_PROCESSKEY: /* Generated by IME. */ |
4423 |
windows_translate = 1; |
windows_translate = 1; |
4475 |
int add; |
int add; |
4476 |
int isdead = 0; |
int isdead = 0; |
4477 |
KEY_EVENT_RECORD key; |
KEY_EVENT_RECORD key; |
4478 |
|
|
4479 |
key.bKeyDown = TRUE; |
key.bKeyDown = TRUE; |
4480 |
key.wRepeatCount = 1; |
key.wRepeatCount = 1; |
4481 |
key.wVirtualKeyCode = wParam; |
key.wVirtualKeyCode = wParam; |
4516 |
} |
} |
4517 |
|
|
4518 |
/* Fall through */ |
/* Fall through */ |
4519 |
|
|
4520 |
case WM_SYSCHAR: |
case WM_SYSCHAR: |
4521 |
case WM_CHAR: |
case WM_CHAR: |
4522 |
post_character_message (hwnd, msg, wParam, lParam, |
post_character_message (hwnd, msg, wParam, lParam, |
4652 |
{ |
{ |
4653 |
if (up) ReleaseCapture (); |
if (up) ReleaseCapture (); |
4654 |
else SetCapture (hwnd); |
else SetCapture (hwnd); |
4655 |
button = (button == 0) ? LMOUSE : |
button = (button == 0) ? LMOUSE : |
4656 |
((button == 1) ? MMOUSE : RMOUSE); |
((button == 1) ? MMOUSE : RMOUSE); |
4657 |
if (up) |
if (up) |
4658 |
button_state &= ~button; |
button_state &= ~button; |
4660 |
button_state |= button; |
button_state |= button; |
4661 |
} |
} |
4662 |
} |
} |
4663 |
|
|
4664 |
wmsg.dwModifiers = w32_get_modifiers (); |
wmsg.dwModifiers = w32_get_modifiers (); |
4665 |
my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
4666 |
|
|
4693 |
my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
4694 |
return 0; |
return 0; |
4695 |
} |
} |
4696 |
|
|
4697 |
/* Hang onto mouse move and scroll messages for a bit, to avoid |
/* Hang onto mouse move and scroll messages for a bit, to avoid |
4698 |
sending such events to Emacs faster than it can process them. |
sending such events to Emacs faster than it can process them. |
4699 |
If we get more events before the timer from the first message |
If we get more events before the timer from the first message |
4711 |
saved_mouse_move_msg.msg.lParam = lParam; |
saved_mouse_move_msg.msg.lParam = lParam; |
4712 |
saved_mouse_move_msg.msg.time = GetMessageTime (); |
saved_mouse_move_msg.msg.time = GetMessageTime (); |
4713 |
saved_mouse_move_msg.dwModifiers = w32_get_modifiers (); |
saved_mouse_move_msg.dwModifiers = w32_get_modifiers (); |
4714 |
|
|
4715 |
return 0; |
return 0; |
4716 |
|
|
4717 |
case WM_MOUSEWHEEL: |
case WM_MOUSEWHEEL: |
4759 |
} |
} |
4760 |
} |
} |
4761 |
return 0; |
return 0; |
4762 |
|
|
4763 |
case WM_NCACTIVATE: |
case WM_NCACTIVATE: |
4764 |
/* Windows doesn't send us focus messages when putting up and |
/* Windows doesn't send us focus messages when putting up and |
4765 |
taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95. |
taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95. |
4963 |
if (menu_free_timer) |
if (menu_free_timer) |
4964 |
{ |
{ |
4965 |
KillTimer (hwnd, menu_free_timer); |
KillTimer (hwnd, menu_free_timer); |
4966 |
menu_free_timer = 0; |
menu_free_timer = 0; |
4967 |
} |
} |
4968 |
} |
} |
4969 |
case WM_MOVE: |
case WM_MOVE: |
4988 |
|
|
4989 |
wp.length = sizeof (WINDOWPLACEMENT); |
wp.length = sizeof (WINDOWPLACEMENT); |
4990 |
GetWindowPlacement (hwnd, &wp); |
GetWindowPlacement (hwnd, &wp); |
4991 |
|
|
4992 |
if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0) |
if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0) |
4993 |
{ |
{ |
4994 |
RECT rect; |
RECT rect; |
4999 |
DWORD internal_border; |
DWORD internal_border; |
5000 |
DWORD scrollbar_extra; |
DWORD scrollbar_extra; |
5001 |
RECT wr; |
RECT wr; |
5002 |
|
|
5003 |
wp.length = sizeof(wp); |
wp.length = sizeof(wp); |
5004 |
GetWindowRect (hwnd, &wr); |
GetWindowRect (hwnd, &wr); |
5005 |
|
|
5006 |
enter_crit (); |
enter_crit (); |
5007 |
|
|
5008 |
font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX); |
font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX); |
5009 |
line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX); |
line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX); |
5010 |
internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX); |
internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX); |
5011 |
scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX); |
scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX); |
5012 |
|
|
5013 |
leave_crit (); |
leave_crit (); |
5014 |
|
|
5015 |
memset (&rect, 0, sizeof (rect)); |
memset (&rect, 0, sizeof (rect)); |
5016 |
AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE), |
AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE), |
5017 |
GetMenu (hwnd) != NULL); |
GetMenu (hwnd) != NULL); |
5018 |
|
|
5019 |
/* Force width and height of client area to be exact |
/* Force width and height of client area to be exact |
5024 |
hdiff = (lppos->cy - (rect.bottom - rect.top) |
hdiff = (lppos->cy - (rect.bottom - rect.top) |
5025 |
- 2 * internal_border) |
- 2 * internal_border) |
5026 |
% line_height; |
% line_height; |
5027 |
|
|
5028 |
if (wdiff || hdiff) |
if (wdiff || hdiff) |
5029 |
{ |
{ |
5030 |
/* For right/bottom sizing we can just fix the sizes. |
/* For right/bottom sizing we can just fix the sizes. |
5031 |
However for top/left sizing we will need to fix the X |
However for top/left sizing we will need to fix the X |
5032 |
and Y positions as well. */ |
and Y positions as well. */ |
5033 |
|
|
5034 |
lppos->cx -= wdiff; |
lppos->cx -= wdiff; |
5035 |
lppos->cy -= hdiff; |
lppos->cy -= hdiff; |
5036 |
|
|
5037 |
if (wp.showCmd != SW_SHOWMAXIMIZED |
if (wp.showCmd != SW_SHOWMAXIMIZED |
5038 |
&& (lppos->flags & SWP_NOMOVE) == 0) |
&& (lppos->flags & SWP_NOMOVE) == 0) |
5039 |
{ |
{ |
5040 |
if (lppos->x != wr.left || lppos->y != wr.top) |
if (lppos->x != wr.left || lppos->y != wr.top) |
5047 |
lppos->flags |= SWP_NOMOVE; |
lppos->flags |= SWP_NOMOVE; |
5048 |
} |
} |
5049 |
} |
} |
5050 |
|
|
5051 |
return 0; |
return 0; |
5052 |
} |
} |
5053 |
} |
} |
5054 |
} |
} |
5055 |
|
|
5056 |
goto dflt; |
goto dflt; |
5057 |
|
|
5058 |
case WM_GETMINMAXINFO: |
case WM_GETMINMAXINFO: |
5130 |
CreateCaret (hwnd, NULL, 0, |
CreateCaret (hwnd, NULL, 0, |
5131 |
w32_system_caret_height); |
w32_system_caret_height); |
5132 |
} |
} |
5133 |
|
|
5134 |
if (!SetCaretPos (w32_system_caret_x, w32_system_caret_y)) |
if (!SetCaretPos (w32_system_caret_x, w32_system_caret_y)) |
5135 |
return 0; |
return 0; |
5136 |
/* Ensure visible caret gets turned on when requested. */ |
/* Ensure visible caret gets turned on when requested. */ |
5161 |
flags |= TPM_LEFTBUTTON; |
flags |= TPM_LEFTBUTTON; |
5162 |
else if (button_state & RMOUSE) |
else if (button_state & RMOUSE) |
5163 |
flags |= TPM_RIGHTBUTTON; |
flags |= TPM_RIGHTBUTTON; |
5164 |
|
|
5165 |
/* Remember we did a SetCapture on the initial mouse down event, |
/* Remember we did a SetCapture on the initial mouse down event, |
5166 |
so for safety, we make sure the capture is cancelled now. */ |
so for safety, we make sure the capture is cancelled now. */ |
5167 |
ReleaseCapture (); |
ReleaseCapture (); |
5172 |
f = x_window_to_frame (dpyinfo, hwnd); |
f = x_window_to_frame (dpyinfo, hwnd); |
5173 |
if (f) |
if (f) |
5174 |
f->output_data.w32->menubar_active = 1; |
f->output_data.w32->menubar_active = 1; |
5175 |
|
|
5176 |
if (TrackPopupMenu ((HMENU)wParam, flags, pos->x, pos->y, |
if (TrackPopupMenu ((HMENU)wParam, flags, pos->x, pos->y, |
5177 |
0, hwnd, NULL)) |
0, hwnd, NULL)) |
5178 |
{ |
{ |
5179 |
MSG amsg; |
MSG amsg; |
5206 |
my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
5207 |
return 0; |
return 0; |
5208 |
} |
} |
5209 |
|
|
5210 |
dflt: |
dflt: |
5211 |
return DefWindowProc (hwnd, msg, wParam, lParam); |
return DefWindowProc (hwnd, msg, wParam, lParam); |
5212 |
} |
} |
5213 |
|
|
5214 |
|
|
5215 |
/* The most common default return code for handled messages is 0. */ |
/* The most common default return code for handled messages is 0. */ |
5216 |
return 0; |
return 0; |
5217 |
} |
} |
5218 |
|
|
5219 |
void |
void |
5220 |
my_create_window (f) |
my_create_window (f) |
5221 |
struct frame * f; |
struct frame * f; |
5222 |
{ |
{ |
5232 |
indirectly via the Window thread, as we do not need to process Window |
indirectly via the Window thread, as we do not need to process Window |
5233 |
messages for the tooltip. Creating tooltips indirectly also creates |
messages for the tooltip. Creating tooltips indirectly also creates |
5234 |
deadlocks when tooltips are created for menu items. */ |
deadlocks when tooltips are created for menu items. */ |
5235 |
void |
void |
5236 |
my_create_tip_window (f) |
my_create_tip_window (f) |
5237 |
struct frame *f; |
struct frame *f; |
5238 |
{ |
{ |
5289 |
for the window manager, so GC relocation won't bother it. |
for the window manager, so GC relocation won't bother it. |
5290 |
|
|
5291 |
Elsewhere we specify the window name for the window manager. */ |
Elsewhere we specify the window name for the window manager. */ |
5292 |
|
|
5293 |
{ |
{ |
5294 |
char *str = (char *) SDATA (Vx_resource_name); |
char *str = (char *) SDATA (Vx_resource_name); |
5295 |
f->namebuf = (char *) xmalloc (strlen (str) + 1); |
f->namebuf = (char *) xmalloc (strlen (str) + 1); |
5413 |
#ifdef GLYPH_DEBUG |
#ifdef GLYPH_DEBUG |
5414 |
struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
5415 |
#endif |
#endif |
5416 |
|
|
5417 |
x_free_frame_resources (f); |
x_free_frame_resources (f); |
5418 |
|
|
5419 |
/* Check that reference counts are indeed correct. */ |
/* Check that reference counts are indeed correct. */ |
5422 |
|
|
5423 |
return Qt; |
return Qt; |
5424 |
} |
} |
5425 |
|
|
5426 |
return Qnil; |
return Qnil; |
5427 |
} |
} |
5428 |
|
|
5586 |
if (! STRINGP (font)) |
if (! STRINGP (font)) |
5587 |
font = build_string ("Fixedsys"); |
font = build_string ("Fixedsys"); |
5588 |
|
|
5589 |
x_default_parameter (f, parms, Qfont, font, |
x_default_parameter (f, parms, Qfont, font, |
5590 |
"font", "Font", RES_TYPE_STRING); |
"font", "Font", RES_TYPE_STRING); |
5591 |
} |
} |
5592 |
|
|
5639 |
end up in init_iterator with a null face cache, which should not |
end up in init_iterator with a null face cache, which should not |
5640 |
happen. */ |
happen. */ |
5641 |
init_frame_faces (f); |
init_frame_faces (f); |
5642 |
|
|
5643 |
x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), |
x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), |
5644 |
"menuBar", "MenuBar", RES_TYPE_NUMBER); |
"menuBar", "MenuBar", RES_TYPE_NUMBER); |
5645 |
x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), |
x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), |
5664 |
if (FRAME_TOOL_BAR_LINES (f)) |
if (FRAME_TOOL_BAR_LINES (f)) |
5665 |
{ |
{ |
5666 |
int margin, relief, bar_height; |
int margin, relief, bar_height; |
5667 |
|
|
5668 |
relief = (tool_bar_button_relief >= 0 |
relief = (tool_bar_button_relief >= 0 |
5669 |
? tool_bar_button_relief |
? tool_bar_button_relief |
5670 |
: DEFAULT_TOOL_BAR_BUTTON_RELIEF); |
: DEFAULT_TOOL_BAR_BUTTON_RELIEF); |
5678 |
margin = XFASTINT (XCDR (Vtool_bar_button_margin)); |
margin = XFASTINT (XCDR (Vtool_bar_button_margin)); |
5679 |
else |
else |
5680 |
margin = 0; |
margin = 0; |
5681 |
|
|
5682 |
bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; |
bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; |
5683 |
f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); |
f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); |
5684 |
} |
} |
5776 |
; |
; |
5777 |
} |
} |
5778 |
UNGCPRO; |
UNGCPRO; |
5779 |
|
|
5780 |
/* Make sure windows on this frame appear in calls to next-window |
/* Make sure windows on this frame appear in calls to next-window |
5781 |
and similar functions. */ |
and similar functions. */ |
5782 |
Vwindow_list = Qnil; |
Vwindow_list = Qnil; |
5783 |
|
|
5784 |
return unbind_to (count, frame); |
return unbind_to (count, frame); |
5785 |
} |
} |
5786 |
|
|
5917 |
|
|
5918 |
font->hfont = CreateFontIndirect (&lf); |
font->hfont = CreateFontIndirect (&lf); |
5919 |
|
|
5920 |
if (font->hfont == NULL) |
if (font->hfont == NULL) |
5921 |
{ |
{ |
5922 |
ok = FALSE; |
ok = FALSE; |
5923 |
} |
} |
5924 |
else |
else |
5925 |
{ |
{ |
5926 |
HDC hdc; |
HDC hdc; |
5927 |
HANDLE oldobj; |
HANDLE oldobj; |
6090 |
} |
} |
6091 |
|
|
6092 |
|
|
6093 |
void |
void |
6094 |
w32_unload_font (dpyinfo, font) |
w32_unload_font (dpyinfo, font) |
6095 |
struct w32_display_info *dpyinfo; |
struct w32_display_info *dpyinfo; |
6096 |
XFontStruct * font; |
XFontStruct * font; |
6097 |
{ |
{ |
6098 |
if (font) |
if (font) |
6099 |
{ |
{ |
6100 |
if (font->per_char) xfree (font->per_char); |
if (font->per_char) xfree (font->per_char); |
6101 |
if (font->bdf) w32_free_bdf_font (font->bdf); |
if (font->bdf) w32_free_bdf_font (font->bdf); |
6128 |
* ) |
* ) |
6129 |
*/ |
*/ |
6130 |
|
|
6131 |
static LONG |
static LONG |
6132 |
x_to_w32_weight (lpw) |
x_to_w32_weight (lpw) |
6133 |
char * lpw; |
char * lpw; |
6134 |
{ |
{ |
6149 |
} |
} |
6150 |
|
|
6151 |
|
|
6152 |
static char * |
static char * |
6153 |
w32_to_x_weight (fnweight) |
w32_to_x_weight (fnweight) |
6154 |
int fnweight; |
int fnweight; |
6155 |
{ |
{ |
6336 |
sprintf (buf, "*-#%u", fncharset); |
sprintf (buf, "*-#%u", fncharset); |
6337 |
return buf; |
return buf; |
6338 |
} |
} |
6339 |
|
|
6340 |
{ |
{ |
6341 |
Lisp_Object rest; |
Lisp_Object rest; |
6342 |
char * best_match = NULL; |
char * best_match = NULL; |
6390 |
int this_enc = atoi (x_charset + 8); |
int this_enc = atoi (x_charset + 8); |
6391 |
if (this_enc > 0 && this_enc < best_enc) |
if (this_enc > 0 && this_enc < best_enc) |
6392 |
best_match = x_charset; |
best_match = x_charset; |
6393 |
} |
} |
6394 |
} |
} |
6395 |
} |
} |
6396 |
|
|
6497 |
sprintf (buf, "*-#%u", fncharset); |
sprintf (buf, "*-#%u", fncharset); |
6498 |
return Fcons (build_string (buf), Qnil); |
return Fcons (build_string (buf), Qnil); |
6499 |
} |
} |
6500 |
|
|
6501 |
{ |
{ |
6502 |
Lisp_Object rest; |
Lisp_Object rest; |
6503 |
/* Look through w32-charset-info-alist for the character set. |
/* Look through w32-charset-info-alist for the character set. |
6548 |
/* Get the Windows codepage corresponding to the specified font. The |
/* Get the Windows codepage corresponding to the specified font. The |
6549 |
charset info in the font name is used to look up |
charset info in the font name is used to look up |
6550 |
w32-charset-to-codepage-alist. */ |
w32-charset-to-codepage-alist. */ |
6551 |
int |
int |
6552 |
w32_codepage_for_font (char *fontname) |
w32_codepage_for_font (char *fontname) |
6553 |
{ |
{ |
6554 |
Lisp_Object codepage, entry; |
Lisp_Object codepage, entry; |
6599 |
} |
} |
6600 |
|
|
6601 |
|
|
6602 |
static BOOL |
static BOOL |
6603 |
w32_to_x_font (lplogfont, lpxstr, len, specific_charset) |
w32_to_x_font (lplogfont, lpxstr, len, specific_charset) |
6604 |
LOGFONT * lplogfont; |
LOGFONT * lplogfont; |
6605 |
char * lpxstr; |
char * lpxstr; |
6682 |
? 'p' : 'c', /* spacing */ |
? 'p' : 'c', /* spacing */ |
6683 |
width_pixels, /* avg width */ |
width_pixels, /* avg width */ |
6684 |
specific_charset ? specific_charset |
specific_charset ? specific_charset |
6685 |
: w32_to_x_charset (lplogfont->lfCharSet) |
: w32_to_x_charset (lplogfont->lfCharSet) |
6686 |
/* charset registry and encoding */ |
/* charset registry and encoding */ |
6687 |
); |
); |
6688 |
|
|
6690 |
return (TRUE); |
return (TRUE); |
6691 |
} |
} |
6692 |
|
|
6693 |
static BOOL |
static BOOL |
6694 |
x_to_w32_font (lpxstr, lplogfont) |
x_to_w32_font (lpxstr, lplogfont) |
6695 |
char * lpxstr; |
char * lpxstr; |
6696 |
LOGFONT * lplogfont; |
LOGFONT * lplogfont; |
6725 |
* format: |
* format: |
6726 |
* "<font name>[:height in pixels[:width in pixels[:weight]]]" |
* "<font name>[:height in pixels[:width in pixels[:weight]]]" |
6727 |
*/ |
*/ |
6728 |
|
|
6729 |
if (*lpxstr == '-') |
if (*lpxstr == '-') |
6730 |
{ |
{ |
6731 |
int fields, tem; |
int fields, tem; |
6993 |
} |
} |
6994 |
|
|
6995 |
/* Assume parameter 1 is fully qualified, no wildcards. */ |
/* Assume parameter 1 is fully qualified, no wildcards. */ |
6996 |
static BOOL |
static BOOL |
6997 |
w32_font_match (fontname, pattern) |
w32_font_match (fontname, pattern) |
6998 |
char * fontname; |
char * fontname; |
6999 |
char * pattern; |
char * pattern; |
7055 |
font from each family, the second pass lists all the fonts from |
font from each family, the second pass lists all the fonts from |
7056 |
each family. */ |
each family. */ |
7057 |
|
|
7058 |
typedef struct enumfont_t |
typedef struct enumfont_t |
7059 |
{ |
{ |
7060 |
HDC hdc; |
HDC hdc; |
7061 |
int numFonts; |
int numFonts; |
7070 |
enum_font_maybe_add_to_list (enumfont_t *, LOGFONT *, char *, Lisp_Object); |
enum_font_maybe_add_to_list (enumfont_t *, LOGFONT *, char *, Lisp_Object); |
7071 |
|
|
7072 |
|
|
7073 |
static int CALLBACK |
static int CALLBACK |
7074 |
enum_font_cb2 (lplf, lptm, FontType, lpef) |
enum_font_cb2 (lplf, lptm, FontType, lpef) |
7075 |
ENUMLOGFONT * lplf; |
ENUMLOGFONT * lplf; |
7076 |
NEWTEXTMETRIC * lptm; |
NEWTEXTMETRIC * lptm; |
7226 |
} |
} |
7227 |
|
|
7228 |
|
|
7229 |
static int CALLBACK |
static int CALLBACK |
7230 |
enum_font_cb1 (lplf, lptm, FontType, lpef) |
enum_font_cb1 (lplf, lptm, FontType, lpef) |
7231 |
ENUMLOGFONT * lplf; |
ENUMLOGFONT * lplf; |
7232 |
NEWTEXTMETRIC * lptm; |
NEWTEXTMETRIC * lptm; |
7413 |
|
|
7414 |
newlist = second_best = Qnil; |
newlist = second_best = Qnil; |
7415 |
|
|
7416 |
/* Make a list of the fonts that have the right width. */ |
/* Make a list of the fonts that have the right width. */ |
7417 |
for (; CONSP (list); list = XCDR (list)) |
for (; CONSP (list); list = XCDR (list)) |
7418 |
{ |
{ |
7419 |
int found_size; |
int found_size; |
7475 |
{ |
{ |
7476 |
if (NILP (second_best)) |
if (NILP (second_best)) |
7477 |
second_best = tem; |
second_best = tem; |
7478 |
|
|
7479 |
else if (found_size < size) |
else if (found_size < size) |
7480 |
{ |
{ |
7481 |
if (XINT (XCDR (second_best)) > size |
if (XINT (XCDR (second_best)) > size |
7761 |
and because probably is more meaningful on Windows anyway */ |
and because probably is more meaningful on Windows anyway */ |
7762 |
if (cap < 0) |
if (cap < 0) |
7763 |
cap = 1 << min(dpyinfo->n_planes * dpyinfo->n_cbits, 24); |
cap = 1 << min(dpyinfo->n_planes * dpyinfo->n_cbits, 24); |
7764 |
|
|
7765 |
ReleaseDC (dpyinfo->root_window, hdc); |
ReleaseDC (dpyinfo->root_window, hdc); |
7766 |
|
|
7767 |
return make_number (cap); |
return make_number (cap); |
7768 |
} |
} |
7769 |
|
|
7835 |
int cap; |
int cap; |
7836 |
|
|
7837 |
hdc = GetDC (dpyinfo->root_window); |
hdc = GetDC (dpyinfo->root_window); |
7838 |
|
|
7839 |
cap = GetDeviceCaps (hdc, VERTSIZE); |
cap = GetDeviceCaps (hdc, VERTSIZE); |
7840 |
|
|
7841 |
ReleaseDC (dpyinfo->root_window, hdc); |
ReleaseDC (dpyinfo->root_window, hdc); |
7842 |
|
|
7843 |
return make_number (cap); |
return make_number (cap); |
7844 |
} |
} |
7845 |
|
|
7857 |
int cap; |
int cap; |
7858 |
|
|
7859 |
hdc = GetDC (dpyinfo->root_window); |
hdc = GetDC (dpyinfo->root_window); |
7860 |
|
|
7861 |
cap = GetDeviceCaps (hdc, HORZSIZE); |
cap = GetDeviceCaps (hdc, HORZSIZE); |
7862 |
|
|
7863 |
ReleaseDC (dpyinfo->root_window, hdc); |
ReleaseDC (dpyinfo->root_window, hdc); |
7864 |
|
|
7865 |
return make_number (cap); |
return make_number (cap); |
7866 |
} |
} |
7867 |
|
|
8226 |
Lisp_Object object; |
Lisp_Object object; |
8227 |
{ |
{ |
8228 |
int valid_p = 0; |
int valid_p = 0; |
8229 |
|
|
8230 |
if (CONSP (object) && EQ (XCAR (object), Qimage)) |
if (CONSP (object) && EQ (XCAR (object), Qimage)) |
8231 |
{ |
{ |
8232 |
Lisp_Object tem; |
Lisp_Object tem; |
8361 |
was found more than once, it's an error. */ |
was found more than once, it's an error. */ |
8362 |
keywords[i].value = value; |
keywords[i].value = value; |
8363 |
++keywords[i].count; |
++keywords[i].count; |
8364 |
|
|
8365 |
if (keywords[i].count > 1) |
if (keywords[i].count > 1) |
8366 |
return 0; |
return 0; |
8367 |
|
|
8416 |
|
|
8417 |
case IMAGE_FUNCTION_VALUE: |
case IMAGE_FUNCTION_VALUE: |
8418 |
value = indirect_function (value); |
value = indirect_function (value); |
8419 |
if (SUBRP (value) |
if (SUBRP (value) |
8420 |
|| COMPILEDP (value) |
|| COMPILEDP (value) |
8421 |
|| (CONSP (value) && EQ (XCAR (value), Qlambda))) |
|| (CONSP (value) && EQ (XCAR (value), Qlambda))) |
8422 |
break; |
break; |
8465 |
int *found; |
int *found; |
8466 |
{ |
{ |
8467 |
Lisp_Object tail; |
Lisp_Object tail; |
8468 |
|
|
8469 |
xassert (valid_image_p (spec)); |
xassert (valid_image_p (spec)); |
8470 |
|
|
8471 |
for (tail = XCDR (spec); |
for (tail = XCDR (spec); |
8479 |
return XCAR (XCDR (tail)); |
return XCAR (XCDR (tail)); |
8480 |
} |
} |
8481 |
} |
} |
8482 |
|
|
8483 |
if (found) |
if (found) |
8484 |
*found = 0; |
*found = 0; |
8485 |
return Qnil; |
return Qnil; |
8486 |
} |
} |
8487 |
|
|
8488 |
|
|
8489 |
DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0, |
DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0, |
8490 |
doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT). |
doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT). |
8505 |
struct image *img = IMAGE_FROM_ID (f, id); |
struct image *img = IMAGE_FROM_ID (f, id); |
8506 |
int width = img->width + 2 * img->hmargin; |
int width = img->width + 2 * img->hmargin; |
8507 |
int height = img->height + 2 * img->vmargin; |
int height = img->height + 2 * img->vmargin; |
8508 |
|
|
8509 |
if (NILP (pixels)) |
if (NILP (pixels)) |
8510 |
size = Fcons (make_float ((double) width / CANON_X_UNIT (f)), |
size = Fcons (make_float ((double) width / CANON_X_UNIT (f)), |
8511 |
make_float ((double) height / CANON_Y_UNIT (f))); |
make_float ((double) height / CANON_Y_UNIT (f))); |
8561 |
unsigned hash; |
unsigned hash; |
8562 |
{ |
{ |
8563 |
struct image *img = (struct image *) xmalloc (sizeof *img); |
struct image *img = (struct image *) xmalloc (sizeof *img); |
8564 |
|
|
8565 |
xassert (valid_image_p (spec)); |
xassert (valid_image_p (spec)); |
8566 |
bzero (img, sizeof *img); |
bzero (img, sizeof *img); |
8567 |
img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); |
img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); |
8622 |
if (img->pixmap == 0 && !img->load_failed_p) |
if (img->pixmap == 0 && !img->load_failed_p) |
8623 |
img->load_failed_p = img->type->load (f, img) == 0; |
img->load_failed_p = img->type->load (f, img) == 0; |
8624 |
} |
} |
8625 |
|
|
8626 |
|
|
8627 |
/* Value is the number of pixels for the ascent of image IMG when |
/* Value is the number of pixels for the ascent of image IMG when |
8628 |
drawn in face FACE. */ |
drawn in face FACE. */ |
8673 |
for (i = best_count = 0; i < 4; ++i) |
for (i = best_count = 0; i < 4; ++i) |
8674 |
{ |
{ |
8675 |
int j, n; |
int j, n; |
8676 |
|
|
8677 |
for (j = n = 0; j < 4; ++j) |
for (j = n = 0; j < 4; ++j) |
8678 |
if (corners[i] == corners[j]) |
if (corners[i] == corners[j]) |
8679 |
++n; |
++n; |
8793 |
img->mask = NULL; |
img->mask = NULL; |
8794 |
img->background_transparent_valid = 0; |
img->background_transparent_valid = 0; |
8795 |
} |
} |
8796 |
|
|
8797 |
if (colors_p && img->ncolors) |
if (colors_p && img->ncolors) |
8798 |
{ |
{ |
8799 |
#if 0 /* TODO: color table support. */ |
#if 0 /* TODO: color table support. */ |
8825 |
#if 0 /* TODO: color table support */ |
#if 0 /* TODO: color table support */ |
8826 |
|
|
8827 |
int class = FRAME_W32_DISPLAY_INFO (f)->visual->class; |
int class = FRAME_W32_DISPLAY_INFO (f)->visual->class; |
8828 |
|
|
8829 |
/* If display has an immutable color map, freeing colors is not |
/* If display has an immutable color map, freeing colors is not |
8830 |
necessary and some servers don't allow it. So don't do it. */ |
necessary and some servers don't allow it. So don't do it. */ |
8831 |
if (class != StaticColor |
if (class != StaticColor |
8840 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
8841 |
} |
} |
8842 |
#endif |
#endif |
8843 |
|
|
8844 |
xfree (img->colors); |
xfree (img->colors); |
8845 |
img->colors = NULL; |
img->colors = NULL; |
8846 |
img->ncolors = 0; |
img->ncolors = 0; |
8899 |
{ |
{ |
8900 |
struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); |
struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); |
8901 |
int size; |
int size; |
8902 |
|
|
8903 |
bzero (c, sizeof *c); |
bzero (c, sizeof *c); |
8904 |
c->size = 50; |
c->size = 50; |
8905 |
c->images = (struct image **) xmalloc (c->size * sizeof *c->images); |
c->images = (struct image **) xmalloc (c->size * sizeof *c->images); |
8924 |
|
|
8925 |
/* Cache should not be referenced by any frame when freed. */ |
/* Cache should not be referenced by any frame when freed. */ |
8926 |
xassert (c->refcount == 0); |
xassert (c->refcount == 0); |
8927 |
|
|
8928 |
for (i = 0; i < c->used; ++i) |
for (i = 0; i < c->used; ++i) |
8929 |
free_image (f, c->images[i]); |
free_image (f, c->images[i]); |
8930 |
xfree (c->images); |
xfree (c->images); |
8957 |
|
|
8958 |
EMACS_GET_TIME (t); |
EMACS_GET_TIME (t); |
8959 |
old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay); |
old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay); |
8960 |
|
|
8961 |
/* Block input so that we won't be interrupted by a SIGIO |
/* Block input so that we won't be interrupted by a SIGIO |
8962 |
while being in an inconsistent state. */ |
while being in an inconsistent state. */ |
8963 |
BLOCK_INPUT; |
BLOCK_INPUT; |
8964 |
|
|
8965 |
for (i = nfreed = 0; i < c->used; ++i) |
for (i = nfreed = 0; i < c->used; ++i) |
8966 |
{ |
{ |
8967 |
struct image *img = c->images[i]; |
struct image *img = c->images[i]; |
8980 |
if (nfreed) |
if (nfreed) |
8981 |
{ |
{ |
8982 |
Lisp_Object tail, frame; |
Lisp_Object tail, frame; |
8983 |
|
|
8984 |
FOR_EACH_FRAME (tail, frame) |
FOR_EACH_FRAME (tail, frame) |
8985 |
{ |
{ |
8986 |
struct frame *f = XFRAME (frame); |
struct frame *f = XFRAME (frame); |
9008 |
if (EQ (frame, Qt)) |
if (EQ (frame, Qt)) |
9009 |
{ |
{ |
9010 |
Lisp_Object tail; |
Lisp_Object tail; |
9011 |
|
|
9012 |
FOR_EACH_FRAME (tail, frame) |
FOR_EACH_FRAME (tail, frame) |
9013 |
if (FRAME_W32_P (XFRAME (frame))) |
if (FRAME_W32_P (XFRAME (frame))) |
9014 |
clear_image_cache (XFRAME (frame), 1); |
clear_image_cache (XFRAME (frame), 1); |
9036 |
Lisp_Object mask; |
Lisp_Object mask; |
9037 |
|
|
9038 |
spec = img->spec; |
spec = img->spec; |
9039 |
|
|
9040 |
/* `:heuristic-mask t' |
/* `:heuristic-mask t' |
9041 |
`:mask heuristic' |
`:mask heuristic' |
9042 |
means build a mask heuristically. |
means build a mask heuristically. |
9046 |
image. |
image. |
9047 |
`:mask nil' |
`:mask nil' |
9048 |
means remove a mask, if any. */ |
means remove a mask, if any. */ |
9049 |
|
|
9050 |
mask = image_spec_value (spec, QCheuristic_mask, NULL); |
mask = image_spec_value (spec, QCheuristic_mask, NULL); |
9051 |
if (!NILP (mask)) |
if (!NILP (mask)) |
9052 |
x_build_heuristic_mask (f, img, mask); |
x_build_heuristic_mask (f, img, mask); |
9053 |
else |
else |
9054 |
{ |
{ |
9055 |
int found_p; |
int found_p; |
9056 |
|
|
9057 |
mask = image_spec_value (spec, QCmask, &found_p); |
mask = image_spec_value (spec, QCmask, &found_p); |
9058 |
|
|
9059 |
if (EQ (mask, Qheuristic)) |
if (EQ (mask, Qheuristic)) |
9060 |
x_build_heuristic_mask (f, img, Qt); |
x_build_heuristic_mask (f, img, Qt); |
9061 |
else if (CONSP (mask) |
else if (CONSP (mask) |
9072 |
img->mask = NULL; |
img->mask = NULL; |
9073 |
} |
} |
9074 |
} |
} |
9075 |
|
|
9076 |
|
|
9077 |
/* Should we apply an image transformation algorithm? */ |
/* Should we apply an image transformation algorithm? */ |
9078 |
conversion = image_spec_value (spec, QCconversion, NULL); |
conversion = image_spec_value (spec, QCconversion, NULL); |
9079 |
if (EQ (conversion, Qdisabled)) |
if (EQ (conversion, Qdisabled)) |
9116 |
specification. */ |
specification. */ |
9117 |
xassert (FRAME_WINDOW_P (f)); |
xassert (FRAME_WINDOW_P (f)); |
9118 |
xassert (valid_image_p (spec)); |
xassert (valid_image_p (spec)); |
9119 |
|
|
9120 |
GCPRO1 (spec); |
GCPRO1 (spec); |
9121 |
|
|
9122 |
/* Look up SPEC in the hash table of the image cache. */ |
/* Look up SPEC in the hash table of the image cache. */ |
9175 |
if (XINT (XCDR (margin)) > 0) |
if (XINT (XCDR (margin)) > 0) |
9176 |
img->vmargin = XFASTINT (XCDR (margin)); |
img->vmargin = XFASTINT (XCDR (margin)); |
9177 |
} |
} |
9178 |
|
|
9179 |
relief = image_spec_value (spec, QCrelief, NULL); |
relief = image_spec_value (spec, QCrelief, NULL); |
9180 |
if (INTEGERP (relief)) |
if (INTEGERP (relief)) |
9181 |
{ |
{ |
9209 |
/* We're using IMG, so set its timestamp to `now'. */ |
/* We're using IMG, so set its timestamp to `now'. */ |
9210 |
EMACS_GET_TIME (now); |
EMACS_GET_TIME (now); |
9211 |
img->timestamp = EMACS_SECS (now); |
img->timestamp = EMACS_SECS (now); |
9212 |
|
|
9213 |
UNGCPRO; |
UNGCPRO; |
9214 |
|
|
9215 |
/* Value is the image id. */ |
/* Value is the image id. */ |
9216 |
return img->id; |
return img->id; |
9217 |
} |
} |
9436 |
|
|
9437 |
/* Try to find FILE in data-directory, then x-bitmap-file-path. */ |
/* Try to find FILE in data-directory, then x-bitmap-file-path. */ |
9438 |
fd = openp (search_path, file, Qnil, &file_found, Qnil); |
fd = openp (search_path, file, Qnil, &file_found, Qnil); |
9439 |
|
|
9440 |
if (fd == -1) |
if (fd == -1) |
9441 |
file_found = Qnil; |
file_found = Qnil; |
9442 |
else |
else |
9478 |
buf = NULL; |
buf = NULL; |
9479 |
} |
} |
9480 |
} |
} |
9481 |
|
|
9482 |
return buf; |
return buf; |
9483 |
} |
} |
9484 |
|
|
9557 |
XBM_TK_NUMBER |
XBM_TK_NUMBER |
9558 |
}; |
}; |
9559 |
|
|
9560 |
|
|
9561 |
/* Return non-zero if OBJECT is a valid XBM-type image specification. |
/* Return non-zero if OBJECT is a valid XBM-type image specification. |
9562 |
A valid specification is a list starting with the symbol `image' |
A valid specification is a list starting with the symbol `image' |
9563 |
The rest of the list is a property list which must contain an |
The rest of the list is a property list which must contain an |
9592 |
Lisp_Object object; |
Lisp_Object object; |
9593 |
{ |
{ |
9594 |
struct image_keyword kw[XBM_LAST]; |
struct image_keyword kw[XBM_LAST]; |
9595 |
|
|
9596 |
bcopy (xbm_format, kw, sizeof kw); |
bcopy (xbm_format, kw, sizeof kw); |
9597 |
if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) |
if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) |
9598 |
return 0; |
return 0; |
9624 |
data = kw[XBM_DATA].value; |
data = kw[XBM_DATA].value; |
9625 |
width = XFASTINT (kw[XBM_WIDTH].value); |
width = XFASTINT (kw[XBM_WIDTH].value); |
9626 |
height = XFASTINT (kw[XBM_HEIGHT].value); |
height = XFASTINT (kw[XBM_HEIGHT].value); |
9627 |
|
|
9628 |
/* Check type of data, and width and height against contents of |
/* Check type of data, and width and height against contents of |
9629 |
data. */ |
data. */ |
9630 |
if (VECTORP (data)) |
if (VECTORP (data)) |
9631 |
{ |
{ |
9632 |
int i; |
int i; |
9633 |
|
|
9634 |
/* Number of elements of the vector must be >= height. */ |
/* Number of elements of the vector must be >= height. */ |
9635 |
if (XVECTOR (data)->size < height) |
if (XVECTOR (data)->size < height) |
9636 |
return 0; |
return 0; |
9700 |
else if (isdigit (c)) |
else if (isdigit (c)) |
9701 |
{ |
{ |
9702 |
int value = 0, digit; |
int value = 0, digit; |
9703 |
|
|
9704 |
if (c == '0' && *s < end) |
if (c == '0' && *s < end) |
9705 |
{ |
{ |
9706 |
c = *(*s)++; |
c = *(*s)++; |
9838 |
if (LA1 != (TOKEN)) \ |
if (LA1 != (TOKEN)) \ |
9839 |
goto failure; \ |
goto failure; \ |
9840 |
else \ |
else \ |
9841 |
match () |
match () |
9842 |
|
|
9843 |
#define expect_ident(IDENT) \ |
#define expect_ident(IDENT) \ |
9844 |
if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ |
if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ |
9881 |
{ |
{ |
9882 |
if (strcmp (buffer, "unsigned") == 0) |
if (strcmp (buffer, "unsigned") == 0) |
9883 |
{ |
{ |
9884 |
match (); |
match (); |
9885 |
expect_ident ("char"); |
expect_ident ("char"); |
9886 |
} |
} |
9887 |
else if (strcmp (buffer, "short") == 0) |
else if (strcmp (buffer, "short") == 0) |
9896 |
else |
else |
9897 |
goto failure; |
goto failure; |
9898 |
} |
} |
9899 |
else |
else |
9900 |
goto failure; |
goto failure; |
9901 |
|
|
9902 |
expect (XBM_TK_IDENT); |
expect (XBM_TK_IDENT); |
9919 |
*p++ = val; |
*p++ = val; |
9920 |
if (!padding_p || ((i + 2) % bytes_per_line)) |
if (!padding_p || ((i + 2) % bytes_per_line)) |
9921 |
*p++ = value >> 8; |
*p++ = value >> 8; |
9922 |
|
|
9923 |
if (LA1 == ',' || LA1 == '}') |
if (LA1 == ',' || LA1 == '}') |
9924 |
match (); |
match (); |
9925 |
else |
else |
9932 |
{ |
{ |
9933 |
int val = value; |
int val = value; |
9934 |
expect (XBM_TK_NUMBER); |
expect (XBM_TK_NUMBER); |
9935 |
|
|
9936 |
*p++ = val; |
*p++ = val; |
9937 |
|
|
9938 |
if (LA1 == ',' || LA1 == '}') |
if (LA1 == ',' || LA1 == '}') |
9973 |
int rc; |
int rc; |
9974 |
unsigned char *data; |
unsigned char *data; |
9975 |
int success_p = 0; |
int success_p = 0; |
9976 |
|
|
9977 |
rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data); |
rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data); |
9978 |
if (rc) |
if (rc) |
9979 |
{ |
{ |
9980 |
unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); |
unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); |
9981 |
unsigned long background = FRAME_BACKGROUND_PIXEL (f); |
unsigned long background = FRAME_BACKGROUND_PIXEL (f); |
9982 |
Lisp_Object value; |
Lisp_Object value; |
9983 |
|
|
9984 |
xassert (img->width > 0 && img->height > 0); |
xassert (img->width > 0 && img->height > 0); |
9985 |
|
|
9986 |
/* Get foreground and background colors, maybe allocate colors. */ |
/* Get foreground and background colors, maybe allocate colors. */ |
10028 |
&w, &h, NULL)); |
&w, &h, NULL)); |
10029 |
} |
} |
10030 |
|
|
10031 |
|
|
10032 |
/* Fill image IMG which is used on frame F with pixmap data. Value is |
/* Fill image IMG which is used on frame F with pixmap data. Value is |
10033 |
non-zero if successful. */ |
non-zero if successful. */ |
10034 |
|
|
10120 |
int i; |
int i; |
10121 |
char *p; |
char *p; |
10122 |
int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR; |
int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR; |
10123 |
|
|
10124 |
p = bits = (char *) alloca (nbytes * img->height); |
p = bits = (char *) alloca (nbytes * img->height); |
10125 |
for (i = 0; i < img->height; ++i, p += nbytes) |
for (i = 0; i < img->height; ++i, p += nbytes) |
10126 |
{ |
{ |
10155 |
|
|
10156 |
return success_p; |
return success_p; |
10157 |
} |
} |
10158 |
|
|
10159 |
|
|
10160 |
|
|
10161 |
/*********************************************************************** |
/*********************************************************************** |
10162 |
XPM images |
XPM images |
10163 |
***********************************************************************/ |
***********************************************************************/ |
10164 |
|
|
10165 |
#if HAVE_XPM |
#if HAVE_XPM |
10166 |
|
|
10167 |
static int xpm_image_p P_ ((Lisp_Object object)); |
static int xpm_image_p P_ ((Lisp_Object object)); |
10168 |
static int xpm_load P_ ((struct frame *f, struct image *img)); |
static int xpm_load P_ ((struct frame *f, struct image *img)); |
10300 |
Lisp_Object tail; |
Lisp_Object tail; |
10301 |
XpmColorSymbol *xpm_syms; |
XpmColorSymbol *xpm_syms; |
10302 |
int i, size; |
int i, size; |
10303 |
|
|
10304 |
attrs.valuemask |= XpmColorSymbols; |
attrs.valuemask |= XpmColorSymbols; |
10305 |
|
|
10306 |
/* Count number of symbols. */ |
/* Count number of symbols. */ |
10341 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
10342 |
return 0; |
return 0; |
10343 |
} |
} |
10344 |
|
|
10345 |
rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f), |
rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f), |
10346 |
SDATA (file), &img->pixmap, &img->mask, |
SDATA (file), &img->pixmap, &img->mask, |
10347 |
&attrs); |
&attrs); |
10381 |
case XpmOpenFailed: |
case XpmOpenFailed: |
10382 |
image_error ("Error opening XPM file (%s)", img->spec, Qnil); |
image_error ("Error opening XPM file (%s)", img->spec, Qnil); |
10383 |
break; |
break; |
10384 |
|
|
10385 |
case XpmFileInvalid: |
case XpmFileInvalid: |
10386 |
image_error ("Invalid XPM file (%s)", img->spec, Qnil); |
image_error ("Invalid XPM file (%s)", img->spec, Qnil); |
10387 |
break; |
break; |
10388 |
|
|
10389 |
case XpmNoMemory: |
case XpmNoMemory: |
10390 |
image_error ("Out of memory (%s)", img->spec, Qnil); |
image_error ("Out of memory (%s)", img->spec, Qnil); |
10391 |
break; |
break; |
10392 |
|
|
10393 |
case XpmColorFailed: |
case XpmColorFailed: |
10394 |
image_error ("Color allocation error (%s)", img->spec, Qnil); |
image_error ("Color allocation error (%s)", img->spec, Qnil); |
10395 |
break; |
break; |
10396 |
|
|
10397 |
default: |
default: |
10398 |
image_error ("Unknown error (%s)", img->spec, Qnil); |
image_error ("Unknown error (%s)", img->spec, Qnil); |
10399 |
break; |
break; |
10542 |
int rc; |
int rc; |
10543 |
|
|
10544 |
BLOCK_INPUT; |
BLOCK_INPUT; |
10545 |
|
|
10546 |
cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f)); |
cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f)); |
10547 |
color.pixel = pixel; |
color.pixel = pixel; |
10548 |
XQueryColor (NULL, cmap, &color); |
XQueryColor (NULL, cmap, &color); |
10552 |
if (rc) |
if (rc) |
10553 |
{ |
{ |
10554 |
++ct_colors_allocated; |
++ct_colors_allocated; |
10555 |
|
|
10556 |
p = (struct ct_color *) xmalloc (sizeof *p); |
p = (struct ct_color *) xmalloc (sizeof *p); |
10557 |
p->r = color.red; |
p->r = color.red; |
10558 |
p->g = color.green; |
p->g = color.green; |
10589 |
colors = (unsigned long *) xmalloc (ct_colors_allocated |
colors = (unsigned long *) xmalloc (ct_colors_allocated |
10590 |
* sizeof *colors); |
* sizeof *colors); |
10591 |
*n = ct_colors_allocated; |
*n = ct_colors_allocated; |
10592 |
|
|
10593 |
for (i = j = 0; i < CT_SIZE; ++i) |
for (i = j = 0; i < CT_SIZE; ++i) |
10594 |
for (p = ct_table[i]; p; p = p->next) |
for (p = ct_table[i]; p; p = p->next) |
10595 |
colors[j++] = p->pixel; |
colors[j++] = p->pixel; |
10665 |
for (y = 0; y < img->height; ++y) |
for (y = 0; y < img->height; ++y) |
10666 |
{ |
{ |
10667 |
XColor *row = p; |
XColor *row = p; |
10668 |
|
|
10669 |
for (x = 0; x < img->width; ++x, ++p) |
for (x = 0; x < img->width; ++x, ++p) |
10670 |
p->pixel = XGetPixel (ximg, x, y); |
p->pixel = XGetPixel (ximg, x, y); |
10671 |
|
|
10755 |
|
|
10756 |
MATRIX is a nine-element array specifying the transformation |
MATRIX is a nine-element array specifying the transformation |
10757 |
matrix. See emboss_matrix for an example. |
matrix. See emboss_matrix for an example. |
10758 |
|
|
10759 |
COLOR_ADJUST is a color adjustment added to each pixel of the |
COLOR_ADJUST is a color adjustment added to each pixel of the |
10760 |
outgoing image. */ |
outgoing image. */ |
10761 |
|
|
10783 |
p = COLOR (new, img->width - 1, y); |
p = COLOR (new, img->width - 1, y); |
10784 |
p->red = p->green = p->blue = 0xffff/2; |
p->red = p->green = p->blue = 0xffff/2; |
10785 |
} |
} |
10786 |
|
|
10787 |
for (x = 1; x < img->width - 1; ++x) |
for (x = 1; x < img->width - 1; ++x) |
10788 |
{ |
{ |
10789 |
p = COLOR (new, x, 0); |
p = COLOR (new, x, 0); |
10795 |
for (y = 1; y < img->height - 1; ++y) |
for (y = 1; y < img->height - 1; ++y) |
10796 |
{ |
{ |
10797 |
p = COLOR (new, 1, y); |
p = COLOR (new, 1, y); |
10798 |
|
|
10799 |
for (x = 1; x < img->width - 1; ++x, ++p) |
for (x = 1; x < img->width - 1; ++x, ++p) |
10800 |
{ |
{ |
10801 |
int r, g, b, y1, x1; |
int r, g, b, y1, x1; |
10869 |
{ |
{ |
10870 |
int i = 0; |
int i = 0; |
10871 |
int trans[9]; |
int trans[9]; |
10872 |
|
|
10873 |
if (CONSP (matrix)) |
if (CONSP (matrix)) |
10874 |
{ |
{ |
10875 |
for (i = 0; |
for (i = 0; |
10992 |
/* Determine the background color of ximg. If HOW is `(R G B)' |
/* Determine the background color of ximg. If HOW is `(R G B)' |
10993 |
take that as color. Otherwise, use the image's background color. */ |
take that as color. Otherwise, use the image's background color. */ |
10994 |
use_img_background = 1; |
use_img_background = 1; |
10995 |
|
|
10996 |
if (CONSP (how)) |
if (CONSP (how)) |
10997 |
{ |
{ |
10998 |
int rgb[3], i; |
int rgb[3], i; |
11011 |
use_img_background = 0; |
use_img_background = 0; |
11012 |
} |
} |
11013 |
} |
} |
11014 |
|
|
11015 |
if (use_img_background) |
if (use_img_background) |
11016 |
bg = four_corners_best (ximg, img->width, img->height); |
bg = four_corners_best (ximg, img->width, img->height); |
11017 |
|
|
11103 |
Lisp_Object object; |
Lisp_Object object; |
11104 |
{ |
{ |
11105 |
struct image_keyword fmt[PBM_LAST]; |
struct image_keyword fmt[PBM_LAST]; |
11106 |
|
|
11107 |
bcopy (pbm_format, fmt, sizeof fmt); |
bcopy (pbm_format, fmt, sizeof fmt); |
11108 |
|
|
11109 |
if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm) |
if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm) |
11110 |
|| (fmt[PBM_ASCENT].count |
|| (fmt[PBM_ASCENT].count |
11111 |
&& XFASTINT (fmt[PBM_ASCENT].value) > 100)) |
&& XFASTINT (fmt[PBM_ASCENT].value) > 100)) |
11112 |
return 0; |
return 0; |
11113 |
|
|
11185 |
buf = NULL; |
buf = NULL; |
11186 |
} |
} |
11187 |
} |
} |
11188 |
|
|
11189 |
return buf; |
return buf; |
11190 |
} |
} |
11191 |
|
|
11192 |
|
|
11193 |
/* Load PBM image IMG for use on frame F. */ |
/* Load PBM image IMG for use on frame F. */ |
11194 |
|
|
11195 |
static int |
static int |
11196 |
pbm_load (f, img) |
pbm_load (f, img) |
11197 |
struct frame *f; |
struct frame *f; |
11198 |
struct image *img; |
struct image *img; |
11255 |
case '1': |
case '1': |
11256 |
raw_p = 0, type = PBM_MONO; |
raw_p = 0, type = PBM_MONO; |
11257 |
break; |
break; |
11258 |
|
|
11259 |
case '2': |
case '2': |
11260 |
raw_p = 0, type = PBM_GRAY; |
raw_p = 0, type = PBM_GRAY; |
11261 |
break; |
break; |
11267 |
case '4': |
case '4': |
11268 |
raw_p = 1, type = PBM_MONO; |
raw_p = 1, type = PBM_MONO; |
11269 |
break; |
break; |
11270 |
|
|
11271 |
case '5': |
case '5': |
11272 |
raw_p = 1, type = PBM_GRAY; |
raw_p = 1, type = PBM_GRAY; |
11273 |
break; |
break; |
11274 |
|
|
11275 |
case '6': |
case '6': |
11276 |
raw_p = 1, type = PBM_COLOR; |
raw_p = 1, type = PBM_COLOR; |
11277 |
break; |
break; |
11292 |
if (raw_p && max_color_idx > 255) |
if (raw_p && max_color_idx > 255) |
11293 |
max_color_idx = 255; |
max_color_idx = 255; |
11294 |
} |
} |
11295 |
|
|
11296 |
if (width < 0 |
if (width < 0 |
11297 |
|| height < 0 |
|| height < 0 |
11298 |
|| (type != PBM_MONO && max_color_idx < 0)) |
|| (type != PBM_MONO && max_color_idx < 0)) |
11316 |
/* Parse the image specification. */ |
/* Parse the image specification. */ |
11317 |
bcopy (pbm_format, fmt, sizeof fmt); |
bcopy (pbm_format, fmt, sizeof fmt); |
11318 |
parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); |
parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); |
11319 |
|
|
11320 |
/* Get foreground and background colors, maybe allocate colors. */ |
/* Get foreground and background colors, maybe allocate colors. */ |
11321 |
if (fmt[PBM_FOREGROUND].count |
if (fmt[PBM_FOREGROUND].count |
11322 |
&& STRINGP (fmt[PBM_FOREGROUND].value)) |
&& STRINGP (fmt[PBM_FOREGROUND].value)) |
11351 |
for (x = 0; x < width; ++x) |
for (x = 0; x < width; ++x) |
11352 |
{ |
{ |
11353 |
int r, g, b; |
int r, g, b; |
11354 |
|
|
11355 |
if (type == PBM_GRAY) |
if (type == PBM_GRAY) |
11356 |
r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end); |
r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end); |
11357 |
else if (raw_p) |
else if (raw_p) |
11366 |
g = pbm_scan_number (&p, end); |
g = pbm_scan_number (&p, end); |
11367 |
b = pbm_scan_number (&p, end); |
b = pbm_scan_number (&p, end); |
11368 |
} |
} |
11369 |
|
|
11370 |
if (r < 0 || g < 0 || b < 0) |
if (r < 0 || g < 0 || b < 0) |
11371 |
{ |
{ |
11372 |
x_destroy_x_image (ximg); |
x_destroy_x_image (ximg); |
11374 |
img->spec, Qnil); |
img->spec, Qnil); |
11375 |
goto error; |
goto error; |
11376 |
} |
} |
11377 |
|
|
11378 |
/* RGB values are now in the range 0..max_color_idx. |
/* RGB values are now in the range 0..max_color_idx. |
11379 |
Scale this to the range 0..0xff supported by W32. */ |
Scale this to the range 0..0xff supported by W32. */ |
11380 |
r = (int) ((double) r * 255 / max_color_idx); |
r = (int) ((double) r * 255 / max_color_idx); |
11398 |
/* Maybe fill in the background field while we have ximg handy. */ |
/* Maybe fill in the background field while we have ximg handy. */ |
11399 |
if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
11400 |
IMAGE_BACKGROUND (img, f, ximg); |
IMAGE_BACKGROUND (img, f, ximg); |
11401 |
|
|
11402 |
/* Put the image into a pixmap. */ |
/* Put the image into a pixmap. */ |
11403 |
x_put_x_image (f, ximg, img->pixmap, width, height); |
x_put_x_image (f, ximg, img->pixmap, width, height); |
11404 |
x_destroy_x_image (ximg); |
x_destroy_x_image (ximg); |
11405 |
|
|
11406 |
img->width = width; |
img->width = width; |
11407 |
img->height = height; |
img->height = height; |
11408 |
|
|
11483 |
{ |
{ |
11484 |
struct image_keyword fmt[PNG_LAST]; |
struct image_keyword fmt[PNG_LAST]; |
11485 |
bcopy (png_format, fmt, sizeof fmt); |
bcopy (png_format, fmt, sizeof fmt); |
11486 |
|
|
11487 |
if (!parse_image_spec (object, fmt, PNG_LAST, Qpng) |
if (!parse_image_spec (object, fmt, PNG_LAST, Qpng) |
11488 |
|| (fmt[PNG_ASCENT].count |
|| (fmt[PNG_ASCENT].count |
11489 |
&& XFASTINT (fmt[PNG_ASCENT].value) > 100)) |
&& XFASTINT (fmt[PNG_ASCENT].value) > 100)) |
11490 |
return 0; |
return 0; |
11491 |
|
|
11542 |
|
|
11543 |
if (length > tbr->len - tbr->index) |
if (length > tbr->len - tbr->index) |
11544 |
png_error (png_ptr, "Read error"); |
png_error (png_ptr, "Read error"); |
11545 |
|
|
11546 |
bcopy (tbr->bytes + tbr->index, data, length); |
bcopy (tbr->bytes + tbr->index, data, length); |
11547 |
tbr->index = tbr->index + length; |
tbr->index = tbr->index + length; |
11548 |
} |
} |
11685 |
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, |
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, |
11686 |
&interlace_type, NULL, NULL); |
&interlace_type, NULL, NULL); |
11687 |
|
|
11688 |
/* If image contains simply transparency data, we prefer to |
/* If image contains simply transparency data, we prefer to |
11689 |
construct a clipping mask. */ |
construct a clipping mask. */ |
11690 |
if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) |
if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) |
11691 |
transparent_p = 1; |
transparent_p = 1; |
11692 |
else |
else |
11693 |
transparent_p = 0; |
transparent_p = 0; |
11694 |
|
|
11695 |
/* This function is easier to write if we only have to handle |
/* This function is easier to write if we only have to handle |
11696 |
one data format: RGB or RGBA with 8 bits per channel. Let's |
one data format: RGB or RGBA with 8 bits per channel. Let's |
11697 |
transform other formats into that format. */ |
transform other formats into that format. */ |
11698 |
|
|
11705 |
png_set_expand (png_ptr); |
png_set_expand (png_ptr); |
11706 |
|
|
11707 |
/* Convert grayscale images to RGB. */ |
/* Convert grayscale images to RGB. */ |
11708 |
if (color_type == PNG_COLOR_TYPE_GRAY |
if (color_type == PNG_COLOR_TYPE_GRAY |
11709 |
|| color_type == PNG_COLOR_TYPE_GRAY_ALPHA) |
|| color_type == PNG_COLOR_TYPE_GRAY_ALPHA) |
11710 |
png_set_gray_to_rgb (png_ptr); |
png_set_gray_to_rgb (png_ptr); |
11711 |
|
|
11756 |
} |
} |
11757 |
} |
} |
11758 |
else if (png_get_bKGD (png_ptr, info_ptr, &image_background)) |
else if (png_get_bKGD (png_ptr, info_ptr, &image_background)) |
11759 |
/* Image contains a background color with which to |
/* Image contains a background color with which to |
11760 |
combine the image. */ |
combine the image. */ |
11761 |
png_set_background (png_ptr, image_background, |
png_set_background (png_ptr, image_background, |
11762 |
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); |
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); |
11763 |
else |
else |
11764 |
{ |
{ |
11765 |
/* Image does not contain a background color with which |
/* Image does not contain a background color with which |
11766 |
to combine the image data via an alpha channel. Use |
to combine the image data via an alpha channel. Use |
11767 |
the frame's background instead. */ |
the frame's background instead. */ |
11768 |
XColor color; |
XColor color; |
11769 |
Colormap cmap; |
Colormap cmap; |
11816 |
if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, |
if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, |
11817 |
&img->pixmap)) |
&img->pixmap)) |
11818 |
goto error; |
goto error; |
11819 |
|
|
11820 |
/* Create an image and pixmap serving as mask if the PNG image |
/* Create an image and pixmap serving as mask if the PNG image |
11821 |
contains an alpha channel. */ |
contains an alpha channel. */ |
11822 |
if (channels == 4 |
if (channels == 4 |
11847 |
XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); |
XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); |
11848 |
|
|
11849 |
/* An alpha channel, aka mask channel, associates variable |
/* An alpha channel, aka mask channel, associates variable |
11850 |
transparency with an image. Where other image formats |
transparency with an image. Where other image formats |
11851 |
support binary transparency---fully transparent or fully |
support binary transparency---fully transparent or fully |
11852 |
opaque---PNG allows up to 254 levels of partial transparency. |
opaque---PNG allows up to 254 levels of partial transparency. |
11853 |
The PNG library implements partial transparency by combining |
The PNG library implements partial transparency by combining |
11854 |
the image with a specified background color. |
the image with a specified background color. |
11855 |
|
|
11856 |
I'm not sure how to handle this here nicely: because the |
I'm not sure how to handle this here nicely: because the |
11857 |
background on which the image is displayed may change, for |
background on which the image is displayed may change, for |
11858 |
real alpha channel support, it would be necessary to create |
real alpha channel support, it would be necessary to create |
11859 |
a new image for each possible background. |
a new image for each possible background. |
11860 |
|
|
11861 |
What I'm doing now is that a mask is created if we have |
What I'm doing now is that a mask is created if we have |
11862 |
boolean transparency information. Otherwise I'm using |
boolean transparency information. Otherwise I'm using |
12002 |
Lisp_Object object; |
Lisp_Object object; |
12003 |
{ |
{ |
12004 |
struct image_keyword fmt[JPEG_LAST]; |
struct image_keyword fmt[JPEG_LAST]; |
12005 |
|
|
12006 |
bcopy (jpeg_format, fmt, sizeof fmt); |
bcopy (jpeg_format, fmt, sizeof fmt); |
12007 |
|
|
12008 |
if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg) |
if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg) |
12009 |
|| (fmt[JPEG_ASCENT].count |
|| (fmt[JPEG_ASCENT].count |
12010 |
&& XFASTINT (fmt[JPEG_ASCENT].value) > 100)) |
&& XFASTINT (fmt[JPEG_ASCENT].value) > 100)) |
12011 |
return 0; |
return 0; |
12012 |
|
|
12075 |
{ |
{ |
12076 |
if (num_bytes > src->bytes_in_buffer) |
if (num_bytes > src->bytes_in_buffer) |
12077 |
ERREXIT (cinfo, JERR_INPUT_EOF); |
ERREXIT (cinfo, JERR_INPUT_EOF); |
12078 |
|
|
12079 |
src->bytes_in_buffer -= num_bytes; |
src->bytes_in_buffer -= num_bytes; |
12080 |
src->next_input_byte += num_bytes; |
src->next_input_byte += num_bytes; |
12081 |
} |
} |
12113 |
src = (struct jpeg_source_mgr *) cinfo->src; |
src = (struct jpeg_source_mgr *) cinfo->src; |
12114 |
src->next_input_byte = data; |
src->next_input_byte = data; |
12115 |
} |
} |
12116 |
|
|
12117 |
src = (struct jpeg_source_mgr *) cinfo->src; |
src = (struct jpeg_source_mgr *) cinfo->src; |
12118 |
src->init_source = our_init_source; |
src->init_source = our_init_source; |
12119 |
src->fill_input_buffer = our_fill_input_buffer; |
src->fill_input_buffer = our_fill_input_buffer; |
12128 |
/* Load image IMG for use on frame F. Patterned after example.c |
/* Load image IMG for use on frame F. Patterned after example.c |
12129 |
from the JPEG lib. */ |
from the JPEG lib. */ |
12130 |
|
|
12131 |
static int |
static int |
12132 |
jpeg_load (f, img) |
jpeg_load (f, img) |
12133 |
struct frame *f; |
struct frame *f; |
12134 |
struct image *img; |
struct image *img; |
12161 |
UNGCPRO; |
UNGCPRO; |
12162 |
return 0; |
return 0; |
12163 |
} |
} |
12164 |
|
|
12165 |
fp = fopen (SDATA (file), "r"); |
fp = fopen (SDATA (file), "r"); |
12166 |
if (fp == NULL) |
if (fp == NULL) |
12167 |
{ |
{ |
12170 |
return 0; |
return 0; |
12171 |
} |
} |
12172 |
} |
} |
12173 |
|
|
12174 |
/* Customize libjpeg's error handling to call my_error_exit when an |
/* Customize libjpeg's error handling to call my_error_exit when an |
12175 |
error is detected. This function will perform a longjmp. */ |
error is detected. This function will perform a longjmp. */ |
12176 |
cinfo.err = jpeg_std_error (&mgr.pub); |
cinfo.err = jpeg_std_error (&mgr.pub); |
12177 |
mgr.pub.error_exit = my_error_exit; |
mgr.pub.error_exit = my_error_exit; |
12178 |
|
|
12179 |
if ((rc = setjmp (mgr.setjmp_buffer)) != 0) |
if ((rc = setjmp (mgr.setjmp_buffer)) != 0) |
12180 |
{ |
{ |
12181 |
if (rc == 1) |
if (rc == 1) |
12186 |
image_error ("Error reading JPEG image `%s': %s", img->spec, |
image_error ("Error reading JPEG image `%s': %s", img->spec, |
12187 |
build_string (buffer)); |
build_string (buffer)); |
12188 |
} |
} |
12189 |
|
|
12190 |
/* Close the input file and destroy the JPEG object. */ |
/* Close the input file and destroy the JPEG object. */ |
12191 |
if (fp) |
if (fp) |
12192 |
fclose (fp); |
fclose (fp); |
12193 |
jpeg_destroy_decompress (&cinfo); |
jpeg_destroy_decompress (&cinfo); |
12194 |
|
|
12195 |
/* If we already have an XImage, free that. */ |
/* If we already have an XImage, free that. */ |
12196 |
x_destroy_x_image (ximg); |
x_destroy_x_image (ximg); |
12197 |
|
|
12198 |
/* Free pixmap and colors. */ |
/* Free pixmap and colors. */ |
12199 |
x_clear_image (f, img); |
x_clear_image (f, img); |
12200 |
|
|
12201 |
UNGCPRO; |
UNGCPRO; |
12202 |
return 0; |
return 0; |
12203 |
} |
} |
12248 |
init_color_table (); |
init_color_table (); |
12249 |
colors = (unsigned long *) alloca (cinfo.actual_number_of_colors |
colors = (unsigned long *) alloca (cinfo.actual_number_of_colors |
12250 |
* sizeof *colors); |
* sizeof *colors); |
12251 |
|
|
12252 |
for (i = 0; i < cinfo.actual_number_of_colors; ++i) |
for (i = 0; i < cinfo.actual_number_of_colors; ++i) |
12253 |
{ |
{ |
12254 |
/* Multiply RGB values with 255 because X expects RGB values |
/* Multiply RGB values with 255 because X expects RGB values |
12280 |
jpeg_destroy_decompress (&cinfo); |
jpeg_destroy_decompress (&cinfo); |
12281 |
if (fp) |
if (fp) |
12282 |
fclose (fp); |
fclose (fp); |
12283 |
|
|
12284 |
/* Maybe fill in the background field while we have ximg handy. */ |
/* Maybe fill in the background field while we have ximg handy. */ |
12285 |
if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
12286 |
IMAGE_BACKGROUND (img, f, ximg); |
IMAGE_BACKGROUND (img, f, ximg); |
12287 |
|
|
12288 |
/* Put the image into the pixmap. */ |
/* Put the image into the pixmap. */ |
12289 |
x_put_x_image (f, ximg, img->pixmap, width, height); |
x_put_x_image (f, ximg, img->pixmap, width, height); |
12290 |
x_destroy_x_image (ximg); |
x_destroy_x_image (ximg); |
12366 |
{ |
{ |
12367 |
struct image_keyword fmt[TIFF_LAST]; |
struct image_keyword fmt[TIFF_LAST]; |
12368 |
bcopy (tiff_format, fmt, sizeof fmt); |
bcopy (tiff_format, fmt, sizeof fmt); |
12369 |
|
|
12370 |
if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff) |
if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff) |
12371 |
|| (fmt[TIFF_ASCENT].count |
|| (fmt[TIFF_ASCENT].count |
12372 |
&& XFASTINT (fmt[TIFF_ASCENT].value) > 100)) |
&& XFASTINT (fmt[TIFF_ASCENT].value) > 100)) |
12373 |
return 0; |
return 0; |
12374 |
|
|
12375 |
/* Must specify either the :data or :file keyword. */ |
/* Must specify either the :data or :file keyword. */ |
12376 |
return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1; |
return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1; |
12377 |
} |
} |
12432 |
case SEEK_SET: /* Go from beginning of source. */ |
case SEEK_SET: /* Go from beginning of source. */ |
12433 |
idx = off; |
idx = off; |
12434 |
break; |
break; |
12435 |
|
|
12436 |
case SEEK_END: /* Go from end of source. */ |
case SEEK_END: /* Go from end of source. */ |
12437 |
idx = src->len + off; |
idx = src->len + off; |
12438 |
break; |
break; |
12439 |
|
|
12440 |
case SEEK_CUR: /* Go from current position. */ |
case SEEK_CUR: /* Go from current position. */ |
12441 |
idx = src->index + off; |
idx = src->index + off; |
12442 |
break; |
break; |
12443 |
|
|
12444 |
default: /* Invalid `whence'. */ |
default: /* Invalid `whence'. */ |
12445 |
return -1; |
return -1; |
12446 |
} |
} |
12447 |
|
|
12448 |
if (idx > src->len || idx < 0) |
if (idx > src->len || idx < 0) |
12449 |
return -1; |
return -1; |
12450 |
|
|
12451 |
src->index = idx; |
src->index = idx; |
12452 |
return src->index; |
return src->index; |
12453 |
} |
} |
12494 |
{ |
{ |
12495 |
char buf[512]; |
char buf[512]; |
12496 |
int len; |
int len; |
12497 |
|
|
12498 |
len = sprintf (buf, "TIFF error: %s ", title); |
len = sprintf (buf, "TIFF error: %s ", title); |
12499 |
vsprintf (buf + len, format, ap); |
vsprintf (buf + len, format, ap); |
12500 |
add_to_log (buf, Qnil, Qnil); |
add_to_log (buf, Qnil, Qnil); |
12508 |
{ |
{ |
12509 |
char buf[512]; |
char buf[512]; |
12510 |
int len; |
int len; |
12511 |
|
|
12512 |
len = sprintf (buf, "TIFF warning: %s ", title); |
len = sprintf (buf, "TIFF warning: %s ", title); |
12513 |
vsprintf (buf + len, format, ap); |
vsprintf (buf + len, format, ap); |
12514 |
add_to_log (buf, Qnil, Qnil); |
add_to_log (buf, Qnil, Qnil); |
12551 |
UNGCPRO; |
UNGCPRO; |
12552 |
return 0; |
return 0; |
12553 |
} |
} |
12554 |
|
|
12555 |
/* Try to open the image file. */ |
/* Try to open the image file. */ |
12556 |
tiff = TIFFOpen (SDATA (file), "r"); |
tiff = TIFFOpen (SDATA (file), "r"); |
12557 |
if (tiff == NULL) |
if (tiff == NULL) |
12590 |
TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width); |
TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width); |
12591 |
TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height); |
TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height); |
12592 |
buf = (uint32 *) xmalloc (width * height * sizeof *buf); |
buf = (uint32 *) xmalloc (width * height * sizeof *buf); |
12593 |
|
|
12594 |
rc = TIFFReadRGBAImage (tiff, width, height, buf, 0); |
rc = TIFFReadRGBAImage (tiff, width, height, buf, 0); |
12595 |
TIFFClose (tiff); |
TIFFClose (tiff); |
12596 |
if (!rc) |
if (!rc) |
12616 |
for (y = 0; y < height; ++y) |
for (y = 0; y < height; ++y) |
12617 |
{ |
{ |
12618 |
uint32 *row = buf + y * width; |
uint32 *row = buf + y * width; |
12619 |
|
|
12620 |
for (x = 0; x < width; ++x) |
for (x = 0; x < width; ++x) |
12621 |
{ |
{ |
12622 |
uint32 abgr = row[x]; |
uint32 abgr = row[x]; |
12623 |
int r = TIFFGetR (abgr) << 8; |
int r = TIFFGetR (abgr) << 8; |
12624 |
int g = TIFFGetG (abgr) << 8; |
int g = TIFFGetG (abgr) << 8; |
12625 |
int b = TIFFGetB (abgr) << 8; |
int b = TIFFGetB (abgr) << 8; |
12626 |
XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b)); |
XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b)); |
12627 |
} |
} |
12628 |
} |
} |
12629 |
|
|
12721 |
{ |
{ |
12722 |
struct image_keyword fmt[GIF_LAST]; |
struct image_keyword fmt[GIF_LAST]; |
12723 |
bcopy (gif_format, fmt, sizeof fmt); |
bcopy (gif_format, fmt, sizeof fmt); |
12724 |
|
|
12725 |
if (!parse_image_spec (object, fmt, GIF_LAST, Qgif) |
if (!parse_image_spec (object, fmt, GIF_LAST, Qgif) |
12726 |
|| (fmt[GIF_ASCENT].count |
|| (fmt[GIF_ASCENT].count |
12727 |
&& XFASTINT (fmt[GIF_ASCENT].value) > 100)) |
&& XFASTINT (fmt[GIF_ASCENT].value) > 100)) |
12728 |
return 0; |
return 0; |
12729 |
|
|
12730 |
/* Must specify either the :data or :file keyword. */ |
/* Must specify either the :data or :file keyword. */ |
12731 |
return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1; |
return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1; |
12732 |
} |
} |
12799 |
UNGCPRO; |
UNGCPRO; |
12800 |
return 0; |
return 0; |
12801 |
} |
} |
12802 |
|
|
12803 |
/* Open the GIF file. */ |
/* Open the GIF file. */ |
12804 |
gif = DGifOpenFileName (SDATA (file)); |
gif = DGifOpenFileName (SDATA (file)); |
12805 |
if (gif == NULL) |
if (gif == NULL) |
12857 |
UNGCPRO; |
UNGCPRO; |
12858 |
return 0; |
return 0; |
12859 |
} |
} |
12860 |
|
|
12861 |
/* Allocate colors. */ |
/* Allocate colors. */ |
12862 |
gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap; |
gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap; |
12863 |
if (!gif_color_map) |
if (!gif_color_map) |
12864 |
gif_color_map = gif->SColorMap; |
gif_color_map = gif->SColorMap; |
12865 |
init_color_table (); |
init_color_table (); |
12866 |
bzero (pixel_colors, sizeof pixel_colors); |
bzero (pixel_colors, sizeof pixel_colors); |
12867 |
|
|
12868 |
for (i = 0; i < gif_color_map->ColorCount; ++i) |
for (i = 0; i < gif_color_map->ColorCount; ++i) |
12869 |
{ |
{ |
12870 |
int r = gif_color_map->Colors[i].Red << 8; |
int r = gif_color_map->Colors[i].Red << 8; |
12877 |
free_color_table (); |
free_color_table (); |
12878 |
|
|
12879 |
/* Clear the part of the screen image that are not covered by |
/* Clear the part of the screen image that are not covered by |
12880 |
the image from the GIF file. Full animated GIF support |
the image from the GIF file. Full animated GIF support |
12881 |
requires more than can be done here (see the gif89 spec, |
requires more than can be done here (see the gif89 spec, |
12882 |
disposal methods). Let's simply assume that the part |
disposal methods). Let's simply assume that the part |
12883 |
not covered by a sub-image is in the frame's background color. */ |
not covered by a sub-image is in the frame's background color. */ |
12924 |
while (row >= image_height) |
while (row >= image_height) |
12925 |
row = interlace_start[++pass]; |
row = interlace_start[++pass]; |
12926 |
} |
} |
12927 |
|
|
12928 |
for (x = 0; x < image_width; x++) |
for (x = 0; x < image_width; x++) |
12929 |
{ |
{ |
12930 |
int i = raster[(y * image_width) + x]; |
int i = raster[(y * image_width) + x]; |
12931 |
XPutPixel (ximg, x + image_left, row + image_top, |
XPutPixel (ximg, x + image_left, row + image_top, |
12932 |
pixel_colors[i]); |
pixel_colors[i]); |
12933 |
} |
} |
12934 |
|
|
12935 |
row += interlace_increment[pass]; |
row += interlace_increment[pass]; |
12936 |
} |
} |
12937 |
} |
} |
12944 |
XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]); |
XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]); |
12945 |
} |
} |
12946 |
} |
} |
12947 |
|
|
12948 |
DGifCloseFile (gif); |
DGifCloseFile (gif); |
12949 |
|
|
12950 |
/* Maybe fill in the background field while we have ximg handy. */ |
/* Maybe fill in the background field while we have ximg handy. */ |
12954 |
/* Put the image into the pixmap, then free the X image and its buffer. */ |
/* Put the image into the pixmap, then free the X image and its buffer. */ |
12955 |
x_put_x_image (f, ximg, img->pixmap, width, height); |
x_put_x_image (f, ximg, img->pixmap, width, height); |
12956 |
x_destroy_x_image (ximg); |
x_destroy_x_image (ximg); |
12957 |
|
|
12958 |
UNGCPRO; |
UNGCPRO; |
12959 |
return 1; |
return 1; |
12960 |
} |
} |
13055 |
struct image_keyword fmt[GS_LAST]; |
struct image_keyword fmt[GS_LAST]; |
13056 |
Lisp_Object tem; |
Lisp_Object tem; |
13057 |
int i; |
int i; |
13058 |
|
|
13059 |
bcopy (gs_format, fmt, sizeof fmt); |
bcopy (gs_format, fmt, sizeof fmt); |
13060 |
|
|
13061 |
if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript) |
if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript) |
13062 |
|| (fmt[GS_ASCENT].count |
|| (fmt[GS_ASCENT].count |
13063 |
&& XFASTINT (fmt[GS_ASCENT].value) > 100)) |
&& XFASTINT (fmt[GS_ASCENT].value) > 100)) |
13064 |
return 0; |
return 0; |
13065 |
|
|
13127 |
image_error ("Unable to create pixmap for `%s'", img->spec, Qnil); |
image_error ("Unable to create pixmap for `%s'", img->spec, Qnil); |
13128 |
return 0; |
return 0; |
13129 |
} |
} |
13130 |
|
|
13131 |
/* Call the loader to fill the pixmap. It returns a process object |
/* Call the loader to fill the pixmap. It returns a process object |
13132 |
if successful. We do not record_unwind_protect here because |
if successful. We do not record_unwind_protect here because |
13133 |
other places in redisplay like calling window scroll functions |
other places in redisplay like calling window scroll functions |
13138 |
(unsigned long) FRAME_W32_WINDOW (f), |
(unsigned long) FRAME_W32_WINDOW (f), |
13139 |
(unsigned long) img->pixmap); |
(unsigned long) img->pixmap); |
13140 |
window_and_pixmap_id = build_string (buffer); |
window_and_pixmap_id = build_string (buffer); |
13141 |
|
|
13142 |
sprintf (buffer, "%lu %lu", |
sprintf (buffer, "%lu %lu", |
13143 |
FRAME_FOREGROUND_PIXEL (f), |
FRAME_FOREGROUND_PIXEL (f), |
13144 |
FRAME_BACKGROUND_PIXEL (f)); |
FRAME_BACKGROUND_PIXEL (f)); |
13145 |
pixel_colors = build_string (buffer); |
pixel_colors = build_string (buffer); |
13146 |
|
|
13147 |
XSETFRAME (frame, f); |
XSETFRAME (frame, f); |
13148 |
loader = image_spec_value (img->spec, QCloader, NULL); |
loader = image_spec_value (img->spec, QCloader, NULL); |
13149 |
if (NILP (loader)) |
if (NILP (loader)) |
13205 |
if (ximg) |
if (ximg) |
13206 |
{ |
{ |
13207 |
int x, y; |
int x, y; |
13208 |
|
|
13209 |
/* Initialize the color table. */ |
/* Initialize the color table. */ |
13210 |
init_color_table (); |
init_color_table (); |
13211 |
|
|
13212 |
/* For each pixel of the image, look its color up in the |
/* For each pixel of the image, look its color up in the |
13213 |
color table. After having done so, the color table will |
color table. After having done so, the color table will |
13214 |
contain an entry for each color used by the image. */ |
contain an entry for each color used by the image. */ |
13238 |
else |
else |
13239 |
image_error ("Cannot get X image of `%s'; colors will not be freed", |
image_error ("Cannot get X image of `%s'; colors will not be freed", |
13240 |
img->spec, Qnil); |
img->spec, Qnil); |
13241 |
|
|
13242 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
13243 |
} |
} |
13244 |
|
|
13350 |
rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
13351 |
prop_atom, 0, bytes_remaining, |
prop_atom, 0, bytes_remaining, |
13352 |
False, XA_STRING, |
False, XA_STRING, |
13353 |
&actual_type, &actual_format, |
&actual_type, &actual_format, |
13354 |
&actual_size, &bytes_remaining, |
&actual_size, &bytes_remaining, |
13355 |
(unsigned char **) &tmp_data); |
(unsigned char **) &tmp_data); |
13356 |
if (rc == Success) |
if (rc == Success) |
13357 |
prop_value = make_string (tmp_data, size); |
prop_value = make_string (tmp_data, size); |
13405 |
#if 0 /* TODO: cursor shape changes. */ |
#if 0 /* TODO: cursor shape changes. */ |
13406 |
EMACS_TIME delay; |
EMACS_TIME delay; |
13407 |
int secs, usecs = 0; |
int secs, usecs = 0; |
13408 |
|
|
13409 |
cancel_hourglass (); |
cancel_hourglass (); |
13410 |
|
|
13411 |
if (INTEGERP (Vhourglass_delay) |
if (INTEGERP (Vhourglass_delay) |
13421 |
} |
} |
13422 |
else |
else |
13423 |
secs = DEFAULT_HOURGLASS_DELAY; |
secs = DEFAULT_HOURGLASS_DELAY; |
13424 |
|
|
13425 |
EMACS_SET_SECS_USECS (delay, secs, usecs); |
EMACS_SET_SECS_USECS (delay, secs, usecs); |
13426 |
hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, |
hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, |
13427 |
show_hourglass, NULL); |
show_hourglass, NULL); |
13440 |
cancel_atimer (hourglass_atimer); |
cancel_atimer (hourglass_atimer); |
13441 |
hourglass_atimer = NULL; |
hourglass_atimer = NULL; |
13442 |
} |
} |
13443 |
|
|
13444 |
if (hourglass_shown_p) |
if (hourglass_shown_p) |
13445 |
hide_hourglass (); |
hide_hourglass (); |
13446 |
} |
} |
13467 |
if (!hourglass_shown_p) |
if (!hourglass_shown_p) |
13468 |
{ |
{ |
13469 |
Lisp_Object rest, frame; |
Lisp_Object rest, frame; |
13470 |
|
|
13471 |
BLOCK_INPUT; |
BLOCK_INPUT; |
13472 |
|
|
13473 |
FOR_EACH_FRAME (rest, frame) |
FOR_EACH_FRAME (rest, frame) |
13474 |
if (FRAME_W32_P (XFRAME (frame))) |
if (FRAME_W32_P (XFRAME (frame))) |
13475 |
{ |
{ |
13476 |
struct frame *f = XFRAME (frame); |
struct frame *f = XFRAME (frame); |
13477 |
|
|
13478 |
f->output_data.w32->hourglass_p = 1; |
f->output_data.w32->hourglass_p = 1; |
13479 |
|
|
13480 |
if (!f->output_data.w32->hourglass_window) |
if (!f->output_data.w32->hourglass_window) |
13481 |
{ |
{ |
13482 |
unsigned long mask = CWCursor; |
unsigned long mask = CWCursor; |
13483 |
XSetWindowAttributes attrs; |
XSetWindowAttributes attrs; |
13484 |
|
|
13485 |
attrs.cursor = f->output_data.w32->hourglass_cursor; |
attrs.cursor = f->output_data.w32->hourglass_cursor; |
13486 |
|
|
13487 |
f->output_data.w32->hourglass_window |
f->output_data.w32->hourglass_window |
13488 |
= XCreateWindow (FRAME_X_DISPLAY (f), |
= XCreateWindow (FRAME_X_DISPLAY (f), |
13489 |
FRAME_OUTER_WINDOW (f), |
FRAME_OUTER_WINDOW (f), |
13492 |
CopyFromParent, |
CopyFromParent, |
13493 |
mask, &attrs); |
mask, &attrs); |
13494 |
} |
} |
13495 |
|
|
13496 |
XMapRaised (FRAME_X_DISPLAY (f), |
XMapRaised (FRAME_X_DISPLAY (f), |
13497 |
f->output_data.w32->hourglass_window); |
f->output_data.w32->hourglass_window); |
13498 |
XFlush (FRAME_X_DISPLAY (f)); |
XFlush (FRAME_X_DISPLAY (f)); |
13519 |
FOR_EACH_FRAME (rest, frame) |
FOR_EACH_FRAME (rest, frame) |
13520 |
{ |
{ |
13521 |
struct frame *f = XFRAME (frame); |
struct frame *f = XFRAME (frame); |
13522 |
|
|
13523 |
if (FRAME_W32_P (f) |
if (FRAME_W32_P (f) |
13524 |
/* Watch out for newly created frames. */ |
/* Watch out for newly created frames. */ |
13525 |
&& f->output_data.x->hourglass_window) |
&& f->output_data.x->hourglass_window) |
13549 |
Lisp_Object, Lisp_Object)); |
Lisp_Object, Lisp_Object)); |
13550 |
static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, |
static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, |
13551 |
Lisp_Object, int, int, int *, int *)); |
Lisp_Object, int, int, int *, int *)); |
13552 |
|
|
13553 |
/* The frame of a currently visible tooltip. */ |
/* The frame of a currently visible tooltip. */ |
13554 |
|
|
13555 |
Lisp_Object tip_frame; |
Lisp_Object tip_frame; |
13582 |
tip_window = NULL; |
tip_window = NULL; |
13583 |
tip_frame = Qnil; |
tip_frame = Qnil; |
13584 |
} |
} |
13585 |
|
|
13586 |
return deleted; |
return deleted; |
13587 |
} |
} |
13588 |
|
|
13648 |
Ferase_buffer (); |
Ferase_buffer (); |
13649 |
Finsert (1, &text); |
Finsert (1, &text); |
13650 |
set_buffer_internal_1 (old_buffer); |
set_buffer_internal_1 (old_buffer); |
13651 |
|
|
13652 |
FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; |
FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; |
13653 |
record_unwind_protect (unwind_create_tip_frame, frame); |
record_unwind_protect (unwind_create_tip_frame, frame); |
13654 |
|
|
13706 |
else |
else |
13707 |
font = x_new_font (f, SDATA (font)); |
font = x_new_font (f, SDATA (font)); |
13708 |
} |
} |
13709 |
|
|
13710 |
/* Try out a font which we hope has bold and italic variations. */ |
/* Try out a font which we hope has bold and italic variations. */ |
13711 |
if (!STRINGP (font)) |
if (!STRINGP (font)) |
13712 |
font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); |
font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); |
13816 |
if (NILP (Fframe_parameter (frame, intern ("tooltip")))) |
if (NILP (Fframe_parameter (frame, intern ("tooltip")))) |
13817 |
Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), |
Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), |
13818 |
Qnil)); |
Qnil)); |
13819 |
|
|
13820 |
/* Set up faces after all frame parameters are known. This call |
/* Set up faces after all frame parameters are known. This call |
13821 |
also merges in face attributes specified for new frames. |
also merges in face attributes specified for new frames. |
13822 |
|
|
13831 |
/* Set tip_frame here, so that */ |
/* Set tip_frame here, so that */ |
13832 |
tip_frame = frame; |
tip_frame = frame; |
13833 |
call1 (Qface_set_after_frame_default, frame); |
call1 (Qface_set_after_frame_default, frame); |
13834 |
|
|
13835 |
if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))) |
if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))) |
13836 |
Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg), |
Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg), |
13837 |
Qnil)); |
Qnil)); |
13838 |
} |
} |
13839 |
|
|
13840 |
f->no_split = 1; |
f->no_split = 1; |
13841 |
|
|
13842 |
UNGCPRO; |
UNGCPRO; |
13876 |
int *root_x, *root_y; |
int *root_x, *root_y; |
13877 |
{ |
{ |
13878 |
Lisp_Object left, top; |
Lisp_Object left, top; |
13879 |
|
|
13880 |
/* User-specified position? */ |
/* User-specified position? */ |
13881 |
left = Fcdr (Fassq (Qleft, parms)); |
left = Fcdr (Fassq (Qleft, parms)); |
13882 |
top = Fcdr (Fassq (Qtop, parms)); |
top = Fcdr (Fassq (Qtop, parms)); |
13883 |
|
|
13884 |
/* Move the tooltip window where the mouse pointer is. Resize and |
/* Move the tooltip window where the mouse pointer is. Resize and |
13885 |
show it. */ |
show it. */ |
13886 |
if (!INTEGERP (left) || !INTEGERP (top)) |
if (!INTEGERP (left) || !INTEGERP (top)) |
13952 |
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
13953 |
int old_windows_or_buffers_changed = windows_or_buffers_changed; |
int old_windows_or_buffers_changed = windows_or_buffers_changed; |
13954 |
int count = SPECPDL_INDEX (); |
int count = SPECPDL_INDEX (); |
13955 |
|
|
13956 |
specbind (Qinhibit_redisplay, Qt); |
specbind (Qinhibit_redisplay, Qt); |
13957 |
|
|
13958 |
GCPRO4 (string, parms, frame, timeout); |
GCPRO4 (string, parms, frame, timeout); |
13968 |
dx = make_number (5); |
dx = make_number (5); |
13969 |
else |
else |
13970 |
CHECK_NUMBER (dx); |
CHECK_NUMBER (dx); |
13971 |
|
|
13972 |
if (NILP (dy)) |
if (NILP (dy)) |
13973 |
dy = make_number (-10); |
dy = make_number (-10); |
13974 |
else |
else |
13988 |
&& !NILP (Fequal (last_parms, parms))) |
&& !NILP (Fequal (last_parms, parms))) |
13989 |
{ |
{ |
13990 |
struct frame *f = XFRAME (tip_frame); |
struct frame *f = XFRAME (tip_frame); |
13991 |
|
|
13992 |
/* Only DX and DY have changed. */ |
/* Only DX and DY have changed. */ |
13993 |
if (!NILP (tip_timer)) |
if (!NILP (tip_timer)) |
13994 |
{ |
{ |
14063 |
w->width = make_number (80); |
w->width = make_number (80); |
14064 |
w->height = make_number (40); |
w->height = make_number (40); |
14065 |
} |
} |
14066 |
|
|
14067 |
f->window_width = XINT (w->width); |
f->window_width = XINT (w->width); |
14068 |
adjust_glyphs (f); |
adjust_glyphs (f); |
14069 |
w->pseudo_window_p = 1; |
w->pseudo_window_p = 1; |
14104 |
else |
else |
14105 |
#endif |
#endif |
14106 |
row_width = row->pixel_width; |
row_width = row->pixel_width; |
14107 |
|
|
14108 |
/* TODO: find why tips do not draw along baseline as instructed. */ |
/* TODO: find why tips do not draw along baseline as instructed. */ |
14109 |
height += row->height; |
height += row->height; |
14110 |
width = max (width, row_width); |
width = max (width, row_width); |
14176 |
/* Return quickly if nothing to do. */ |
/* Return quickly if nothing to do. */ |
14177 |
if (NILP (tip_timer) && NILP (tip_frame)) |
if (NILP (tip_timer) && NILP (tip_frame)) |
14178 |
return Qnil; |
return Qnil; |
14179 |
|
|
14180 |
frame = tip_frame; |
frame = tip_frame; |
14181 |
timer = tip_timer; |
timer = tip_timer; |
14182 |
GCPRO2 (frame, timer); |
GCPRO2 (frame, timer); |
14183 |
tip_frame = tip_timer = deleted = Qnil; |
tip_frame = tip_timer = deleted = Qnil; |
14184 |
|
|
14185 |
count = SPECPDL_INDEX (); |
count = SPECPDL_INDEX (); |
14186 |
specbind (Qinhibit_redisplay, Qt); |
specbind (Qinhibit_redisplay, Qt); |
14187 |
specbind (Qinhibit_quit, Qt); |
specbind (Qinhibit_quit, Qt); |
14188 |
|
|
14189 |
if (!NILP (timer)) |
if (!NILP (timer)) |
14190 |
call1 (Qcancel_timer, timer); |
call1 (Qcancel_timer, timer); |
14191 |
|
|
14953 |
doc: /* If non-zero, the virtual key code for an alternative quit key. */); |
doc: /* If non-zero, the virtual key code for an alternative quit key. */); |
14954 |
XSETINT (Vw32_quit_key, 0); |
XSETINT (Vw32_quit_key, 0); |
14955 |
|
|
14956 |
DEFVAR_LISP ("w32-pass-lwindow-to-system", |
DEFVAR_LISP ("w32-pass-lwindow-to-system", |
14957 |
&Vw32_pass_lwindow_to_system, |
&Vw32_pass_lwindow_to_system, |
14958 |
doc: /* Non-nil if the left \"Windows\" key is passed on to Windows. |
doc: /* Non-nil if the left \"Windows\" key is passed on to Windows. |
14959 |
When non-nil, the Start menu is opened by tapping the key. */); |
When non-nil, the Start menu is opened by tapping the key. */); |
14960 |
Vw32_pass_lwindow_to_system = Qt; |
Vw32_pass_lwindow_to_system = Qt; |
14961 |
|
|
14962 |
DEFVAR_LISP ("w32-pass-rwindow-to-system", |
DEFVAR_LISP ("w32-pass-rwindow-to-system", |
14963 |
&Vw32_pass_rwindow_to_system, |
&Vw32_pass_rwindow_to_system, |
14964 |
doc: /* Non-nil if the right \"Windows\" key is passed on to Windows. |
doc: /* Non-nil if the right \"Windows\" key is passed on to Windows. |
14965 |
When non-nil, the Start menu is opened by tapping the key. */); |
When non-nil, the Start menu is opened by tapping the key. */); |
14977 |
means that this hack won't interfere with any real key code. */ |
means that this hack won't interfere with any real key code. */ |
14978 |
Vw32_phantom_key_code = 255; |
Vw32_phantom_key_code = 255; |
14979 |
|
|
14980 |
DEFVAR_LISP ("w32-enable-num-lock", |
DEFVAR_LISP ("w32-enable-num-lock", |
14981 |
&Vw32_enable_num_lock, |
&Vw32_enable_num_lock, |
14982 |
doc: /* Non-nil if Num Lock should act normally. |
doc: /* Non-nil if Num Lock should act normally. |
14983 |
Set to nil to see Num Lock as the key `kp-numlock'. */); |
Set to nil to see Num Lock as the key `kp-numlock'. */); |
14984 |
Vw32_enable_num_lock = Qt; |
Vw32_enable_num_lock = Qt; |
14985 |
|
|
14986 |
DEFVAR_LISP ("w32-enable-caps-lock", |
DEFVAR_LISP ("w32-enable-caps-lock", |
14987 |
&Vw32_enable_caps_lock, |
&Vw32_enable_caps_lock, |
14988 |
doc: /* Non-nil if Caps Lock should act normally. |
doc: /* Non-nil if Caps Lock should act normally. |
14989 |
Set to nil to see Caps Lock as the key `capslock'. */); |
Set to nil to see Caps Lock as the key `capslock'. */); |
15090 |
DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, |
DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, |
15091 |
doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); |
doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); |
15092 |
display_hourglass_p = 1; |
display_hourglass_p = 1; |
15093 |
|
|
15094 |
DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, |
DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, |
15095 |
doc: /* *Seconds to wait before displaying an hourglass pointer. |
doc: /* *Seconds to wait before displaying an hourglass pointer. |
15096 |
Value must be an integer or float. */); |
Value must be an integer or float. */); |
15118 |
doc: /* Maximum size for tooltips. |
doc: /* Maximum size for tooltips. |
15119 |
Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */); |
Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */); |
15120 |
Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); |
Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); |
15121 |
|
|
15122 |
DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, |
DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, |
15123 |
doc: /* Non-nil if no window manager is in use. |
doc: /* Non-nil if no window manager is in use. |
15124 |
Emacs doesn't try to figure this out; this is always nil |
Emacs doesn't try to figure this out; this is always nil |
15349 |
Qxpm = intern ("xpm"); |
Qxpm = intern ("xpm"); |
15350 |
staticpro (&Qxpm); |
staticpro (&Qxpm); |
15351 |
#endif |
#endif |
15352 |
|
|
15353 |
#if HAVE_JPEG |
#if HAVE_JPEG |
15354 |
Qjpeg = intern ("jpeg"); |
Qjpeg = intern ("jpeg"); |
15355 |
staticpro (&Qjpeg); |
staticpro (&Qjpeg); |
15356 |
#endif |
#endif |
15357 |
|
|
15358 |
#if HAVE_TIFF |
#if HAVE_TIFF |
15359 |
Qtiff = intern ("tiff"); |
Qtiff = intern ("tiff"); |
15360 |
staticpro (&Qtiff); |
staticpro (&Qtiff); |
15361 |
#endif |
#endif |
15362 |
|
|
15363 |
#if HAVE_GIF |
#if HAVE_GIF |
15364 |
Qgif = intern ("gif"); |
Qgif = intern ("gif"); |
15406 |
#if 0 /* TODO : Image support for W32 */ |
#if 0 /* TODO : Image support for W32 */ |
15407 |
define_image_type (&gs_type); |
define_image_type (&gs_type); |
15408 |
#endif |
#endif |
15409 |
|
|
15410 |
#if HAVE_XPM |
#if HAVE_XPM |
15411 |
define_image_type (&xpm_type); |
define_image_type (&xpm_type); |
15412 |
#endif |
#endif |
15413 |
|
|
15414 |
#if HAVE_JPEG |
#if HAVE_JPEG |
15415 |
define_image_type (&jpeg_type); |
define_image_type (&jpeg_type); |
15416 |
#endif |
#endif |
15417 |
|
|
15418 |
#if HAVE_TIFF |
#if HAVE_TIFF |
15419 |
define_image_type (&tiff_type); |
define_image_type (&tiff_type); |
15420 |
#endif |
#endif |
15422 |
#if HAVE_GIF |
#if HAVE_GIF |
15423 |
define_image_type (&gif_type); |
define_image_type (&gif_type); |
15424 |
#endif |
#endif |
15425 |
|
|
15426 |
#if HAVE_PNG |
#if HAVE_PNG |
15427 |
define_image_type (&png_type); |
define_image_type (&png_type); |
15428 |
#endif |
#endif |
15430 |
|
|
15431 |
#undef abort |
#undef abort |
15432 |
|
|
15433 |
void |
void |
15434 |
w32_abort() |
w32_abort() |
15435 |
{ |
{ |
15436 |
int button; |
int button; |