Commit 20612e428d968635600c32f3701a556947746661
1 parent
e0f66cff
Exists in
master
and in
1 other branch
Allowing image formats on clipboard.
Showing
5 changed files
with
40 additions
and
3 deletions
Show diff stats
src/dialogs/settings/clipboard.c
... | ... | @@ -163,11 +163,22 @@ |
163 | 163 | .label = N_("Smart copy"), |
164 | 164 | .tooltip = N_("When set the first copy operation after the selection will set the clipboard contents and the next ones will append"), |
165 | 165 | .left = 1, |
166 | + .top = 4, | |
167 | + .width = 1, | |
168 | + .height = 1, | |
169 | + .grid = COPY_SETTINGS | |
170 | + }, | |
171 | + | |
172 | + { | |
173 | + .label = N_("Image copy"), | |
174 | + .tooltip = N_("When set allow image formats on clipboard"), | |
175 | + .left = 1, | |
166 | 176 | .top = 3, |
167 | 177 | .width = 1, |
168 | 178 | .height = 1, |
169 | 179 | .grid = COPY_SETTINGS |
170 | 180 | } |
181 | + | |
171 | 182 | }; |
172 | 183 | |
173 | 184 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
... | ... | @@ -472,6 +483,7 @@ static void load(GtkWidget *w, GtkWidget *t) { |
472 | 483 | gtk_toggle_button_set_active(widget->input.checkboxes[0],(terminal->selection.options & V3270_SELECTION_NON_BREAKABLE_SPACE) != 0); |
473 | 484 | gtk_toggle_button_set_active(widget->input.checkboxes[1],(terminal->selection.options & V3270_SELECTION_SCREEN_PASTE) != 0); |
474 | 485 | gtk_toggle_button_set_active(widget->input.checkboxes[2],(terminal->selection.options & V3270_SELECTION_SMART_COPY) != 0); |
486 | + gtk_toggle_button_set_active(widget->input.checkboxes[3],(terminal->selection.options & V3270_SELECTION_PIXBUFF) != 0); | |
475 | 487 | |
476 | 488 | // |
477 | 489 | // Set font combo-box |
... | ... | @@ -559,6 +571,12 @@ static void apply(GtkWidget *w, GtkWidget *t) { |
559 | 571 | terminal->selection.options &= ~V3270_SELECTION_SMART_COPY; |
560 | 572 | } |
561 | 573 | |
574 | + if(gtk_toggle_button_get_active(widget->input.checkboxes[3])) { | |
575 | + terminal->selection.options |= V3270_SELECTION_PIXBUFF; | |
576 | + } else { | |
577 | + terminal->selection.options &= ~V3270_SELECTION_PIXBUFF; | |
578 | + } | |
579 | + | |
562 | 580 | // Get font settings |
563 | 581 | switch(get_active_id(widget,0)) { |
564 | 582 | case '0': | ... | ... |
src/include/clipboard.h
src/include/terminal.h
... | ... | @@ -127,6 +127,7 @@ G_BEGIN_DECLS |
127 | 127 | V3270_SELECTION_SCREEN_PASTE = 0x08, ///< @brief Enable screen paste. |
128 | 128 | V3270_SELECTION_SMART_COPY = 0x10, ///< @brief Enable copy/append based on current selection state. |
129 | 129 | V3270_SELECTION_DIALOG_STATE = 0x20, ///< @brief Used for settings dialog. |
130 | + V3270_SELECTION_PIXBUFF = 0x40, ///< @brief Allow pixbuf formats. | |
130 | 131 | |
131 | 132 | } V3270SelectionOption; |
132 | 133 | ... | ... |
src/selection/linux/copy.c
... | ... | @@ -104,6 +104,20 @@ static void clipboard_get(G_GNUC_UNUSED GtkClipboard *clipboard, GtkSelectionDa |
104 | 104 | } |
105 | 105 | break; |
106 | 106 | |
107 | + case CLIPBOARD_TYPE_PIXBUFF: | |
108 | + { | |
109 | + GdkPixbuf * pixbuff = v3270_get_selection_as_pixbuf(terminal, terminal->selection.blocks, FALSE); | |
110 | + | |
111 | + debug("%s: pixbuff=%p (blocks=%p)",__FUNCTION__,pixbuff,terminal->selection.blocks); | |
112 | + | |
113 | + if(pixbuff) | |
114 | + { | |
115 | + gtk_selection_data_set_pixbuf(selection,pixbuff); | |
116 | + g_object_unref(pixbuff); | |
117 | + } | |
118 | + } | |
119 | + break; | |
120 | + | |
107 | 121 | default: |
108 | 122 | g_warning("Unexpected clipboard type %d\n",target); |
109 | 123 | } |
... | ... | @@ -143,6 +157,11 @@ void v3270_update_system_clipboard(GtkWidget *widget) |
143 | 157 | |
144 | 158 | } |
145 | 159 | |
160 | + if(terminal->selection.options & V3270_SELECTION_PIXBUFF) | |
161 | + { | |
162 | + gtk_target_list_add_image_targets(list,CLIPBOARD_TYPE_PIXBUFF,TRUE); | |
163 | + } | |
164 | + | |
146 | 165 | int n_targets; |
147 | 166 | GtkTargetEntry * targets = gtk_target_table_new_from_list(list, &n_targets); |
148 | 167 | ... | ... |
v3270.cbp
... | ... | @@ -6,7 +6,6 @@ |
6 | 6 | <Option makefile_is_custom="1" /> |
7 | 7 | <Option pch_mode="2" /> |
8 | 8 | <Option compiler="gcc" /> |
9 | - <Option virtualFolders="src/selection/" /> | |
10 | 9 | <Build> |
11 | 10 | <Target title="Debug"> |
12 | 11 | <Option output=".bin/Debug/libv3270" prefix_auto="1" extension_auto="1" /> |
... | ... | @@ -214,7 +213,6 @@ |
214 | 213 | </Unit> |
215 | 214 | <Unit filename="src/selection/linux/copy.c"> |
216 | 215 | <Option compilerVar="CC" /> |
217 | - <Option virtualFolder="src/selection/" /> | |
218 | 216 | </Unit> |
219 | 217 | <Unit filename="src/selection/linux/paste.c"> |
220 | 218 | <Option compilerVar="CC" /> | ... | ... |