fixes crash when trying to copy image
This commit is contained in:
@@ -28,7 +28,7 @@ private abstract class BubbleLayout : Object, ChatItemLayout
|
|||||||
public bool from_me { get; set; }
|
public bool from_me { get; set; }
|
||||||
public float vertical_padding { get; set; }
|
public float vertical_padding { get; set; }
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
|
|
||||||
protected float max_width;
|
protected float max_width;
|
||||||
protected Widget parent;
|
protected Widget parent;
|
||||||
protected BubbleLayoutConstants constants;
|
protected BubbleLayoutConstants constants;
|
||||||
@@ -63,6 +63,8 @@ private abstract class BubbleLayout : Object, ChatItemLayout
|
|||||||
|
|
||||||
public abstract void draw_content(Snapshot snapshot);
|
public abstract void draw_content(Snapshot snapshot);
|
||||||
|
|
||||||
|
public abstract void copy(Gdk.Clipboard clipboard);
|
||||||
|
|
||||||
private void draw_background(Snapshot snapshot)
|
private void draw_background(Snapshot snapshot)
|
||||||
{
|
{
|
||||||
var width = get_width();
|
var width = get_width();
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ interface ChatItemLayout : Object
|
|||||||
public abstract float get_width();
|
public abstract float get_width();
|
||||||
|
|
||||||
public abstract void draw(Snapshot snapshot);
|
public abstract void draw(Snapshot snapshot);
|
||||||
|
public abstract void copy(Gdk.Clipboard clipboard);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,4 +47,8 @@ class DateItemLayout : Object, ChatItemLayout {
|
|||||||
|
|
||||||
snapshot.restore();
|
snapshot.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void copy(Gdk.Clipboard clipboard) {
|
||||||
|
clipboard.set_text(layout.get_text());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -132,4 +132,8 @@ private class ImageBubbleLayout : BubbleLayout
|
|||||||
|
|
||||||
snapshot.restore();
|
snapshot.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void copy(Gdk.Clipboard clipboard) {
|
||||||
|
clipboard.set_texture(cached_texture);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -54,4 +54,8 @@ private class SenderAnnotationLayout : Object, ChatItemLayout
|
|||||||
|
|
||||||
snapshot.restore();
|
snapshot.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void copy(Gdk.Clipboard clipboard) {
|
||||||
|
clipboard.set_text(sender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -91,6 +91,10 @@ private class TextBubbleLayout : BubbleLayout
|
|||||||
|
|
||||||
snapshot.restore();
|
snapshot.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void copy(Gdk.Clipboard clipboard) {
|
||||||
|
clipboard.set_text(message.text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -195,11 +195,7 @@ private class TranscriptDrawingArea : Widget
|
|||||||
y_offset += chat_item.get_height() + chat_item.vertical_padding;
|
y_offset += chat_item.get_height() + chat_item.vertical_padding;
|
||||||
|
|
||||||
if (y_offset > bounding_box.y) {
|
if (y_offset > bounding_box.y) {
|
||||||
var text_bubble = chat_item as TextBubbleLayout;
|
chat_item.copy(get_clipboard());
|
||||||
var text = text_bubble.message.text;
|
|
||||||
|
|
||||||
var clipboard = get_clipboard();
|
|
||||||
clipboard.set_text(text);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user