这篇教程C++ unblock_input函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中unblock_input函数的典型用法代码示例。如果您正苦于以下问题:C++ unblock_input函数的具体用法?C++ unblock_input怎么用?C++ unblock_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了unblock_input函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: xftfont_closestatic voidxftfont_close (struct font *font){ struct x_display_info *xdi; struct xftfont_info *xftfont_info = (struct xftfont_info *) font;#ifdef HAVE_LIBOTF if (xftfont_info->otf) { OTF_close (xftfont_info->otf); xftfont_info->otf = NULL; }#endif /* See comment in xfont_close. */ if (xftfont_info->xftfont && ((xdi = x_display_info_for_display (xftfont_info->display)) && xftfont_info->x_display_id == xdi->x_id)) { block_input (); XftUnlockFace (xftfont_info->xftfont); XftFontClose (xftfont_info->display, xftfont_info->xftfont); unblock_input (); xftfont_info->xftfont = NULL; }}
开发者ID:GiantGeorgeGo,项目名称:emacs,代码行数:26,
示例2: x_selection_owner_pstatic intx_selection_owner_p (Lisp_Object selection, struct mac_display_info *dpyinfo){ OSStatus err; Selection sel; Lisp_Object local_selection_data; int result = 0; local_selection_data = LOCAL_SELECTION (selection, dpyinfo); if (NILP (local_selection_data)) return 0; block_input (); err = mac_get_selection_from_symbol (selection, 0, &sel); if (err == noErr && sel) { Lisp_Object ownership_info; ownership_info = XCAR (XCDR (XCDR (XCDR (XCDR (local_selection_data))))); if (!NILP (Fequal (ownership_info, mac_get_selection_ownership_info (sel)))) result = 1; } else result = 1; unblock_input (); return result;}
开发者ID:JamesWatling,项目名称:emacs-mac-port,代码行数:32,
示例3: directory_files_internal_unwindstatic voiddirectory_files_internal_unwind (void *dh){ DIR *d = dh; block_input (); closedir (d); unblock_input ();}
开发者ID:fs814,项目名称:emacs,代码行数:8,
示例4: directory_files_internal_unwindstatic Lisp_Objectdirectory_files_internal_unwind (Lisp_Object dh){ DIR *d = XSAVE_POINTER (dh, 0); block_input (); closedir (d); unblock_input (); return Qnil;}
开发者ID:gwydirsam,项目名称:emacs,代码行数:9,
示例5: directory_files_internal_unwindstatic Lisp_Objectdirectory_files_internal_unwind (Lisp_Object dh){ DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; block_input (); closedir (d); unblock_input (); return Qnil;}
开发者ID:githuboctocat,项目名称:emacs,代码行数:9,
示例6: xftfont_get_colorsstatic voidxftfont_get_colors (struct frame *f, struct face *face, GC gc, struct xftface_info *xftface_info, XftColor *fg, XftColor *bg){ if (xftface_info && face->gc == gc) { *fg = xftface_info->xft_fg; if (bg) *bg = xftface_info->xft_bg; } else { XGCValues xgcv; bool fg_done = 0, bg_done = 0; block_input (); XGetGCValues (FRAME_X_DISPLAY (f), gc, GCForeground | GCBackground, &xgcv); if (xftface_info) { if (xgcv.foreground == face->foreground) *fg = xftface_info->xft_fg, fg_done = 1; else if (xgcv.foreground == face->background) *fg = xftface_info->xft_bg, fg_done = 1; if (! bg) bg_done = 1; else if (xgcv.background == face->background) *bg = xftface_info->xft_bg, bg_done = 1; else if (xgcv.background == face->foreground) *bg = xftface_info->xft_fg, bg_done = 1; } if (! (fg_done & bg_done)) { XColor colors[2]; colors[0].pixel = fg->pixel = xgcv.foreground; if (bg) colors[1].pixel = bg->pixel = xgcv.background; XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), colors, bg ? 2 : 1); fg->color.alpha = 0xFFFF; fg->color.red = colors[0].red; fg->color.green = colors[0].green; fg->color.blue = colors[0].blue; if (bg) { bg->color.alpha = 0xFFFF; bg->color.red = colors[1].red; bg->color.green = colors[1].green; bg->color.blue = colors[1].blue; } } unblock_input (); }}
开发者ID:NeoTse,项目名称:deepin-emacs,代码行数:57,
示例7: xmalloc_widget_valuewidget_value *xmalloc_widget_value (void){ widget_value *value; block_input (); value = malloc_widget_value (); unblock_input (); return value;}
开发者ID:0230,项目名称:deepin-emacs,代码行数:11,
示例8: logo_stopRETSIGTYPE logo_stop(int sig) { if (inside_gc || in_eval_save) { int_during_gc = 1; } else { charmode_off(); to_pending = 0; if (!stop_quietly_flag) err_logo(STOP_ERROR, NIL); stop_quietly_flag = 0; signal(SIGINT, logo_stop); unblock_input(); }SIGRET}
开发者ID:eyantra,项目名称:LOGO_Interpreter_Interface_with_Omnibot,代码行数:13,
示例9: free_frame_menubarvoidfree_frame_menubar (struct frame *f){ block_input (); { HMENU old = GetMenu (FRAME_W32_WINDOW (f)); SetMenu (FRAME_W32_WINDOW (f), NULL); f->output_data.w32->menubar_widget = NULL; DestroyMenu (old); } unblock_input ();}
开发者ID:0xAX,项目名称:emacs,代码行数:14,
示例10: make_widget_valuewidget_value *make_widget_value (const char *name, char *value, bool enabled, Lisp_Object help){ widget_value *wv; block_input (); wv = xzalloc (sizeof (widget_value)); unblock_input (); wv->name = (char *) name; wv->value = value; wv->enabled = enabled; wv->help = help; return wv;}
开发者ID:ueno,项目名称:emacs,代码行数:16,
示例11: init_xsettingsstatic voidinit_xsettings (struct x_display_info *dpyinfo){ Display *dpy = dpyinfo->display; block_input (); /* Select events so we can detect client messages sent when selection owner changes. */ XSelectInput (dpy, dpyinfo->root_window, StructureNotifyMask); get_prop_window (dpyinfo); if (dpyinfo->xsettings_window != None) read_and_apply_settings (dpyinfo, false); unblock_input ();}
开发者ID:Ferryworld,项目名称:emacs,代码行数:17,
示例12: xftfont_text_extentsstatic voidxftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics){ struct xftfont_info *xftfont_info = (struct xftfont_info *) font; XGlyphInfo extents; block_input (); XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs, &extents); unblock_input (); metrics->lbearing = - extents.x; metrics->rbearing = - extents.x + extents.width; metrics->width = extents.xOff; metrics->ascent = extents.y; metrics->descent = extents.height - extents.y;}
开发者ID:GiantGeorgeGo,项目名称:emacs,代码行数:18,
示例13: xftfont_get_xft_drawstatic XftDraw *xftfont_get_xft_draw (struct frame *f){ XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver); if (! xft_draw) { block_input (); xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_VISUAL (f), FRAME_X_COLORMAP (f)); unblock_input (); eassert (xft_draw != NULL); font_put_frame_data (f, &xftfont_driver, xft_draw); } return xft_draw;}
开发者ID:NeoTse,项目名称:deepin-emacs,代码行数:18,
示例14: logo_stopvoid logo_stop()#endif{ to_pending = 0;#if 1 /* was #ifndef unix */ err_logo(STOP_ERROR,NIL);#else if (ufun != NIL) { err_logo(STOP_ERROR,NIL); } else { new_line(stdout); }#endif#ifndef bsd signal(SIGINT, logo_stop);#endif unblock_input();}
开发者ID:unusual-thoughts,项目名称:freebsd-1.x-ports,代码行数:18,
示例15: xftfont_end_for_framestatic intxftfont_end_for_frame (struct frame *f){ XftDraw *xft_draw; /* Don't do anything if display is dead */ if (FRAME_X_DISPLAY (f) == NULL) return 0; xft_draw = font_get_frame_data (f, &xftfont_driver); if (xft_draw) { block_input (); XftDrawDestroy (xft_draw); unblock_input (); font_put_frame_data (f, &xftfont_driver, NULL); } return 0;}
开发者ID:NeoTse,项目名称:deepin-emacs,代码行数:19,
示例16: xftfont_drawstatic intxftfont_draw (struct glyph_string *s, int from, int to, int x, int y, bool with_background){ struct frame *f = s->f; struct face *face = s->face; struct xftfont_info *xftfont_info = (struct xftfont_info *) s->font; struct xftface_info *xftface_info = NULL; XftDraw *xft_draw = xftfont_get_xft_draw (f); FT_UInt *code; XftColor fg, bg; int len = to - from; int i; if (s->font == face->font) xftface_info = (struct xftface_info *) face->extra; xftfont_get_colors (f, face, s->gc, xftface_info, &fg, with_background ? &bg : NULL); block_input (); if (s->num_clips > 0) XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips); else XftDrawSetClip (xft_draw, NULL); if (with_background) XftDrawRect (xft_draw, &bg, x, y - s->font->ascent, s->width, s->font->height); code = alloca (sizeof (FT_UInt) * len); for (i = 0; i < len; i++) code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) | XCHAR2B_BYTE2 (s->char2b + from + i)); if (s->padding_p) for (i = 0; i < len; i++) XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, x + i, y, code + i, 1); else XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, x, y, code, len); unblock_input (); return len;}
开发者ID:NeoTse,项目名称:deepin-emacs,代码行数:43,
示例17: logo_pausevoid logo_pause()#endif{ to_pending = 0;#ifdef bsd sigsetmask(0);#else signal(SIGQUIT, logo_pause);#endif#if 1 /* was #ifndef unix */ lpause();#else if (ufun != NIL) { lpause(); } else { new_line(stdout); unblock_input(); }#endif}
开发者ID:unusual-thoughts,项目名称:freebsd-1.x-ports,代码行数:20,
示例18: free_menubar_widget_value_treevoidfree_menubar_widget_value_tree (widget_value *wv){ if (! wv) return; wv->name = wv->value = wv->key = (char *) 0xDEADBEEF; if (wv->contents && (wv->contents != (widget_value*)1)) { free_menubar_widget_value_tree (wv->contents); wv->contents = (widget_value *) 0xDEADBEEF; } if (wv->next) { free_menubar_widget_value_tree (wv->next); wv->next = (widget_value *) 0xDEADBEEF; } block_input (); xfree (wv); unblock_input ();}
开发者ID:ueno,项目名称:emacs,代码行数:21,
示例19: open_directorystatic DIR *open_directory (Lisp_Object dirname, int *fdp){ char *name = SSDATA (dirname); DIR *d; int fd, opendir_errno; block_input ();#ifdef DOS_NT /* Directories cannot be opened. The emulation assumes that any file descriptor other than AT_FDCWD corresponds to the most recently opened directory. This hack is good enough for Emacs. */ fd = 0; d = opendir (name); opendir_errno = errno;#else fd = emacs_open (name, O_RDONLY | O_DIRECTORY, 0); if (fd < 0) { opendir_errno = errno; d = 0; } else { d = fdopendir (fd); opendir_errno = errno; if (! d) emacs_close (fd); }#endif unblock_input (); if (!d) report_file_errno ("Opening directory", dirname, opendir_errno); *fdp = fd; return d;}
开发者ID:EmuxEvans,项目名称:deepin-emacs,代码行数:39,
示例20: run_protectedstatic voidrun_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg){ /* FIXME: This works but it doesn't feel right. Too much fiddling with global variables and calling strange looking functions. Is this really the right way to run Lisp callbacks? */ int owfi; block_input (); /* Fsignal calls emacs_abort () if it sees that waiting_for_input is set. */ owfi = waiting_for_input; waiting_for_input = 0; internal_condition_case_1 (code, arg, Qt, lisp_error_handler); waiting_for_input = owfi; unblock_input ();}
开发者ID:GiantGeorgeGo,项目名称:emacs,代码行数:22,
示例21: x_get_foreign_selectionstatic Lisp_Objectx_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type, Lisp_Object time_stamp, Lisp_Object frame){ struct frame *f = XFRAME (frame); OSStatus err; Selection sel; Lisp_Object result = Qnil; if (!FRAME_LIVE_P (f)) return Qnil; block_input (); err = mac_get_selection_from_symbol (selection_symbol, 0, &sel); if (err == noErr && sel) { if (EQ (target_type, QTARGETS)) { Lisp_Object args[2]; args[0] = list1 (QTARGETS); args[1] = mac_get_selection_target_list (sel); result = Fvconcat (2, args); } else { result = mac_get_selection_value (sel, target_type); if (STRINGP (result)) Fput_text_property (make_number (0), make_number (SBYTES (result)), Qforeign_selection, target_type, result); } } unblock_input (); return result;}
开发者ID:JamesWatling,项目名称:emacs-mac-port,代码行数:38,
示例22: w32_popup_dialogLisp_Objectw32_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents){ check_window_system (f);#ifndef HAVE_DIALOGS /* Handle simple Yes/No choices as MessageBox popups. */ if (is_simple_dialog (contents)) return simple_dialog_show (f, contents, header); else return Qunsupported__w32_dialog;#else /* HAVE_DIALOGS */ { Lisp_Object title; char *error_name; Lisp_Object selection; /* Decode the dialog items from what was specified. */ title = Fcar (contents); CHECK_STRING (title); list_of_panes (Fcons (contents, Qnil)); /* Display them in a dialog box. */ block_input (); selection = w32_dialog_show (f, title, header, &error_name); unblock_input (); discard_menu_items (); FRAME_DISPLAY_INFO (f)->grabbed = 0; if (error_name) error (error_name); return selection; }#endif /* HAVE_DIALOGS */}
开发者ID:0xAX,项目名称:emacs,代码行数:38,
示例23: w32_console_mouse_position/* Mouse position hook. */voidw32_console_mouse_position (FRAME_PTR *f, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, Time *time){ block_input (); insist = insist; *f = get_frame (); *bar_window = Qnil; *part = 0; SELECTED_FRAME ()->mouse_moved = 0; XSETINT (*x, movement_pos.X); XSETINT (*y, movement_pos.Y); *time = movement_time; unblock_input ();}
开发者ID:exedre,项目名称:emacs,代码行数:25,
示例24: xg_select//.........这里部分代码省略......... { /* Avoid using SAFE_NALLOCA, as that implicitly refers to the current thread. Using xnmalloc avoids thread-switching problems here. */ gfds = xnmalloc (n_gfds, sizeof *gfds); must_free = 1; gfds_size = n_gfds; n_gfds = g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec, gfds, gfds_size); } for (i = 0; i < n_gfds; ++i) { if (gfds[i].events & G_IO_IN) { FD_SET (gfds[i].fd, &all_rfds); if (gfds[i].fd > max_fds) max_fds = gfds[i].fd; } if (gfds[i].events & G_IO_OUT) { FD_SET (gfds[i].fd, &all_wfds); if (gfds[i].fd > max_fds) max_fds = gfds[i].fd; have_wfds = true; } } if (must_free) xfree (gfds); if (n_gfds >= 0 && tmo_in_millisec >= 0) { tmo = make_timespec (tmo_in_millisec / 1000, 1000 * 1000 * (tmo_in_millisec % 1000)); if (!timeout || timespec_cmp (tmo, *timeout) < 0) tmop = &tmo; } fds_lim = max_fds + 1; nfds = thread_select (pselect, fds_lim, &all_rfds, have_wfds ? &all_wfds : NULL, efds, tmop, sigmask); if (nfds < 0) retval = nfds; else if (nfds > 0) { for (i = 0; i < fds_lim; ++i) { if (FD_ISSET (i, &all_rfds)) { if (rfds && FD_ISSET (i, rfds)) ++retval; else ++our_fds; } else if (rfds) FD_CLR (i, rfds); if (have_wfds && FD_ISSET (i, &all_wfds)) { if (wfds && FD_ISSET (i, wfds)) ++retval; else ++our_fds; } else if (wfds) FD_CLR (i, wfds); if (efds && FD_ISSET (i, efds)) ++retval; } } /* If Gtk+ is in use eventually gtk_main_iteration will be called, unless retval is zero. */#ifdef USE_GTK need_to_dispatch = retval == 0;#else need_to_dispatch = true;#endif if (need_to_dispatch && context_acquired) { int pselect_errno = errno; /* Prevent g_main_dispatch recursion, that would occur without block_input wrapper, because event handlers call unblock_input. Event loop recursion was causing Bug#15801. */ block_input (); while (g_main_context_pending (context)) g_main_context_dispatch (context); unblock_input (); errno = pselect_errno; } if (context_acquired) g_main_context_release (context); /* To not have to recalculate timeout, return like this. */ if ((our_fds > 0 || (nfds == 0 && tmop == &tmo)) && (retval == 0)) { retval = -1; errno = EINTR; } return retval;}
开发者ID:JJJollyjim,项目名称:remacs,代码行数:101,
示例25: w32_console_read_socketintw32_console_read_socket (struct terminal *terminal, struct input_event *hold_quit){ int nev, add; int isdead; block_input (); for (;;) { int nfnotify = handle_file_notifications (hold_quit); nev = fill_queue (0); if (nev <= 0) { /* If nev == -1, there was some kind of error If nev == 0 then no events were available so return. */ if (nfnotify) nev = 0; break; } while (nev > 0) { struct input_event inev; EVENT_INIT (inev); inev.kind = NO_EVENT; inev.arg = Qnil; switch (queue_ptr->EventType) { case KEY_EVENT: add = key_event (&queue_ptr->Event.KeyEvent, &inev, &isdead); if (add == -1) /* 95.7.25 by himi */ { queue_ptr--; add = 1; } if (add) kbd_buffer_store_event_hold (&inev, hold_quit); break; case MOUSE_EVENT: add = do_mouse_event (&queue_ptr->Event.MouseEvent, &inev); if (add) kbd_buffer_store_event_hold (&inev, hold_quit); break; case WINDOW_BUFFER_SIZE_EVENT: if (w32_use_full_screen_buffer) resize_event (&queue_ptr->Event.WindowBufferSizeEvent); break; case MENU_EVENT: case FOCUS_EVENT: /* Internal event types, ignored. */ break; } queue_ptr++; nev--; } } /* We don't get told about changes in the window size (only the buffer size, which we no longer care about), so we have to check it periodically. */ if (!w32_use_full_screen_buffer) maybe_generate_resize_event (); unblock_input (); return nev;}
开发者ID:exedre,项目名称:emacs,代码行数:76,
示例26: directory_files_internal//.........这里部分代码省略......... bool wanted = 0; Lisp_Object name, finalname; struct gcpro gcpro1, gcpro2; errno = 0; dp = readdir (d); if (!dp) { if (errno == EAGAIN || errno == EINTR) { QUIT; continue; } break; } len = dirent_namelen (dp); name = finalname = make_unibyte_string (dp->d_name, len); GCPRO2 (finalname, name); /* Note: DECODE_FILE can GC; it should protect its argument, though. */ name = DECODE_FILE (name); len = SBYTES (name); /* Now that we have unwind_protect in place, we might as well allow matching to be interrupted. */ immediate_quit = 1; QUIT; if (NILP (match) || re_search (bufp, SSDATA (name), len, 0, len, 0) >= 0) wanted = 1; immediate_quit = 0; if (wanted) { if (!NILP (full)) { Lisp_Object fullname; ptrdiff_t nbytes = len + directory_nbytes + needsep; ptrdiff_t nchars; fullname = make_uninit_multibyte_string (nbytes, nbytes); memcpy (SDATA (fullname), SDATA (directory), directory_nbytes); if (needsep) SSET (fullname, directory_nbytes, DIRECTORY_SEP); memcpy (SDATA (fullname) + directory_nbytes + needsep, SDATA (name), len); nchars = multibyte_chars_in_text (SDATA (fullname), nbytes); /* Some bug somewhere. */ if (nchars > nbytes) emacs_abort (); STRING_SET_CHARS (fullname, nchars); if (nchars == nbytes) STRING_SET_UNIBYTE (fullname); finalname = fullname; } else finalname = name; if (attrs) { Lisp_Object fileattrs = file_attributes (fd, dp->d_name, id_format); list = Fcons (Fcons (finalname, fileattrs), list); } else list = Fcons (finalname, list); } UNGCPRO; } block_input (); closedir (d); unblock_input ();#ifdef WINDOWSNT if (attrs) Vw32_get_true_file_attributes = w32_save;#endif /* Discard the unwind protect. */ specpdl_ptr = specpdl + count; if (NILP (nosort)) list = Fsort (Fnreverse (list), attrs ? Qfile_attributes_lessp : Qstring_lessp); (void) directory_volatile; RETURN_UNGCPRO (list);}
开发者ID:fs814,项目名称:emacs,代码行数:101,
示例27: xftfont_drawstatic intxftfont_draw (struct glyph_string *s, int from, int to, int x, int y, bool with_background){ struct frame *f = s->f; struct face *face = s->face; struct xftfont_info *xftfont_info = (struct xftfont_info *) s->font; struct xftface_info *xftface_info = NULL; XftDraw *xft_draw = xftfont_get_xft_draw (f); FT_UInt *code; XftColor fg, bg; int len = to - from; int i; if (s->font == face->font) xftface_info = (struct xftface_info *) face->extra; xftfont_get_colors (f, face, s->gc, xftface_info, &fg, with_background ? &bg : NULL); block_input (); if (s->num_clips > 0) XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips); else XftDrawSetClip (xft_draw, NULL); if (with_background) { int height = FONT_HEIGHT (s->font), ascent = FONT_BASE (s->font); /* Font's global height and ascent values might be preposterously large for some fonts. We fix here the case when those fonts are used for display of glyphless characters, because drawing background with font dimensions in those cases makes the display illegible. There's only one more call to the draw method with with_background set to true, and that's in x_draw_glyph_string_foreground, when drawing the cursor, where we have no such heuristics available. FIXME. */ if (s->first_glyph->type == GLYPHLESS_GLYPH && (s->first_glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE || s->first_glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM)) height = ascent = s->first_glyph->slice.glyphless.lower_yoff - s->first_glyph->slice.glyphless.upper_yoff; XftDrawRect (xft_draw, &bg, x, y - ascent, s->width, height); } code = alloca (sizeof (FT_UInt) * len); for (i = 0; i < len; i++) code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) | XCHAR2B_BYTE2 (s->char2b + from + i)); if (s->padding_p) for (i = 0; i < len; i++) XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, x + i, y, code + i, 1); else XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, x, y, code, len); unblock_input (); return len;}
开发者ID:GiantGeorgeGo,项目名称:emacs,代码行数:61,
示例28: xftfont_openstatic Lisp_Objectxftfont_open (struct frame *f, Lisp_Object entity, int pixel_size){ FcResult result; Display *display = FRAME_X_DISPLAY (f); Lisp_Object val, filename, idx, font_object; FcPattern *pat = NULL, *match; struct xftfont_info *xftfont_info = NULL; struct font *font; double size = 0; XftFont *xftfont = NULL; int spacing; char name[256]; int len, i; XGlyphInfo extents; FT_Face ft_face; FcMatrix *matrix; val = assq_no_quit (QCfont_entity, AREF (entity, FONT_EXTRA_INDEX)); if (! CONSP (val)) return Qnil; val = XCDR (val); filename = XCAR (val); idx = XCDR (val); size = XINT (AREF (entity, FONT_SIZE_INDEX)); if (size == 0) size = pixel_size; pat = FcPatternCreate (); FcPatternAddInteger (pat, FC_WEIGHT, FONT_WEIGHT_NUMERIC (entity)); i = FONT_SLANT_NUMERIC (entity) - 100; if (i < 0) i = 0; FcPatternAddInteger (pat, FC_SLANT, i); FcPatternAddInteger (pat, FC_WIDTH, FONT_WIDTH_NUMERIC (entity)); FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size); val = AREF (entity, FONT_FAMILY_INDEX); if (! NILP (val)) FcPatternAddString (pat, FC_FAMILY, (FcChar8 *) SDATA (SYMBOL_NAME (val))); val = AREF (entity, FONT_FOUNDRY_INDEX); if (! NILP (val)) FcPatternAddString (pat, FC_FOUNDRY, (FcChar8 *) SDATA (SYMBOL_NAME (val))); val = AREF (entity, FONT_SPACING_INDEX); if (! NILP (val)) FcPatternAddInteger (pat, FC_SPACING, XINT (val)); val = AREF (entity, FONT_DPI_INDEX); if (! NILP (val)) { double dbl = XINT (val); FcPatternAddDouble (pat, FC_DPI, dbl); } val = AREF (entity, FONT_AVGWIDTH_INDEX); if (INTEGERP (val) && XINT (val) == 0) FcPatternAddBool (pat, FC_SCALABLE, FcTrue); /* This is necessary to identify the exact font (e.g. 10x20.pcf.gz over 10x20-ISO8859-1.pcf.gz). */ FcPatternAddCharSet (pat, FC_CHARSET, ftfont_get_fc_charset (entity)); xftfont_add_rendering_parameters (pat, entity); FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename)); FcPatternAddInteger (pat, FC_INDEX, XINT (idx)); block_input (); /* Make sure that the Xrender extension is added before the Xft one. Otherwise, the close-display hook set by Xft is called after the one for Xrender, and the former tries to re-add the latter. This results in inconsistency of internal states and leads to X protocol error when one reconnects to the same X server. (Bug#1696) */ { int event_base, error_base; XRenderQueryExtension (display, &event_base, &error_base); } /* Substitute in values from X resources and XftDefaultSet. */ XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); match = XftFontMatch (display, FRAME_X_SCREEN_NUMBER (f), pat, &result); xftfont_fix_match (pat, match); FcPatternDestroy (pat); xftfont = XftFontOpenPattern (display, match); if (!xftfont) { unblock_input (); XftPatternDestroy (match); return Qnil; } ft_face = XftLockFace (xftfont); unblock_input (); /* We should not destroy PAT here because it is kept in XFTFONT and destroyed automatically when XFTFONT is closed. */ font_object = font_make_object (VECSIZE (struct xftfont_info), entity, size); ASET (font_object, FONT_TYPE_INDEX, Qxft); len = font_unparse_xlfd (entity, size, name, 256); if (len > 0) ASET (font_object, FONT_NAME_INDEX, make_string (name, len)); len = font_unparse_fcname (entity, size, name, 256); if (len > 0)//.........这里部分代码省略.........
开发者ID:NeoTse,项目名称:deepin-emacs,代码行数:101,
示例29: w32_menu_show//.........这里部分代码省略......... wv_title->title = TRUE; wv_title->button_type = BUTTON_TYPE_NONE; wv_title->next = wv_sep; first_wv->contents = wv_title; } /* No selection has been chosen yet. */ menu_item_selection = 0; /* Actually create the menu. */ current_popup_menu = menu = CreatePopupMenu (); fill_in_menu (menu, first_wv->contents); /* Adjust coordinates to be root-window-relative. */ pos.x = x; pos.y = y; ClientToScreen (FRAME_W32_WINDOW (f), &pos); /* Display the menu. */ menu_item_selection = SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_TRACKPOPUPMENU, (WPARAM)menu, (LPARAM)&pos); /* Clean up extraneous mouse events which might have been generated during the call. */ discard_mouse_events (); FRAME_DISPLAY_INFO (f)->grabbed = 0; /* Free the widget_value objects we used to specify the contents. */ free_menubar_widget_value_tree (first_wv); DestroyMenu (menu); /* Free the owner-drawn and help-echo menu strings. */ w32_free_menu_strings (FRAME_W32_WINDOW (f)); f->output_data.w32->menubar_active = 0; /* Find the selected item, and its pane, to return the proper value. */ if (menu_item_selection != 0) { Lisp_Object prefix, entry; prefix = entry = Qnil; i = 0; while (i < menu_items_used) { if (EQ (AREF (menu_items, i), Qnil)) { subprefix_stack[submenu_depth++] = prefix; prefix = entry; i++; } else if (EQ (AREF (menu_items, i), Qlambda)) { prefix = subprefix_stack[--submenu_depth]; i++; } else if (EQ (AREF (menu_items, i), Qt)) { prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); i += MENU_ITEMS_PANE_LENGTH; } /* Ignore a nil in the item list. It's meaningful only for dialog boxes. */ else if (EQ (AREF (menu_items, i), Qquote)) i += 1; else { entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); if (menu_item_selection == i) { if (menuflags & MENU_KEYMAPS) { int j; entry = Fcons (entry, Qnil); if (!NILP (prefix)) entry = Fcons (prefix, entry); for (j = submenu_depth - 1; j >= 0; j--) if (!NILP (subprefix_stack[j])) entry = Fcons (subprefix_stack[j], entry); } unblock_input (); return entry; } i += MENU_ITEMS_ITEM_LENGTH; } } } else if (!(menuflags & MENU_FOR_CLICK)) { unblock_input (); /* Make "Cancel" equivalent to C-g. */ Fsignal (Qquit, Qnil); } unblock_input (); return Qnil;}
开发者ID:0xAX,项目名称:emacs,代码行数:101,
示例30: set_frame_menubar//.........这里部分代码省略......... fset_menu_bar_vector (f, menu_items); f->menu_bar_items_used = menu_items_used; /* This undoes save_menu_items. */ unbind_to (specpdl_count, Qnil); /* Now GC cannot happen during the lifetime of the widget_value, so it's safe to store data from a Lisp_String, as long as local copies are made when the actual menu is created. Windows takes care of this for normal string items, but not for owner-drawn items or additional item-info. */ wv = first_wv->contents; for (i = 0; i < ASIZE (items); i += 4) { Lisp_Object string; string = AREF (items, i + 1); if (NILP (string)) break; wv->name = SSDATA (string); update_submenu_strings (wv->contents); wv = wv->next; } } else { /* Make a widget-value tree containing just the top level menu bar strings. */ wv = make_widget_value ("menubar", NULL, true, Qnil); wv->button_type = BUTTON_TYPE_NONE; first_wv = wv; items = FRAME_MENU_BAR_ITEMS (f); for (i = 0; i < ASIZE (items); i += 4) { Lisp_Object string; string = AREF (items, i + 1); if (NILP (string)) break; wv = make_widget_value (SSDATA (string), NULL, true, Qnil); wv->button_type = BUTTON_TYPE_NONE; /* This prevents lwlib from assuming this menu item is really supposed to be empty. */ /* The EMACS_INT cast avoids a warning. This value just has to be different from small integers. */ wv->call_data = (void *) (EMACS_INT) (-1); if (prev_wv) prev_wv->next = wv; else first_wv->contents = wv; prev_wv = wv; } /* Forget what we thought we knew about what is in the detailed contents of the menu bar menus. Changing the top level always destroys the contents. */ f->menu_bar_items_used = 0; } /* Create or update the menu bar widget. */ block_input (); if (menubar_widget) { /* Empty current menubar, rather than creating a fresh one. */ while (DeleteMenu (menubar_widget, 0, MF_BYPOSITION)) ; } else { menubar_widget = CreateMenu (); } fill_in_menu (menubar_widget, first_wv->contents); free_menubar_widget_value_tree (first_wv); { HMENU old_widget = f->output_data.w32->menubar_widget; f->output_data.w32->menubar_widget = menubar_widget; SetMenu (FRAME_W32_WINDOW (f), f->output_data.w32->menubar_widget); /* Causes flicker when menu bar is updated DrawMenuBar (FRAME_W32_WINDOW (f)); */ /* Force the window size to be recomputed so that the frame's text area remains the same, if menubar has just been created. */ if (old_widget == NULL) { windows_or_buffers_changed = 23; adjust_frame_size (f, -1, -1, 2, false, Qmenu_bar_lines); } } unblock_input ();}
开发者ID:0xAX,项目名称:emacs,代码行数:101,
注:本文中的unblock_input函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ unblock_socket函数代码示例 C++ unbind_from_irqhandler函数代码示例 |