int index_sort_header_get(struct mail_search_sort_program *program, uint32_t seq, enum mail_sort_type sort_type, string_t *dest) { struct mail *mail = program->temp_mail; const char *str; int ret; bool reply_or_fw; index_sort_set_seq(program, mail, seq); str_truncate(dest, 0); switch (sort_type & MAIL_SORT_MASK) { case MAIL_SORT_SUBJECT: ret = mail_get_first_header(mail, "Subject", &str); if (ret < 0) break; if (ret == 0) { /* nonexistent header */ return 1; } str = imap_get_base_subject_cased(pool_datastack_create(), str, &reply_or_fw); str_append(dest, str); return 1; case MAIL_SORT_CC: ret = get_first_mailbox(mail, "Cc", &str); break; case MAIL_SORT_FROM: ret = get_first_mailbox(mail, "From", &str); break; case MAIL_SORT_TO: ret = get_first_mailbox(mail, "To", &str); break; case MAIL_SORT_DISPLAYFROM: ret = get_display_name(mail, "From", &str); break; case MAIL_SORT_DISPLAYTO: ret = get_display_name(mail, "To", &str); break; default: i_unreached(); } if (ret < 0) { index_sort_program_set_mail_failed(program, mail); if (!program->failed) return 0; return -1; } (void)uni_utf8_to_decomposed_titlecase(str, strlen(str), dest); return 1; }
static void gst_vaapi_display_x11_get_property( GObject *object, guint prop_id, GValue *value, GParamSpec *pspec ) { GstVaapiDisplayX11 * const display = GST_VAAPI_DISPLAY_X11(object); switch (prop_id) { case PROP_SYNCHRONOUS: g_value_set_boolean(value, display->priv->synchronous); break; case PROP_DISPLAY_NAME: g_value_set_string(value, get_display_name(display)); break; case PROP_X11_DISPLAY: g_value_set_pointer(value, gst_vaapi_display_x11_get_display(display)); break; case PROP_X11_SCREEN: g_value_set_int(value, gst_vaapi_display_x11_get_screen(display)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } }
void ui_update_entry(struct playlist *playlist, struct playlist_entry *entry) { struct playlist_ui_ctx *playlist_ctx = get_playlist_ui_ctx(playlist); struct entry_ui_ctx *ctx = get_entry_ui_ctx(entry); if (ctx->rowref == NULL) return; lock_ui(); GtkTreePath *path = gtk_tree_row_reference_get_path(ctx->rowref); GtkTreeIter iter; gtk_tree_model_get_iter(GTK_TREE_MODEL(playlist_ctx->store), &iter, path); gtk_tree_path_free(path); char *name = get_display_name(get_entry_song(entry)); char buf[32]; unsigned int length = get_song_length(get_entry_song(entry)); if (length == -1) strcpy(buf, "-"); else sprintf(buf, "%d:%02d", length / (1000 * 60), (length / 1000) % 60); gtk_list_store_set(playlist_ctx->store, &iter, COL_NAME, name, COL_LENGTH, buf, -1); free(name); unlock_ui(); }
static gboolean gst_vaapi_display_x11_open_display(GstVaapiDisplay *display) { GstVaapiDisplayX11Private * const priv = GST_VAAPI_DISPLAY_X11(display)->priv; if (priv->create_display) { priv->x11_display = XOpenDisplay(get_display_name(display)); if (!priv->x11_display) return FALSE; priv->x11_screen = DefaultScreen(priv->x11_display); } if (!priv->x11_display) return FALSE; if (priv->synchronous) XSynchronize(priv->x11_display, True); #ifdef HAVE_XRANDR { int evt_base, err_base; priv->use_xrandr = XRRQueryExtension( priv->x11_display, &evt_base, &err_base); } #endif return TRUE; }
void _report_node_access_error(QSP_ARG_DECL spinNodeHandle hNode, const char *w) { char dname[256]; size_t len=256; if( get_display_name(dname,&len,hNode) < 0 ){ strcpy(dname,"(unable to get display name)"); } sprintf(ERROR_STRING,"feature node '%s' not %s!?",dname,w); advise(ERROR_STRING); }
static void change_filename(GFile* src, const char* dst_name, GtkWidget* parent_window) { char* src_name; GFile* parent; GFile* dst; gboolean res; GError* error = NULL; if (dst_name == NULL) return; src_name = g_file_get_basename(src); if (strcmp(src_name, dst_name) != 0) { parent = g_file_get_parent(src); dst = g_file_get_child(parent, dst_name); res = g_file_move(src, dst, G_FILE_COPY_NOFOLLOW_SYMLINKS, NULL, NULL, NULL, &error); if (!res) { GtkWidget* dialog; char* display_name; gboolean do_free = FALSE;; if (g_utf8_validate(src_name, -1, NULL)) { display_name = src_name; } else { display_name = get_display_name(src_name); do_free = TRUE; } dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(parent_window), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("<span size=\"larger\" weight=\"bold\">There was an error renaming \"%s\" to \"%s\"</span>"), display_name, dst_name); gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog), "%s", error->message); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); g_error_free(error); if (do_free) g_free(display_name); } g_object_unref(G_OBJECT(dst)); } g_free(src_name); }
int index_sort_header_get(struct mail *mail, uint32_t seq, enum mail_sort_type sort_type, string_t *dest) { const char *str; int ret; bool reply_or_fw; mail_set_seq(mail, seq); str_truncate(dest, 0); switch (sort_type & MAIL_SORT_MASK) { case MAIL_SORT_SUBJECT: if ((ret = mail_get_first_header(mail, "Subject", &str)) <= 0) return ret; str = imap_get_base_subject_cased(pool_datastack_create(), str, &reply_or_fw); str_append(dest, str); return 0; case MAIL_SORT_CC: ret = get_first_mailbox(mail, "Cc", &str); break; case MAIL_SORT_FROM: ret = get_first_mailbox(mail, "From", &str); break; case MAIL_SORT_TO: ret = get_first_mailbox(mail, "To", &str); break; case MAIL_SORT_DISPLAYFROM: ret = get_display_name(mail, "From", &str); break; case MAIL_SORT_DISPLAYTO: ret = get_display_name(mail, "To", &str); break; default: i_unreached(); } (void)uni_utf8_to_decomposed_titlecase(str, strlen(str), dest); return ret; }
void va_init_display_args(int *argc, char *argv[]) { const char *display_name; display_name = get_display_name(*argc, argv); if (display_name && strcmp(display_name, "help") == 0) { print_display_names(); exit(0); } g_display_name = display_name; sanitize_args(argc, argv); }
static gboolean append_dir(GtkTreeStore* store, GtkTreeIter* parent_iter, GFile* dir, const char* encoding) { GtkTreeIter iter; GFileInfo* info; GFileEnumerator* e; gboolean success_all = TRUE; e = g_file_enumerate_children(dir, G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); if (e == NULL) return success_all; info = g_file_enumerator_next_file(e, NULL, NULL); while (info != NULL) { const char* name = g_file_info_get_name(info); char* display_name = get_display_name(name); char* new_name = get_new_name(name, encoding); GFileType ftype; file_list_model_append(store, &iter, parent_iter, NULL, name, display_name, new_name); if (new_name == NULL) success_all = FALSE; ftype = g_file_info_get_file_type(info); if (ftype == G_FILE_TYPE_DIRECTORY) { gboolean res; GFile* child = g_file_get_child(dir, name); res = append_dir(store, &iter, child, encoding); g_object_unref(child); if (!res) success_all = FALSE; } g_object_unref(info); g_free(display_name); g_free(new_name); info = g_file_enumerator_next_file(e, NULL, NULL); } g_object_unref(e); return success_all; }
/* * FUNCTION: compose_stripe_within_hba(devconfig_t *request, * dlist_t *hbas, uint64_t nbytes, * int maxcomp, int mincomp, dlist_t **stripe) * * INPUT: request - pointer to a devconfig_t of the current request * hbas - pointer to a list of available HBAs * nbytes - the desired capacity for the stripe * maxcomp - the maximum number of stripe components * mincomp - the minimum number of stripe components * * OUTPUT: stripe - pointer to a stripe devconfig_t result * * RETURNS: int - 0 on success * !0 otherwise. * * PURPOSE: Layout function which compose a stripe of the desired size * using available disks within any single HBA from the input list. * * The number of components within the composed stripe will be * in the range of min to max, preferring more components * over fewer. * * All input HBAs are expected to have at least mincomp * available disks and total space sufficient for the stripe. * * If the stripe can be composed, a pointer to it is returned in * the stripe devconfig_t *. * * * while (more hbas and stripe not composed) { * select HBA * if (not enough available space on this HBA) { * continue; * } * get available disks for HBA * use # disks as max # of stripe components * try to compose stripe * } * */ static int compose_stripe_within_hba( devconfig_t *request, dlist_t *hbas, uint64_t nbytes, uint16_t min, uint16_t max, devconfig_t **stripe) { int error = 0; dlist_t *iter = NULL; *stripe = NULL; for (iter = hbas; (iter != NULL) && (error == 0) && (*stripe == NULL); iter = iter->next) { dm_descriptor_t hba = (uintptr_t)iter->obj; dlist_t *disks = NULL; uint64_t space = 0; uint16_t ncomp = 0; char *name; ((error = get_display_name(hba, &name)) != 0) || (error = hba_get_avail_disks_and_space(request, hba, &disks, &space)); if (error == 0) { if (space >= nbytes) { ncomp = dlist_length(disks); ncomp = ((ncomp > max) ? max : ncomp); error = compose_stripe( request, nbytes, disks, ncomp, min, NULL, stripe); } else { print_hba_insufficient_space_msg(name, space); } } dlist_free_items(disks, NULL); } return (error); }
GtkWidget *create_tab_chat_header(LinphoneChatRoom *cr,const LinphoneAddress *uri){ GtkWidget *w=gtk_hbox_new (FALSE,0); GtkWidget *i=create_pixmap ("chat.png"); GtkWidget *l; GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_CLOSE,GTK_ICON_SIZE_MENU); GtkWidget *b=gtk_button_new(); gtk_button_set_image(GTK_BUTTON(b),image); gtk_button_set_relief(GTK_BUTTON(b),GTK_RELIEF_NONE); gtk_widget_set_size_request(b,25,20); g_signal_connect_swapped(G_OBJECT(b),"clicked",G_CALLBACK(linphone_gtk_quit_chatroom),cr); l=gtk_label_new(get_display_name(uri)); gtk_box_pack_start (GTK_BOX(w),i,FALSE,FALSE,0); gtk_box_pack_start (GTK_BOX(w),l,FALSE,FALSE,0); gtk_box_pack_end(GTK_BOX(w),b,TRUE,TRUE,0); gtk_widget_show_all(w); return w; }
static gboolean gst_vaapi_display_x11_open_display (GstVaapiDisplay * base_display, const gchar * name) { GstVaapiDisplayX11 *const display = GST_VAAPI_DISPLAY_X11_CAST (base_display); GstVaapiDisplayX11Private *const priv = display->priv; if (!set_display_name (display, name)) return FALSE; priv->x11_display = XOpenDisplay (get_display_name (display)); if (!priv->x11_display) return FALSE; priv->use_foreign_display = FALSE; priv->x11_screen = DefaultScreen (priv->x11_display); check_extensions (display); return TRUE; }
void ui_set_cursor(struct playlist_entry *entry) { GtkAdjustment *adj = gtk_range_get_adjustment(GTK_RANGE(seekbar)); lock_ui(); if (entry) { struct song *song = get_entry_song(entry); char *name = get_display_name(song); char *buf = concat_strings(name, " - " APP_NAME); if (buf) { gtk_window_set_title(GTK_WINDOW(main_window), buf); free(buf); } free(name); gtk_adjustment_set_upper(adj, get_song_length(song) / 1000.0); } else { gtk_window_set_title(GTK_WINDOW(main_window), APP_NAME); gtk_adjustment_set_upper(adj, 1); } unlock_ui(); }
void udpate_tab_chat_header(GtkWidget *chat_view,const LinphoneAddress *uri,LinphoneChatRoom *cr){ GtkWidget *main_window=linphone_gtk_get_main_window(); GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(main_window,"viewswitch")); GtkWidget *w=gtk_hbox_new (FALSE,0); GtkWidget *i=create_pixmap ("chat.png"); GtkWidget *l; GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_CLOSE,GTK_ICON_SIZE_MENU); GtkWidget *b=gtk_button_new(); gtk_button_set_image(GTK_BUTTON(b),image); gtk_button_set_relief(GTK_BUTTON(b),GTK_RELIEF_NONE); gtk_widget_set_size_request(b,25,20); g_signal_connect_swapped(G_OBJECT(b),"clicked",G_CALLBACK(linphone_gtk_quit_chatroom),cr); l=gtk_label_new (get_display_name(uri)); gtk_box_pack_start (GTK_BOX(w),i,FALSE,FALSE,0); gtk_box_pack_start (GTK_BOX(w),l,FALSE,FALSE,0); gtk_box_pack_end(GTK_BOX(w),b,TRUE,TRUE,0); gtk_notebook_set_tab_label(notebook,chat_view,w); gtk_widget_show_all(w); }
void ui_add_entry(struct playlist *playlist, struct playlist_entry *after, struct playlist_entry *entry) { struct playlist_ui_ctx *playlist_ctx = get_playlist_ui_ctx(playlist); struct song *song = get_entry_song(entry); struct entry_ui_ctx *ctx = get_entry_ui_ctx(entry); lock_ui(); GtkTreeIter sibling; if (after) { struct entry_ui_ctx *after_ctx = get_entry_ui_ctx(after); GtkTreePath *path = gtk_tree_row_reference_get_path(after_ctx->rowref); gtk_tree_model_get_iter(GTK_TREE_MODEL(playlist_ctx->store), &sibling, path); gtk_tree_path_free(path); } GtkTreeIter iter; if (after) gtk_list_store_insert_after(playlist_ctx->store, &iter, &sibling); else gtk_list_store_insert_after(playlist_ctx->store, &iter, NULL); char *name = get_display_name(song); char buf[32]; unsigned int length = get_song_length(song); if (length == -1) strcpy(buf, "-"); else sprintf(buf, "%d:%02d", length / (1000 * 60), (length / 1000) % 60); gtk_list_store_set(playlist_ctx->store, &iter, COL_ENTRY, entry, COL_NAME, name, COL_LENGTH, buf, COL_COLOR, NULL, -1); free(name); /* store row reference */ GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(playlist_ctx->store), &iter); ctx->rowref = gtk_tree_row_reference_new(GTK_TREE_MODEL(playlist_ctx->store), path); gtk_tree_path_free(path); unlock_ui(); }
static int print_node_value(spinNodeHandle hNode ) { char displayName[MAX_BUFF_LEN]; size_t displayNameLength = MAX_BUFF_LEN; char value[MAX_BUFF_LEN]; size_t valueLength = MAX_BUFF_LEN; spinNodeType type; char out_string[256]; if( get_node_type(&type,hNode) < 0 ) return -1; if( get_display_name(displayName,&displayNameLength,hNode) < 0 ) return -1; if( type == CategoryNode ){ sprintf(out_string,"%s", displayName); } else { if( get_node_value_string(value,&valueLength,hNode) < 0 ) return -1; sprintf(out_string,"%s: %s", displayName,value); } printf("%s\n",out_string); return 0; }
/** * \brief Initialize w32_common framework. * * The first function that should be called from the w32_common framework. * It handles window creation on the screen with proper title and attributes. * It also initializes the framework's internal variables. The function should * be called after your own preinit initialization and you shouldn't do any * window management on your own. * * Global libvo variables changed: * vo_w32_window * vo_screenwidth * vo_screenheight * * \return 1 = Success, 0 = Failure */ int vo_w32_init(struct vo *vo) { struct vo_w32_state *w32 = vo->w32; if (w32 && w32->window) return 1; if (!w32) w32 = vo->w32 = talloc_zero(vo, struct vo_w32_state); HINSTANCE hInstance = GetModuleHandleW(NULL); HICON mplayerIcon = LoadIconW(hInstance, L"IDI_ICON1"); WNDCLASSEXW wcex = { .cbSize = sizeof wcex, .style = CS_OWNDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, .lpfnWndProc = WndProc, .hInstance = hInstance, .hIcon = mplayerIcon, .hCursor = LoadCursor(0, IDC_ARROW), .lpszClassName = classname, .hIconSm = mplayerIcon, }; if (!RegisterClassExW(&wcex)) { mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to register window class!\n"); return 0; } if (WinID >= 0) { RECT r; GetClientRect(WIN_ID_TO_HWND(WinID), &r); vo->dwidth = r.right; vo->dheight = r.bottom; w32->window = CreateWindowExW(WS_EX_NOPARENTNOTIFY, classname, classname, WS_CHILD | WS_VISIBLE, 0, 0, vo->dwidth, vo->dheight, WIN_ID_TO_HWND(WinID), 0, hInstance, vo); } else { w32->window = CreateWindowExW(0, classname, classname, update_style(vo, 0), CW_USEDEFAULT, 0, 100, 100, 0, 0, hInstance, vo); } if (!w32->window) { mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to create window!\n"); return 0; } if (WinID >= 0) EnableWindow(w32->window, 0); w32->dev_hdc = 0; wchar_t *dev = get_display_name(); if (dev) w32->dev_hdc = CreateDCW(dev, NULL, NULL, NULL); free(dev); updateScreenProperties(vo); mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo->opts->vo_screenwidth, vo->opts->vo_screenheight, w32->depthonscreen); return 1; } /** * \brief Toogle fullscreen / windowed mode. * * Should be called on VOCTRL_FULLSCREEN event. The window is * always resized during this call, so the rendering context * should be reinitialized with the new dimensions. * It is unspecified if vo_check_events will create a resize * event in addition or not. */ void vo_w32_fullscreen(struct vo *vo) { vo_fs = !vo_fs; reinit_window_state(vo); }
/** * \brief Initialize w32_common framework. * * The first function that should be called from the w32_common framework. * It handles window creation on the screen with proper title and attributes. * It also initializes the framework's internal variables. The function should * be called after your own preinit initialization and you shouldn't do any * window management on your own. * * Global libvo variables changed: * vo_w32_window * vo_depthonscreen * vo_screenwidth * vo_screenheight * * \return 1 = Success, 0 = Failure */ int vo_w32_init(void) { HICON mplayerIcon = 0; char exedir[MAX_PATH]; HINSTANCE user32; char *dev; if (vo_window) return 1; hInstance = GetModuleHandle(0); if (GetModuleFileName(0, exedir, MAX_PATH)) mplayerIcon = ExtractIcon(hInstance, exedir, 0); if (!mplayerIcon) mplayerIcon = LoadIcon(0, IDI_APPLICATION); { WNDCLASSEX wcex = { sizeof wcex, CS_OWNDC | CS_DBLCLKS, WndProc, 0, 0, hInstance, mplayerIcon, LoadCursor(0, IDC_ARROW), NULL, 0, classname, mplayerIcon }; if (!RegisterClassEx(&wcex)) { mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to register window class!\n"); return 0; } } if (WinID >= 0) { RECT r; GetClientRect(WinID, &r); vo_dwidth = r.right; vo_dheight = r.bottom; vo_window = CreateWindowEx(WS_EX_NOPARENTNOTIFY, classname, classname, WS_CHILD | WS_VISIBLE, 0, 0, vo_dwidth, vo_dheight, WinID, 0, hInstance, 0); EnableWindow(vo_window, 0); } else vo_window = CreateWindowEx(0, classname, classname, vo_border ? (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP, CW_USEDEFAULT, 0, 100, 100, 0, 0, hInstance, 0); if (!vo_window) { mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to create window!\n"); return 0; } myMonitorFromWindow = NULL; myGetMonitorInfo = NULL; myEnumDisplayMonitors = NULL; user32 = GetModuleHandle("user32.dll"); if (user32) { myMonitorFromWindow = (void *)GetProcAddress(user32, "MonitorFromWindow"); myGetMonitorInfo = GetProcAddress(user32, "GetMonitorInfoA"); myEnumDisplayMonitors = GetProcAddress(user32, "EnumDisplayMonitors"); } dev_hdc = 0; dev = get_display_name(); if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL); free(dev); updateScreenProperties(); mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, vo_depthonscreen); return 1; }
static char * gdk_x11_app_launch_context_get_startup_notify_id (GAppLaunchContext *context, GAppInfo *info, GList *files) { static int sequence = 0; GdkDisplay *display; GdkX11Screen *screen; int files_count; char *description; char *icon_name; const char *binary_name; const char *application_id; char *screen_str; char *workspace_str; GIcon *icon; guint32 timestamp; char *startup_id; GFileInfo *fileinfo; GdkAppLaunchContext *ctx; ctx = GDK_APP_LAUNCH_CONTEXT (context); display = ctx->display; screen = GDK_X11_DISPLAY (display)->screen; fileinfo = NULL; files_count = g_list_length (files); if (files_count == 0) { description = g_strdup_printf (_("Starting %s"), g_app_info_get_name (info)); } else if (files_count == 1) { gchar *display_name; if (g_file_is_native (files->data)) fileinfo = g_file_query_info (files->data, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_STANDARD_ICON, 0, NULL, NULL); display_name = get_display_name (files->data, fileinfo); description = g_strdup_printf (_("Opening %s"), display_name); g_free (display_name); } else description = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "Opening %d Item", "Opening %d Items", files_count), files_count); icon_name = NULL; if (ctx->icon_name) icon_name = g_strdup (ctx->icon_name); else { icon = NULL; if (ctx->icon != NULL) icon = g_object_ref (ctx->icon); else if (files_count == 1) icon = get_icon (files->data, fileinfo); if (icon == NULL) { icon = g_app_info_get_icon (info); if (icon != NULL) g_object_ref (icon); } if (icon != NULL) { icon_name = gicon_to_string (icon); g_object_unref (icon); } } binary_name = g_app_info_get_executable (info); timestamp = ctx->timestamp; if (timestamp == GDK_CURRENT_TIME) timestamp = gdk_x11_display_get_user_time (display); screen_str = g_strdup_printf ("%d", gdk_x11_screen_get_screen_number (screen)); if (ctx->workspace > -1) workspace_str = g_strdup_printf ("%d", ctx->workspace); else workspace_str = NULL; if (G_IS_DESKTOP_APP_INFO (info)) application_id = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info)); else application_id = NULL; startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu", g_get_prgname (), (unsigned long)getpid (), g_get_host_name (), binary_name, sequence++, (unsigned long)timestamp); gdk_x11_display_broadcast_startup_message (display, "new", "ID", startup_id, "NAME", g_app_info_get_name (info), "SCREEN", screen_str, "BIN", binary_name, "ICON", icon_name, "DESKTOP", workspace_str, "DESCRIPTION", description, "WMCLASS", NULL, /* FIXME */ "APPLICATION_ID", application_id, NULL); g_free (description); g_free (screen_str); g_free (workspace_str); g_free (icon_name); if (fileinfo) g_object_unref (fileinfo); add_startup_timeout (screen, startup_id); return startup_id; }
char * mpl_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context, GAppInfo *info, GList *files) { static int sequence = 0; #if 0 GdkAppLaunchContextPrivate *priv; #endif GdkDisplay *display; GdkScreen *screen; int files_count; char *description; char *icon_name; const char *binary_name; const char *application_id; char *screen_str; char *workspace_str; #if 0 GIcon *icon; #endif guint32 timestamp; char *startup_id; #if 0 priv = GDK_APP_LAUNCH_CONTEXT (context)->priv; if (priv->screen) { screen = priv->screen; display = gdk_screen_get_display (priv->screen); } else if (priv->display) { display = priv->display; screen = gdk_display_get_default_screen (display); } else { display = gdk_display_get_default (); screen = gdk_display_get_default_screen (display); } #else display = gdk_display_get_default (); screen = gdk_display_get_default_screen (display); #endif files_count = g_list_length (files); if (files_count == 0) description = g_strdup_printf (_("Starting %s"), g_app_info_get_name (info)); else if (files_count == 1) description = g_strdup_printf (_("Opening %s"), get_display_name (files->data)); else description = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "Opening %d Item", "Opening %d Items", files_count), files_count); icon_name = NULL; #if 0 if (priv->icon_name) icon_name = g_strdup (priv->icon_name); else { icon = NULL; if (priv->icon != NULL) icon = g_object_ref (priv->icon); else if (files_count == 1) icon = get_icon (files->data); if (icon == NULL) { icon = g_app_info_get_icon (info); g_object_ref (icon); } if (icon) icon_name = gicon_to_string (icon); g_object_unref (icon); } #endif binary_name = g_app_info_get_executable (info); #if 0 timestamp = priv->timestamp; if (timestamp == GDK_CURRENT_TIME) #endif timestamp = gdk_x11_display_get_user_time (display); screen_str = g_strdup_printf ("%d", gdk_screen_get_number (screen)); #if 0 if (priv->workspace > -1) workspace_str = g_strdup_printf ("%d", priv->workspace); else #endif workspace_str = NULL; if (G_IS_DESKTOP_APP_INFO (info)) application_id = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info)); else application_id = NULL; startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu", g_get_prgname (), (unsigned long)getpid (), g_get_host_name (), binary_name, sequence++, (unsigned long)timestamp); gdk_x11_display_broadcast_startup_message (display, "new", "ID", startup_id, "NAME", g_app_info_get_name (info), "SCREEN", screen_str, "BIN", binary_name, "ICON", icon_name, "DESKTOP", workspace_str, "DESCRIPTION", description, "WMCLASS", NULL, /* FIXME */ "APPLICATION_ID", application_id, NULL); g_free (description); g_free (screen_str); g_free (workspace_str); g_free (icon_name); add_startup_timeout (screen, startup_id); return startup_id; }
static void languages_parse_start_tag (GMarkupParseContext *ctx, const char *element_name, const char **attr_names, const char **attr_values, gpointer user_data, GError **error) { const char *ccode_longB; const char *ccode_longT; const char *ccode; const char *ccode_id; const char *lang_name; char *display_name; if (!(g_str_equal (element_name, "iso_639_entry") || g_str_equal (element_name, "iso_639_3_entry")) || attr_names == NULL || attr_values == NULL) return; ccode = NULL; ccode_longB = NULL; ccode_longT = NULL; ccode_id = NULL; lang_name = NULL; while (*attr_names && *attr_values) { if (g_str_equal (*attr_names, "iso_639_1_code")) { if (**attr_values) { if (strlen (*attr_values) != 2) return; ccode = *attr_values; } } else if (g_str_equal (*attr_names, "iso_639_2B_code")) { if (**attr_values) { if (strlen (*attr_values) != 3) return; ccode_longB = *attr_values; } } else if (g_str_equal (*attr_names, "iso_639_2T_code")) { if (**attr_values) { if (strlen (*attr_values) != 3) return; ccode_longT = *attr_values; } } else if (g_str_equal (*attr_names, "id")) { if (**attr_values) { if (strlen (*attr_values) != 2 && strlen (*attr_values) != 3) return; ccode_id = *attr_values; } } else if (g_str_equal (*attr_names, "name")) { lang_name = *attr_values; } ++attr_names; ++attr_values; } if (lang_name == NULL) return; display_name = get_display_name (lang_name); if (ccode != NULL) g_hash_table_insert (language_map, pango_language_from_string (ccode), g_strdup (display_name)); if (ccode_longB != NULL) g_hash_table_insert (language_map, pango_language_from_string (ccode_longB), g_strdup (display_name)); if (ccode_longT != NULL) g_hash_table_insert (language_map, pango_language_from_string (ccode_longT), g_strdup (display_name)); if (ccode_id != NULL) g_hash_table_insert (language_map, pango_language_from_string (ccode_id), g_strdup (display_name)); g_free (display_name); }
void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from, gboolean me,LinphoneChatRoom *cr,LinphoneChatMessage *msg, gboolean hist){ GtkTextView *text=GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textview")); GtkTextBuffer *buffer=gtk_text_view_get_buffer(text); GtkTextIter iter,begin; int off; char *from_str=linphone_address_as_string_uri_only(from); gchar *from_message=(gchar *)g_object_get_data(G_OBJECT(w),"from_message"); GHashTable *table=(GHashTable*)g_object_get_data(G_OBJECT(w),"table"); time_t t; char buf[80]; time_t tnow; struct tm *tm; int tnow_day; int tnow_year; gtk_text_buffer_get_start_iter(buffer,&begin); gtk_text_buffer_get_end_iter(buffer,&iter); off=gtk_text_iter_get_offset(&iter); if(g_strcmp0(from_message,from_str)!=0){ gtk_text_buffer_get_iter_at_offset(buffer,&iter,off); gtk_text_buffer_get_end_iter(buffer,&iter); gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,get_display_name(from),-1,"bold",me ? "bg":NULL,NULL); gtk_text_buffer_get_end_iter(buffer,&iter); gtk_text_buffer_insert_with_tags_by_name(buffer,&iter," : ",-1,"bold",me ? "bg":NULL,NULL); gtk_text_buffer_get_end_iter(buffer,&iter); gtk_text_buffer_insert(buffer,&iter,"\n",-1); g_free(from_message); g_object_set_data(G_OBJECT(w),"from_message",g_strdup(from_str)); } gtk_text_buffer_get_end_iter(buffer,&iter); gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,linphone_chat_message_get_text(msg),-1,"margin",me ? "bg":NULL,NULL); gtk_text_buffer_get_end_iter(buffer,&iter); gtk_text_buffer_insert(buffer,&iter,"\n",-1); gtk_text_buffer_get_end_iter(buffer,&iter); t=linphone_chat_message_get_time(msg); switch (linphone_chat_message_get_state (msg)){ case LinphoneChatMessageStateInProgress: { g_hash_table_insert(table,(gpointer)msg,GINT_TO_POINTER(gtk_text_iter_get_line(&iter))); gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Sending ..",-1, "right","small","italic","font_grey","bg",NULL); g_object_set_data(G_OBJECT(w),"table",table); break; } case LinphoneChatMessageStateDelivered: { tnow=time(NULL); tm=localtime(&tnow); tnow_day=tm->tm_yday; tnow_year=tm->tm_year; tm=localtime(&t); if(tnow_day != tm->tm_yday || (tnow_day == tm->tm_yday && tnow_year != tm->tm_year)) { strftime(buf,80,"%a %x, %H:%M",tm); } else { strftime(buf,80,"%H:%M",tm); } gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,buf,-1, "right","small","italic","font_grey",me ? "bg":NULL,NULL); break; } case LinphoneChatMessageStateNotDelivered: gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Message not sent",-1, "right","small","italic","font_grey",me ? "bg":NULL,NULL); break; default : gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Sending ..",-1, "right","small","italic","font_grey",me ? "bg":NULL,NULL); } gtk_text_buffer_get_end_iter(buffer,&iter); gtk_text_buffer_insert(buffer,&iter,"\n",-1); g_idle_add((GSourceFunc)scroll_to_end,text); ms_free(from_str); }
static gboolean repair_dialog_on_idle_update(GtkDialog* dialog) { GtkTreeIter iter; GtkTreeIter* parent_iter; char* name; char* display_name; char* new_name; GFile* file; GFileType ftype; UpdateContext* context; gint n; int i; context = repair_dialog_get_update_context(dialog); if (context == NULL) { return FALSE; } for (i = 0; i < 500; i++) { if (context->file_stack == NULL) { repair_dialog_set_update_context(dialog, NULL); repair_dialog_on_update_end(dialog, context->success_all); update_context_free(context); return FALSE; } file = context->file_stack->data; if (context->enum_stack != NULL) { GFileInfo* info; GFileEnumerator* e; parent_iter = context->iter_stack->data; e = context->enum_stack->data; info = g_file_enumerator_next_file(e, NULL, NULL); if (info != NULL) { const char* name_const; name_const = g_file_info_get_name(info); display_name = get_display_name(name_const); new_name = get_new_name(name_const, context->encoding); file_list_model_append(context->store, &iter, parent_iter, NULL, name_const, display_name, new_name); if (new_name == NULL) context->success_all = FALSE; ftype = g_file_info_get_file_type(info); if (ftype == G_FILE_TYPE_DIRECTORY) { GFile* child; GFileEnumerator* child_e; GtkTreeIter* tmp_iter; tmp_iter = gtk_tree_iter_copy(&iter); child = g_file_get_child(file, name_const); child_e = g_file_enumerate_children(child, G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); update_context_push(context, child, tmp_iter, child_e); } g_object_unref(info); g_free(display_name); g_free(new_name); n = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(context->store), parent_iter); if (n == 1) { GtkTreePath* path; path = gtk_tree_model_get_path(GTK_TREE_MODEL(context->store), parent_iter); gtk_tree_view_expand_row(context->treeview, path, FALSE); gtk_tree_path_free(path); } } else { g_object_unref(file); gtk_tree_iter_free(parent_iter); g_object_unref(e); update_context_pop(context); } } else { context->file_stack = g_slist_delete_link(context->file_stack, context->file_stack); name = g_file_get_basename(file); display_name = get_display_name(name); new_name = get_new_name(name, context->encoding); file_list_model_append(context->store, &iter, NULL, file, name, display_name, new_name); if (new_name == NULL) context->success_all = FALSE; if (context->include_subdir) { ftype = g_file_query_file_type(file, G_FILE_QUERY_INFO_NONE, NULL); if (ftype == G_FILE_TYPE_DIRECTORY) { GtkTreeIter* tmp_iter; GFileEnumerator* e; tmp_iter = gtk_tree_iter_copy(&iter); e = g_file_enumerate_children(file, G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); update_context_push(context, file, tmp_iter, e); } } g_free(name); g_free(display_name); g_free(new_name); } } return TRUE; }
LIBMTP_track_t * mtp_track_new_from_pragha_musicobject (LIBMTP_mtpdevice_t *mtp_device, PraghaMusicobject *mobj) { LIBMTP_track_t *tr; LIBMTP_filetype_t filetype; gchar *filename; const gchar *mime_type; struct stat sbuf; mime_type = pragha_musicobject_get_mime_type (mobj); if (is_valid_mime(mime_type, mime_flac)) filetype = LIBMTP_FILETYPE_FLAC; else if (is_valid_mime(mime_type, mime_mpeg)) filetype = LIBMTP_FILETYPE_MP3; else if (is_valid_mime(mime_type, mime_ogg)) filetype = LIBMTP_FILETYPE_OGG; else if (is_valid_mime(mime_type, mime_wav)) filetype = LIBMTP_FILETYPE_WAV; else if (is_valid_mime(mime_type, mime_asf)) filetype = LIBMTP_FILETYPE_WMA; else if (is_valid_mime(mime_type, mime_mp4)) filetype = LIBMTP_FILETYPE_MP4; else filetype = LIBMTP_FILETYPE_UNKNOWN; if (filetype == LIBMTP_FILETYPE_UNKNOWN) return NULL; filename = g_strdup(pragha_musicobject_get_file(mobj)); if (g_stat(filename, &sbuf) == -1) { g_free(filename); return NULL; } tr = LIBMTP_new_track_t(); /* Minimun data. */ tr->filesize = (uint64_t) sbuf.st_size; tr->filename = get_display_name(mobj); tr->filetype = filetype; /* Metadata. */ tr->title = g_strdup(pragha_musicobject_get_title(mobj)); tr->artist = g_strdup(pragha_musicobject_get_artist(mobj)); tr->album = g_strdup(pragha_musicobject_get_album(mobj)); tr->duration = (1000 * pragha_musicobject_get_length(mobj)); tr->genre = g_strdup(pragha_musicobject_get_genre (mobj)); tr->date = g_strdup_printf("%d", pragha_musicobject_get_year (mobj)); /* Storage data. */ tr->parent_id = mtp_device->default_music_folder; tr->storage_id = 0; g_free(filename); return tr; }
static void repair_dialog_update_file_list_model(GtkDialog* dialog, gboolean async) { GtkTreeStore* store; GtkTreeView* treeview; GSList* files; gboolean include_subdir; GtkComboBox* combobox; UpdateContext* context; gboolean success_all = TRUE; store = repair_dialog_get_file_list_model(dialog); files = repair_dialog_get_file_list(dialog); treeview = repair_dialog_get_file_list_view(dialog); include_subdir = repair_dialog_get_include_subdir_flag(dialog); combobox = repair_dialog_get_encoding_combo_box(dialog); gtk_widget_set_sensitive(GTK_WIDGET(combobox), FALSE); gtk_tree_store_clear(store); if (async) { context = repair_dialog_get_update_context(dialog); if (context != NULL) { g_idle_remove_by_data(dialog); update_context_free(context); } context = update_context_new(); context->dialog = dialog; context->treeview = treeview; context->store = store; context->file_stack = g_slist_copy(files); context->encoding = repair_dialog_get_current_encoding(dialog); context->include_subdir = include_subdir; g_slist_foreach(context->file_stack, (GFunc)g_object_ref, NULL); repair_dialog_set_update_context(dialog, context); g_idle_add((GSourceFunc)repair_dialog_on_idle_update, dialog); } else { char* encoding = repair_dialog_get_current_encoding(dialog); while (files != NULL) { GtkTreeIter iter; char* name; char* display_name; char* new_name; GFile* file; file = files->data; name = g_file_get_basename(file); display_name = get_display_name(name); new_name = get_new_name(name, encoding); file_list_model_append(store, &iter, NULL, file, name, display_name, new_name); if (new_name == NULL) success_all = FALSE; if (include_subdir) { GFileType file_type; file_type = g_file_query_file_type(file, G_FILE_QUERY_INFO_NONE, NULL); if (file_type == G_FILE_TYPE_DIRECTORY) { gboolean res; res = append_dir(store, &iter, file, encoding); if (!res) success_all = FALSE; } } g_free(name); g_free(display_name); g_free(new_name); files = g_slist_next(files); } gtk_tree_view_expand_all(treeview); g_free(encoding); repair_dialog_on_update_end(dialog, success_all); } }
GtkWidget *create_tab_chat_header(LinphoneChatRoom *cr,const LinphoneAddress *uri){ GtkWidget *tab_header = linphone_gtk_make_tab_header(get_display_name(uri), "linphone-start-chat", TRUE, G_CALLBACK(linphone_gtk_quit_chatroom), cr); gtk_widget_show_all(tab_header); return tab_header; }
void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from, gboolean me,LinphoneChatRoom *cr,LinphoneChatMessage *msg, gboolean hist){ GtkTextView *text=GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textview")); GtkTextBuffer *buffer=gtk_text_view_get_buffer(text); GtkTextIter iter; char *from_str=linphone_address_as_string_uri_only(from); gchar *from_message=(gchar *)g_object_get_data(G_OBJECT(w),"from_message"); GHashTable *table=(GHashTable*)g_object_get_data(G_OBJECT(w),"table"); const GRegex *uri_regex = get_uri_regex(); GMatchInfo *match_info = NULL; const char *message = linphone_chat_message_get_text(msg); time_t t; char buf[80]; time_t tnow; struct tm *tm; int tnow_day; int tnow_year; int pos = 0, start, end; gtk_text_buffer_get_end_iter(buffer, &iter); if (g_strcmp0(from_message,from_str)!=0){ gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, get_display_name(from), -1, "from", me ? "me" : NULL, NULL); gtk_text_buffer_insert_with_tags_by_name(buffer,&iter, " : ", -1, "from", me ? "me" : NULL, NULL); gtk_text_buffer_insert(buffer,&iter,"\n",-1); g_free(from_message); g_object_set_data(G_OBJECT(w),"from_message",g_strdup(from_str)); } ms_free(from_str); // Inserts message body and tags URIs as hypertext links if(message) { g_regex_match(uri_regex, message, 0, &match_info); while(g_match_info_matches(match_info)) { g_match_info_fetch_pos(match_info, 0, &start, &end); if(pos < start) write_body(buffer, &iter, &message[pos], start-pos, me, FALSE); write_body(buffer, &iter, &message[start], end-start, me, TRUE); pos = end; g_match_info_next(match_info, NULL); } if(pos < strlen(message)) write_body(buffer, &iter, &message[pos], -1, me, FALSE); gtk_text_buffer_insert(buffer,&iter,"\n",-1); g_match_info_free(match_info); } t=linphone_chat_message_get_time(msg); switch (linphone_chat_message_get_state (msg)){ case LinphoneChatMessageStateInProgress: g_hash_table_insert(table,(gpointer)msg,GINT_TO_POINTER(gtk_text_iter_get_line(&iter))); gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Sending ..",-1, "status", me ? "me" : NULL, NULL); //g_object_set_data(G_OBJECT(w),"table",table); break; case LinphoneChatMessageStateDelivered: tnow=time(NULL); tm=localtime(&tnow); tnow_day=tm->tm_yday; tnow_year=tm->tm_year; tm=localtime(&t); if(tnow_day != tm->tm_yday || (tnow_day == tm->tm_yday && tnow_year != tm->tm_year)) { strftime(buf,80,"%a %x, %H:%M",tm); } else { strftime(buf,80,"%H:%M",tm); } gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,buf,-1, "status", me ? "me" : NULL, NULL); break; case LinphoneChatMessageStateNotDelivered: gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Message not sent",-1, "status", me ? "me" : NULL, NULL); break; default : gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Sending ..",-1, "status", me ? "me" : NULL, NULL); } gtk_text_buffer_insert(buffer,&iter,"\n",-1); g_idle_add((GSourceFunc)scroll_to_end,text); }
QString toString(const fc::ecc::public_key& pk, TContactTextFormatting contactFormatting, bts::addressbook::contact* matchingContact /*= nullptr*/, bool* isKnownContact /*= nullptr*/) { assert(pk.valid()); auto address_book = bts::get_profile()->get_addressbook(); auto c = address_book->get_contact_by_public_key(pk); if (c) { if(matchingContact != nullptr) *matchingContact = *c; if(isKnownContact != nullptr) *isKnownContact = true; switch(contactFormatting) { case KEYHOTEE_IDENTIFIER: return QString(c->dac_id_string.c_str()); case CONTACT_ALIAS_FULL_NAME: return QString(std::string(c->first_name + " " + c->last_name).c_str()); case FULL_CONTACT_DETAILS: return QString(c->get_display_name().c_str()); default: assert(false); return QString(); } } else { auto profile = bts::get_profile(); /// If no contact found try one of registered identities. std::vector<bts::addressbook::wallet_identity> identities = profile->identities(); for(const auto& identity : identities) { assert(identity.public_key.valid()); if(identity.public_key == pk) { if(matchingContact != nullptr) *matchingContact = identity; if(isKnownContact != nullptr) *isKnownContact = true; switch(contactFormatting) { case KEYHOTEE_IDENTIFIER: return QString::fromStdString(identity.dac_id_string); case CONTACT_ALIAS_FULL_NAME: return QString::fromStdString(std::string(identity.first_name + " " + identity.last_name)); case FULL_CONTACT_DETAILS: return QString::fromStdString(identity.get_display_name()); default: assert(false); return QString(); } break; } } if(matchingContact != nullptr) { *matchingContact = bts::addressbook::wallet_contact(); matchingContact->public_key = pk; } if(isKnownContact != nullptr) *isKnownContact = false; /// If code reached this point the publick key is unknown - lets display it as base58 return QString::fromStdString(pk.to_base58()); } }
/** * \brief Initialize w32_common framework. * * The first function that should be called from the w32_common framework. * It handles window creation on the screen with proper title and attributes. * It also initializes the framework's internal variables. The function should * be called after your own preinit initialization and you shouldn't do any * window management on your own. * * Global libvo variables changed: * vo_w32_window * vo_screenwidth * vo_screenheight * * \return 1 = Success, 0 = Failure */ int vo_w32_init(void) { PIXELFORMATDESCRIPTOR pfd; HDC vo_hdc; int pf; char exedir[MAX_PATH]; HINSTANCE user32; HICON mplayerIcon = NULL; HICON mplayerSmallIcon = NULL; char *dev; if (vo_window) return 1; hInstance = GetModuleHandle(NULL); mplayerIcon = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_APPICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); mplayerSmallIcon = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_APPICON), IMAGE_ICON, 16, 16, LR_SHARED); { WNDCLASSEX wcex = { sizeof wcex, CS_OWNDC | CS_DBLCLKS, WndProc, 0, 0, hInstance, mplayerIcon, LoadCursor(0, IDC_ARROW), NULL, 0, classname, mplayerSmallIcon }; if (!RegisterClassEx(&wcex)) { mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to register window class!\n"); return 0; } } if (WinID >= 0) { RECT r; GetClientRect(WinID, &r); vo_dwidth = r.right; vo_dheight = r.bottom; vo_window = CreateWindowEx(WS_EX_NOPARENTNOTIFY, classname, classname, WS_CHILD | WS_VISIBLE, 0, 0, vo_dwidth, vo_dheight, WinID, 0, hInstance, 0); EnableWindow(vo_window, 0); } else vo_window = CreateWindowEx(0, classname, classname, vo_border ? (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP, CW_USEDEFAULT, 0, 100, 100, 0, 0, hInstance, 0); if (!vo_window) { mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to create window!\n"); return 0; } myMonitorFromWindow = NULL; myGetMonitorInfo = NULL; myEnumDisplayMonitors = NULL; user32 = GetModuleHandle("user32.dll"); if (user32) { myMonitorFromWindow = (void *)GetProcAddress(user32, "MonitorFromWindow"); myGetMonitorInfo = GetProcAddress(user32, "GetMonitorInfoA"); myEnumDisplayMonitors = GetProcAddress(user32, "EnumDisplayMonitors"); } dev_hdc = 0; dev = get_display_name(); if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL); updateScreenProperties(); vo_hdc = vo_w32_get_dc(vo_window); memset(&pfd, 0, sizeof pfd); pfd.nSize = sizeof pfd; pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 24; pfd.iLayerType = PFD_MAIN_PLANE; pf = ChoosePixelFormat(vo_hdc, &pfd); if (!pf) { mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to select a valid pixel format!\n"); vo_w32_release_dc(vo_window, vo_hdc); return 0; } SetPixelFormat(vo_hdc, pf, &pfd); vo_w32_release_dc(vo_window, vo_hdc); mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, depthonscreen); return 1; }