/* * Return value is Qt if we have dispatched the command, * or Qnil if id has not been mapped to a callback. * Window procedure may try other targets to route the * command if we return nil */ Lisp_Object mswindows_handle_gui_wm_command (struct frame* f, HWND ctrl, LPARAM id) { /* Try to map the command id through the proper hash table */ Lisp_Object callback, callback_ex, image_instance, frame, event; XSETFRAME (frame, f); /* #### make_int should assert that --kkm */ assert (XINT (make_int (id)) == id); image_instance = Fgethash (make_int (id), FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f), Qnil); /* It is possible for a widget action to cause it to get out of sync with its instantiator. Thus it is necessary to signal this possibility. */ if (IMAGE_INSTANCEP (image_instance)) XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (image_instance) = 1; callback = Fgethash (make_int (id), FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), Qnil); callback_ex = Fgethash (make_int (id), FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f), Qnil); if (!NILP (callback_ex) && !UNBOUNDP (callback_ex)) { event = Fmake_event (Qnil, Qnil); XEVENT (event)->event_type = misc_user_event; XEVENT (event)->channel = frame; XEVENT (event)->timestamp = GetTickCount (); XEVENT (event)->event.eval.function = Qeval; XEVENT (event)->event.eval.object = list4 (Qfuncall, callback_ex, image_instance, event); } else if (NILP (callback) || UNBOUNDP (callback)) return Qnil; else { Lisp_Object fn, arg; event = Fmake_event (Qnil, Qnil); get_gui_callback (callback, &fn, &arg); XEVENT (event)->event_type = misc_user_event; XEVENT (event)->channel = frame; XEVENT (event)->timestamp = GetTickCount (); XEVENT (event)->event.eval.function = fn; XEVENT (event)->event.eval.object = arg; } mswindows_enqueue_dispatch_event (event); /* The result of this evaluation could cause other instances to change so enqueue an update callback to check this. */ enqueue_magic_eval_event (update_widget_instances, frame); return Qt; }
Lisp_Object mswindows_handle_print_dialog_box (struct frame *UNUSED (f), Lisp_Object keys) { Lisp_Object device = Qunbound, settings = Qunbound; DWORD flags = PD_NOSELECTION; { EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys) { if (EQ (key, Q_device)) { device = wrap_device (decode_device (value)); CHECK_MSPRINTER_DEVICE (device); } else if (EQ (key, Q_printer_settings)) { CHECK_DEVMODE (value); settings = value; } else if (EQ (key, Q_allow_pages)) { if (NILP (value)) flags |= PD_NOPAGENUMS; } else if (EQ (key, Q_allow_selection)) { if (!NILP (value)) flags &= ~PD_NOSELECTION; } else if (EQ (key, Q_selected_page_button)) { if (EQ (value, Qselection)) flags |= PD_SELECTION; else if (EQ (value, Qpages)) flags |= PD_PAGENUMS; else if (!EQ (value, Qall)) invalid_constant ("for :selected-page-button", value); } else invalid_constant ("Unrecognized print-dialog keyword", key); } } if ((UNBOUNDP (device) && UNBOUNDP (settings)) || (!UNBOUNDP (device) && !UNBOUNDP (settings))) sferror ("Exactly one of :device and :printer-settings must be given", keys); return print_dialog_worker (!UNBOUNDP (device) ? device : settings, flags); }
static void show_arg(ScmObj arg, ScmObj env) { if (SYMBOLP(arg) && !UNBOUNDP(arg, env)) { scm_format(scm_err, SCM_FMT_RAW_C, " - [~S]: ", SCM_SYMBOL_NAME(arg)); SCM_WRITE_SS(scm_err, scm_symbol_value(arg, env)); scm_port_newline(scm_err); } }
/* For use by abbrev_match(): Match SYMBOL's name against buffer text before point, case-insensitively. When found, return non-zero, so that map_obarray terminates mapping. */ static int abbrev_match_mapper(Lisp_Object symbol, void *arg) { struct abbrev_match_mapper_closure *closure = (struct abbrev_match_mapper_closure *)arg; Charcount abbrev_length; Lisp_Symbol *sym = XSYMBOL(symbol); Lisp_String *abbrev; /* symbol_value should be OK here, because abbrevs are not expected to contain any SYMBOL_MAGIC stuff. */ if (UNBOUNDP(symbol_value(sym)) || NILP(symbol_value(sym))) { /* The symbol value of nil means that abbrev got undefined. */ return 0; } abbrev = symbol_name(sym); abbrev_length = string_char_length(abbrev); if (abbrev_length > closure->maxlen) { /* This abbrev is too large -- it wouldn't fit. */ return 0; } /* If `bar' is an abbrev, and a user presses `fubar<SPC>', we don't normally want to expand it. OTOH, if the abbrev begins with non-word syntax (e.g. `#if'), it is OK to abbreviate it anywhere. */ if (abbrev_length < closure->maxlen && abbrev_length > 0 && (WORD_SYNTAX_P(closure->chartab, string_char(abbrev, 0))) && (WORD_SYNTAX_P(closure->chartab, BUF_FETCH_CHAR(closure->buf, closure->point - (abbrev_length + 1))))) { return 0; } /* Match abbreviation string against buffer text. */ { Bufbyte *ptr = string_data(abbrev); Charcount idx; for (idx = 0; idx < abbrev_length; idx++) { if (DOWNCASE(closure->buf, BUF_FETCH_CHAR(closure->buf, closure->point - abbrev_length + idx)) != DOWNCASE(closure->buf, charptr_emchar(ptr))) { break; } INC_CHARPTR(ptr); } if (idx == abbrev_length) { /* This is the one. */ closure->found = sym; return 1; } } return 0; }
static int gtk_font_spec_matches_charset (struct device *d, Lisp_Object charset, const Bufbyte *nonreloc, Lisp_Object reloc, Bytecount offset, Bytecount length) { if (UNBOUNDP (charset)) return 1; /* Hack! Short font names don't have the registry in them, so we just assume the user knows what they're doing in the case of ASCII. For other charsets, you gotta give the long form; sorry buster. */ if (EQ (charset, Vcharset_ascii)) { const Bufbyte *the_nonreloc = nonreloc; int i; Bytecount the_length = length; if (!the_nonreloc) the_nonreloc = XSTRING_DATA (reloc); fixup_internal_substring (nonreloc, reloc, offset, &the_length); the_nonreloc += offset; if (!memchr (the_nonreloc, '*', the_length)) { for (i = 0;; i++) { const Bufbyte *new_nonreloc = (const Bufbyte *) memchr (the_nonreloc, '-', the_length); if (!new_nonreloc) break; new_nonreloc++; the_length -= new_nonreloc - the_nonreloc; the_nonreloc = new_nonreloc; } /* If it has less than 5 dashes, it's a short font. Of course, long fonts always have 14 dashes or so, but short fonts never have more than 1 or 2 dashes, so this is some sort of reasonable heuristic. */ if (i < 5) return 1; } } return (fast_string_match (XCHARSET_REGISTRY (charset), nonreloc, reloc, offset, length, 1, ERROR_ME, 0) >= 0); }
void popup_selection_callback(Widget widget, LWLIB_ID ignored_id, XtPointer client_data) { Lisp_Object data, image_instance, callback, callback_ex; Lisp_Object frame, event; int update_subwindows_p = 0; struct device *d = get_device_from_display(XtDisplay(widget)); struct frame *f = x_any_widget_or_parent_to_frame(d, widget); /* set in lwlib to the time stamp associated with the most recent menu operation */ extern Time x_focus_timestamp_really_sucks_fix_me_better; if (!f) return; if (((EMACS_INT) client_data) == 0) return; VOID_TO_LISP(data, client_data); XSETFRAME(frame, f); #if 0 /* #### What the hell? I can't understand why this call is here, and doing it is really courting disaster in the new event model, since popup_selection_callback is called from within next_event_internal() and Faccept_process_output() itself calls next_event_internal(). --Ben */ /* Flush the X and process input */ Faccept_process_output(Qnil, Qnil, Qnil); #endif if (((EMACS_INT) client_data) == -1) { event = Fmake_event(Qnil, Qnil); XEVENT(event)->event_type = misc_user_event; XEVENT(event)->channel = frame; XEVENT(event)->event.eval.function = Qrun_hooks; XEVENT(event)->event.eval.object = Qmenu_no_selection_hook; } else { image_instance = XCAR(data); callback = XCAR(XCDR(data)); callback_ex = XCDR(XCDR(data)); update_subwindows_p = 1; /* It is possible for a widget action to cause it to get out of sync with its instantiator. Thus it is necessary to signal this possibility. */ if (IMAGE_INSTANCEP(image_instance)) XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED(image_instance) = 1; if (!NILP(callback_ex) && !UNBOUNDP(callback_ex)) { event = Fmake_event(Qnil, Qnil); XEVENT(event)->event_type = misc_user_event; XEVENT(event)->channel = frame; XEVENT(event)->event.eval.function = Qeval; XEVENT(event)->event.eval.object = list4(Qfuncall, callback_ex, image_instance, event); } else if (NILP(callback) || UNBOUNDP(callback)) event = Qnil; else { Lisp_Object fn, arg; event = Fmake_event(Qnil, Qnil); get_gui_callback(callback, &fn, &arg); XEVENT(event)->event_type = misc_user_event; XEVENT(event)->channel = frame; XEVENT(event)->event.eval.function = fn; XEVENT(event)->event.eval.object = arg; } } /* This is the timestamp used for asserting focus so we need to get an up-to-date value event if no events have been dispatched to emacs */ #if defined(HAVE_MENUBARS) DEVICE_X_MOUSE_TIMESTAMP(d) = x_focus_timestamp_really_sucks_fix_me_better; #else DEVICE_X_MOUSE_TIMESTAMP(d) = DEVICE_X_GLOBAL_MOUSE_TIMESTAMP(d); #endif if (!NILP(event)) enqueue_Xt_dispatch_event(event); /* The result of this evaluation could cause other instances to change so enqueue an update callback to check this. */ if (update_subwindows_p && !NILP(event)) enqueue_magic_eval_event(update_widget_instances, frame); }
Lisp_Object mswindows_handle_page_setup_dialog_box (struct frame *UNUSED (f), Lisp_Object keys) { Lisp_Object device = Qunbound, settings = Qunbound; Lisp_Object plist = Qnil; { EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys) { if (EQ (key, Q_device)) { device = wrap_device (decode_device (value)); CHECK_MSPRINTER_DEVICE (device); } else if (EQ (key, Q_printer_settings)) { CHECK_DEVMODE (value); settings = value; } else if (EQ (key, Q_properties)) { CHECK_LIST (value); plist = value; } else invalid_constant ("Unrecognized page-setup dialog keyword", key); } } if ((UNBOUNDP (device) && UNBOUNDP (settings)) || (!UNBOUNDP (device) && !UNBOUNDP (settings))) sferror ("Exactly one of :device and :printer-settings must be given", keys); if (UNBOUNDP (device)) device = settings; { Lisp_Devmode *ldm = decode_devmode (device); PAGESETUPDLGW pd; Extbyte measure[2 * MAX_XETCHAR_SIZE]; int data; qxeGetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IMEASURE, measure, sizeof (measure) / XETCHAR_SIZE); data = qxetcscmp (measure, XETEXT ("0")); memset (&pd, 0, sizeof (pd)); pd.lStructSize = sizeof (pd); pd.hwndOwner = mswindows_get_selected_frame_hwnd (); pd.Flags = PSD_MARGINS; pd.rtMargin.left = plist_get_margin (plist, Qleft_margin, !data); pd.rtMargin.top = plist_get_margin (plist, Qtop_margin, !data); pd.rtMargin.right = plist_get_margin (plist, Qright_margin, !data); pd.rtMargin.bottom = plist_get_margin (plist, Qbottom_margin, !data); pd.hDevMode = devmode_to_hglobal (ldm); if (!qxePageSetupDlg (&pd)) { global_free_2_maybe (pd.hDevNames, pd.hDevMode); return Qnil; } if (pd.hDevMode) handle_devmode_changes (ldm, pd.hDevNames, pd.hDevMode); /* Finally, build the resulting plist */ { Lisp_Object result = Qnil; int mm_p = pd.Flags & PSD_INHUNDREDTHSOFMILLIMETERS; result = plist_set_margin (result, Qbottom_margin, pd.rtMargin.bottom, mm_p); result = plist_set_margin (result, Qright_margin, pd.rtMargin.right, mm_p); result = plist_set_margin (result, Qtop_margin, pd.rtMargin.top, mm_p); result = plist_set_margin (result, Qleft_margin, pd.rtMargin.left, mm_p); return result; } } }
Return a new surface of dimensions @var{width} by @var{height}. Optional third arg @var{flags} (see @code{flagstash:video}) further specifies the surface. Color depth and masks are those for the current video surface. */) { #define FUNC_NAME s_make_surface Uint32 cflags; const SDL_PixelFormat *fmt; const SDL_Surface *cur; ASSERT_INTEGER (width, 1); ASSERT_INTEGER (height, 2); cur = SDL_GetVideoSurface (); fmt = cur ? cur->format : SDL_GetVideoInfo ()->vfmt; cflags = (UNBOUNDP (flags) ? (cur ? cur->flags : 0) : GSDL_FLAGS2ULONG (flags, btw->video_flags, 3)); /* Return a newly allocated surface smob. */ RETURN_NEW_SURFACE (SDL_CreateRGBSurface (cflags, C_LONG (width), C_LONG (height), /* Defaults from current video info. */ fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask)); #undef FUNC_NAME }