void cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf, void* data) { g_return_if_fail(page != NULL); g_return_if_fail(pixbuf != NULL); g_return_if_fail(data != NULL); zathura_t* zathura = data; GdkAtom* selection = get_selection(zathura); if (selection != NULL) { gtk_clipboard_set_image(gtk_clipboard_get(*selection), pixbuf); bool notification = true; girara_setting_get(zathura->ui.session, "selection-notification", ¬ification); if (notification == true) { char* target = NULL; girara_setting_get(zathura->ui.session, "selection-clipboard", &target); char* escaped_text = g_markup_printf_escaped( _("Copied selected image to selection %s"), target); g_free(target); girara_notify(zathura->ui.session, GIRARA_INFO, "%s", escaped_text); } g_free(selection); } }
void ZLGtkDialogManager::setClipboardImage(const ZLImageData &image, ClipboardType type) const { GdkPixbuf *imageRef = ((const ZLGtkImageData&)image).pixbuf(); if (imageRef != 0) { GdkAtom atom = (type == CLIPBOARD_MAIN) ? GDK_SELECTION_CLIPBOARD : GDK_SELECTION_PRIMARY; GtkClipboard *clipboard = gtk_clipboard_get(atom); gtk_clipboard_set_image(clipboard, imageRef); } }
static void screenshot_save_to_clipboard (void) { GtkClipboard *clipboard; clipboard = gtk_clipboard_get_for_display (gdk_display_get_default (), GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_image (clipboard, screenshot); }
static void screenshot_save_to_clipboard (ScreenshotApplication *self) { GtkClipboard *clipboard; clipboard = gtk_clipboard_get_for_display (gdk_display_get_default (), GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_image (clipboard, self->priv->screenshot); }
TILP_EXPORT void on_scdbox_button5_clicked(GtkButton * button, gpointer user_data) { GdkPixbuf *pixbuf; GtkClipboard *clipboard; pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(scrn_img)); clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_image(clipboard, pixbuf); }
void iscreenshot_save_to_clipboard(GtkWidget *widget,GdkPixbuf *pixbuf) { GtkClipboard *clip; clip=gtk_clipboard_get(gdk_atom_intern_static_string("CLIPBOARD")); gtk_clipboard_clear(clip); gtk_clipboard_set_image(clip,pixbuf); gtk_main_quit(); }
int main(int argc, char **argv) { int ret = EXIT_FAILURE; GtkClipboard *cb = NULL; GdkPixbuf *image = NULL; GError *e = NULL; GOptionContext *opt_ctx = NULL; char *help = NULL; static int timeout; static const GOptionEntry entries[] = { { "timeout", 't', 0, G_OPTION_ARG_INT, &timeout, "Timeout", "secs" }, { NULL, 0, 0, 0, NULL, NULL, NULL } }; opt_ctx = g_option_context_new("<file>"); g_option_context_add_main_entries(opt_ctx, entries, NULL); if (!g_option_context_parse(opt_ctx, &argc, &argv, &e)) { fprintf(stderr, "%s\n", e->message); goto error_out; } if (argc == 1 || !g_file_test(argv[1], G_FILE_TEST_EXISTS)) { help = g_option_context_get_help(opt_ctx, TRUE, NULL); fprintf(stderr, "%s", help); g_free(help); goto error_out; } image = gdk_pixbuf_new_from_file(argv[1], &e); if (image == NULL) { fprintf(stderr, "%s\n", e->message); goto error_out; } gtk_init(&argc, &argv); cb = gtk_clipboard_get(GDK_NONE); gtk_clipboard_set_image(cb, image); g_signal_connect(G_OBJECT(cb), "owner-change", G_CALLBACK(on_owner_change), NULL); if (timeout > 0) { g_timeout_add_seconds(timeout, (GSourceFunc)on_timeout_expired, NULL); } gtk_main(); g_object_unref(image); ret = EXIT_SUCCESS; error_out: g_option_context_free(opt_ctx); return ret; }
void GtkClipboard_::set_image(Php::Parameters ¶meters) { GdkPixbuf *pixbuf; if(parameters.size() > 0) { Php::Value object_pixbuf = parameters[0]; GdkPixbuf_ *phpgtk_pixbuf = (GdkPixbuf_ *)object_pixbuf.implementation(); pixbuf = phpgtk_pixbuf->get_instance(); } gtk_clipboard_set_image (GTK_CLIPBOARD(instance), pixbuf); }
static void copy_image (GtkMenuItem *item, gpointer data) { GtkClipboard *clipboard; GdkPixbuf *pixbuf; clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); pixbuf = get_image_pixbuf (GTK_IMAGE (data)); gtk_clipboard_set_image (clipboard, pixbuf); g_object_unref (pixbuf); }
static void _g_paste_clipboard_select_image (GPasteClipboard *self, GdkPixbuf *image, const gchar *checksum) { g_return_if_fail (G_PASTE_IS_CLIPBOARD (self)); g_return_if_fail (image != NULL); GtkClipboard *real = self->priv->real; g_paste_clipboard_set_image_checksum (self, checksum); gtk_clipboard_set_image (real, image); //gtk_clipboard_store (real); }
void Pasteboard::writeImage(Node* node, const KURL&, const String&) { GtkClipboard* clipboard = gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD); ASSERT(node && node->renderer() && node->renderer()->isImage()); RenderImage* renderer = static_cast<RenderImage*>(node->renderer()); CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage()); ASSERT(cachedImage); Image* image = cachedImage->image(); ASSERT(image); GdkPixbuf* pixbuf = image->getGdkPixbuf(); gtk_clipboard_set_image(clipboard, pixbuf); g_object_unref(pixbuf); }
void glide_window_cut_action_activate (GtkAction *a, gpointer user_data) { GlideWindow *w = (GlideWindow *)user_data; GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); GlideActor *selection = glide_stage_manager_get_selection (w->priv->manager); if (!selection) { return; } if (GLIDE_IS_TEXT (selection)) { if (glide_text_get_editable (GLIDE_TEXT (selection))) { gchar *t = glide_text_get_selection (GLIDE_TEXT (selection)); gtk_clipboard_set_text (clipboard, t, -1); g_free (t); glide_text_delete_selection (GLIDE_TEXT (selection)); } else { gtk_clipboard_set_text (clipboard, glide_text_get_text (GLIDE_TEXT (selection)), -1); glide_window_set_copy_buffer (w, selection); glide_stage_manager_delete_selection (w->priv->manager); } } else if (GLIDE_IS_IMAGE (selection)) { GdkPixbuf *pbuf; const gchar *filename = glide_image_get_filename (GLIDE_IMAGE (selection)); // TODO: Error checking pbuf = gdk_pixbuf_new_from_file (filename, NULL); gtk_clipboard_set_image (clipboard, pbuf); g_object_unref (G_OBJECT (pbuf)); glide_window_set_copy_buffer (w, selection); glide_stage_manager_delete_selection (w->priv->manager); } }
void cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf, void* data) { g_return_if_fail(page != NULL); g_return_if_fail(pixbuf != NULL); g_return_if_fail(data != NULL); zathura_t* zathura = data; GdkAtom* selection = get_selection(zathura); if (selection != NULL) { gtk_clipboard_set_image(gtk_clipboard_get(*selection), pixbuf); } g_free(selection); }
void remmina_rdp_cliprdr_set_clipboard_content(RemminaProtocolWidget* gp, RemminaPluginRdpUiObject* ui) { TRACE_CALL(__func__); GtkClipboard* gtkClipboard; rfContext* rfi = GET_PLUGIN_DATA(gp); gtkClipboard = gtk_widget_get_clipboard(rfi->drawing_area, GDK_SELECTION_CLIPBOARD); if (ui->clipboard.format == CB_FORMAT_PNG || ui->clipboard.format == CF_DIB || ui->clipboard.format == CF_DIBV5 || ui->clipboard.format == CB_FORMAT_JPEG) { gtk_clipboard_set_image( gtkClipboard, ui->clipboard.data ); g_object_unref(ui->clipboard.data); }else { gtk_clipboard_set_text( gtkClipboard, ui->clipboard.data, -1 ); free(ui->clipboard.data); } }
static void take_screenshot () { GdkRectangle *rectangle; GdkPixbuf *screenshot; GtkClipboard *clipboard; rectangle = select_area (); if (rectangle == NULL) return; screenshot = get_screenshot_rectangle (rectangle); clipboard = gtk_clipboard_get (gdk_atom_intern ("CLIPBOARD", FALSE)); gtk_clipboard_set_image (clipboard, screenshot); }
static void gwy_graph_window_copy_to_clipboard(GwyGraphWindow *graph_window) { GtkClipboard *clipboard; GdkDisplay *display; GdkPixbuf *pixbuf; GdkAtom atom; display = gtk_widget_get_display(GTK_WIDGET(graph_window)); atom = gdk_atom_intern("CLIPBOARD", FALSE); clipboard = gtk_clipboard_get_for_display(display, atom); pixbuf = gwy_graph_export_pixmap(GWY_GRAPH(graph_window->graph), FALSE, TRUE, TRUE); gtk_clipboard_set_image(clipboard, pixbuf); g_object_unref(pixbuf); }
void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame*) { CachedImage* cachedImage = getCachedImage(element); if (!cachedImage || !cachedImage->isLoaded()) return; GdkPixbuf* pixbuf = cachedImage->image()->getGdkPixbuf(); if (!pixbuf) return; GtkClipboard* imageClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardImage")); gtk_clipboard_clear(imageClipboard); gtk_clipboard_set_image(imageClipboard, pixbuf); g_object_unref(pixbuf); writeURL(url, label, 0); }
static void screenshot_dialog_response_cb (GtkDialog *d, gint response_id, ScreenshotDialog *dialog) { char *uri; if (response_id == GTK_RESPONSE_HELP) { display_help (GTK_WINDOW (d)); } else if (response_id == GTK_RESPONSE_OK) { uri = screenshot_dialog_get_uri (dialog); if (temporary_file == NULL) { save_immediately = TRUE; screenshot_dialog_set_busy (dialog, TRUE); } else { /* we've saved the temporary file, lets try to copy it to the * correct location. */ try_to_save (dialog, uri); } g_free (uri); } else if (response_id == SCREENSHOT_RESPONSE_COPY) { GtkClipboard *clipboard; GdkPixbuf *screenshot; clipboard = gtk_clipboard_get_for_display (gtk_widget_get_display (GTK_WIDGET (d)), GDK_SELECTION_CLIPBOARD); screenshot = screenshot_dialog_get_screenshot (dialog); gtk_clipboard_set_image (clipboard, screenshot); } else /* dialog was canceled */ { gtk_widget_destroy (GTK_WIDGET (d)); gtk_main_quit (); } }
static VALUE rg_set_image(VALUE self, VALUE pixbuf) { gtk_clipboard_set_image(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(pixbuf))); return self; }