Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: tools/gtk_clipboard_dump/gtk_clipboard_dump.cc

Issue 42592: Linux: write images to clipboard.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 /* Small program to dump the contents of GTK's clipboard to the terminal. 9 /* Small program to dump the contents of GTK's clipboard to the terminal.
10 * Feel free to add to it or improve formatting or whatnot. 10 * Feel free to add to it or improve formatting or whatnot.
(...skipping 12 matching lines...) Expand all
23 23
24 for (int i = 0; i < num_targets; i++) { 24 for (int i = 0; i < num_targets; i++) {
25 printf(" [format: %s", gdk_atom_name(targets[i])); 25 printf(" [format: %s", gdk_atom_name(targets[i]));
26 GtkSelectionData* data = gtk_clipboard_wait_for_contents(clip, targets[i]); 26 GtkSelectionData* data = gtk_clipboard_wait_for_contents(clip, targets[i]);
27 if (!data) { 27 if (!data) {
28 printf("]: NULL\n\n"); 28 printf("]: NULL\n\n");
29 continue; 29 continue;
30 } 30 }
31 31
32 printf(" / length: %d / bits %d]: ", data->length, data->format); 32 printf(" / length: %d / bits %d]: ", data->length, data->format);
33
34 if (strstr(gdk_atom_name(targets[i]), "image")) {
35 printf("(image omitted)\n\n");
36 continue;
37 }
38
33 for (int j = 0; j < data->length; j++) { 39 for (int j = 0; j < data->length; j++) {
34 // Output data one byte at a time. Currently wide strings look 40 // Output data one byte at a time. Currently wide strings look
35 // pretty weird. 41 // pretty weird.
36 printf("%c", (data->data[j] == 0 ? '_' : data->data[j])); 42 printf("%c", (data->data[j] == 0 ? '_' : data->data[j]));
37 } 43 }
38 printf("\n\n"); 44 printf("\n\n");
39 } 45 }
40 } 46 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | webkit/glue/webclipboard_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698