After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 775732 - mir: clipboard support missing
mir: clipboard support missing
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Mir
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-12-06 23:07 UTC by fakey
Modified: 2017-01-05 23:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mir: implement window properties (7.26 KB, patch)
2016-12-06 23:09 UTC, fakey
none Details | Review
mir: track focused window (2.92 KB, patch)
2016-12-06 23:10 UTC, fakey
none Details | Review
mir: connect to content-hub (3.70 KB, patch)
2016-12-06 23:10 UTC, fakey
none Details | Review
mir: watch for pasteboard changes (1.81 KB, patch)
2016-12-06 23:11 UTC, fakey
none Details | Review
mir: copy clipboard data to content-hub (10.04 KB, patch)
2016-12-06 23:11 UTC, fakey
none Details | Review
mir: paste clipboard data from content-hub (11.44 KB, patch)
2016-12-06 23:12 UTC, fakey
none Details | Review
mir: implement window properties (7.70 KB, patch)
2016-12-07 20:44 UTC, fakey
committed Details | Review
mir: track focused window (2.95 KB, patch)
2016-12-07 20:44 UTC, fakey
committed Details | Review
mir: connect to content-hub (3.70 KB, patch)
2016-12-07 20:45 UTC, fakey
committed Details | Review
mir: copy clipboard data to content-hub (10.15 KB, patch)
2016-12-07 20:46 UTC, fakey
committed Details | Review
mir: paste clipboard data from content-hub (12.81 KB, patch)
2016-12-07 20:46 UTC, fakey
committed Details | Review

Description fakey 2016-12-06 23:07:14 UTC
Mir doesn't provide support for clipboard operations. Apps are expected to interact with the clipboard through content-hub.
Comment 1 fakey 2016-12-06 23:09:56 UTC
Created attachment 341515 [details] [review]
mir: implement window properties
Comment 2 fakey 2016-12-06 23:10:28 UTC
Created attachment 341516 [details] [review]
mir: track focused window
Comment 3 fakey 2016-12-06 23:10:55 UTC
Created attachment 341517 [details] [review]
mir: connect to content-hub
Comment 4 fakey 2016-12-06 23:11:17 UTC
Created attachment 341518 [details] [review]
mir: watch for pasteboard changes
Comment 5 fakey 2016-12-06 23:11:40 UTC
Created attachment 341519 [details] [review]
mir: copy clipboard data to content-hub
Comment 6 fakey 2016-12-06 23:12:03 UTC
Created attachment 341520 [details] [review]
mir: paste clipboard data from content-hub
Comment 7 Robert Ancell 2016-12-06 23:35:30 UTC
Review of attachment 341515 [details] [review]:

Looks generally sound though a little obscure in parts and could do with some comments.

::: gdk/mir/gdkmirwindowimpl.c
@@ +1560,3 @@
+  *actual_format = 8 * width;
+
+  if (*actual_type == GDK_SELECTION_TYPE_ATOM || *actual_type == gdk_atom_intern_static_string ("ATOM_PAIR"))

This section is a little hard to decipher due to the use of *actual_type, perhaps change to:

*actual_type = mir_property->type;
if (mir_property->type == GDK_SELECTION_TYPE_ATOM || mir_property->type == gdk_atom_intern_static_string ("ATOM_PAIR"))
    *actual_format = 32;
else
    *actual_format = 8 * width;

@@ +1568,3 @@
+  offset *= 4;
+
+  if (length < G_MAXULONG - width + 1)

Perhaps a comment to say this is stopping overflow?

@@ +1603,3 @@
+  GdkEvent *event;
+
+  if (type == GDK_SELECTION_TYPE_ATOM || type == gdk_atom_intern_static_string ("ATOM_PAIR"))

Perhaps a comment to mention what is special about the ATOM and ATOM_PAIR types? Also the same above.

@@ +1617,3 @@
+    }
+
+  if (type != mir_property->type || format / 8 != g_array_get_element_size (mir_property->array))

The format / 8 part is not clear - perhaps use a variable to make clear what this means?
Comment 8 Robert Ancell 2016-12-06 23:37:24 UTC
Review of attachment 341516 [details] [review]:

::: gdk/mir/gdkmirdisplay.c
@@ +591,3 @@
+  GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
+
+  mir_display->focused_window = window;

Does this need to be a reference? If the window is destroyed will this be unsafe?
Comment 9 Robert Ancell 2016-12-06 23:39:29 UTC
Review of attachment 341517 [details] [review]:

::: configure.ac
@@ +465,3 @@
 fi
 
+MIR_DEPENDENCIES="mirclient >= mirclient_required_version mircookie >= mircookie_required_version libcontent-hub-glib"

Should content-hub be a hard dependency?
Comment 10 Robert Ancell 2016-12-06 23:39:44 UTC
Review of attachment 341516 [details] [review]:

::: gdk/mir/gdkmirdisplay.c
@@ +591,3 @@
+  GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
+
+  mir_display->focused_window = window;

Does this need to be a reference? If the window is destroyed will this be unsafe?
Comment 11 Robert Ancell 2016-12-06 23:41:06 UTC
Review of attachment 341518 [details] [review]:

::: gdk/mir/gdkmirdisplay.c
@@ +113,3 @@
+                       gpointer       user_data)
+{
+  g_clear_pointer (&display->paste_data, g_variant_unref);

paste_data doesn't actually seem to be set here - should it be?
Comment 12 Robert Ancell 2016-12-06 23:45:29 UTC
Review of attachment 341519 [details] [review]:

::: gdk/mir/gdkmirwindowimpl.c
@@ +1678,3 @@
+      paste_format = _gdk_atom_name_const (mir_property->type);
+
+      if (!strchr (paste_format, '/'))

A comment about what '/' means in a paste format would help.
Comment 13 Robert Ancell 2016-12-06 23:51:50 UTC
Review of attachment 341520 [details] [review]:

::: gdk/mir/gdkmirdisplay.c
@@ +588,3 @@
+{
+  const gchar *target_string;
+  GdkAtom type;

Might be nice to call these dummy_* as before so they don't look like used variables.

@@ +880,3 @@
+  array = g_ptr_array_new ();
+
+  while (ptr < (const gchar *) &text[length])

This is a bit confusing a comment on what is being done?
Comment 14 fakey 2016-12-07 20:44:22 UTC
Created attachment 341579 [details] [review]
mir: implement window properties
Comment 15 fakey 2016-12-07 20:44:57 UTC
Created attachment 341580 [details] [review]
mir: track focused window
Comment 16 fakey 2016-12-07 20:45:28 UTC
Created attachment 341581 [details] [review]
mir: connect to content-hub
Comment 17 fakey 2016-12-07 20:46:07 UTC
Created attachment 341582 [details] [review]
mir: copy clipboard data to content-hub
Comment 18 fakey 2016-12-07 20:46:53 UTC
Created attachment 341583 [details] [review]
mir: paste clipboard data from content-hub
Comment 19 fakey 2016-12-07 20:54:32 UTC
(In reply to Robert Ancell from comment #9)
> Review of attachment 341517 [details] [review] [review]:
> 
> ::: configure.ac
> @@ +465,3 @@
>  fi
>  
> +MIR_DEPENDENCIES="mirclient >= mirclient_required_version mircookie >=
> mircookie_required_version libcontent-hub-glib"
> 
> Should content-hub be a hard dependency?

I'm not sure since it only needs the glib client library, but I guess it's a subjective decision. If only libcontent-hub-glib is available, then it just fails silently. FWIW, libcontent-hub-glib0 in Ubuntu has a Suggests on content-hub.
Comment 20 fakey 2016-12-07 20:55:28 UTC
(In reply to Robert Ancell from comment #11)
> Review of attachment 341518 [details] [review] [review]:
> 
> ::: gdk/mir/gdkmirdisplay.c
> @@ +113,3 @@
> +                       gpointer       user_data)
> +{
> +  g_clear_pointer (&display->paste_data, g_variant_unref);
> 
> paste_data doesn't actually seem to be set here - should it be?

Yeah, this commit didn't really make sense on its own. It's merged with the paste clipboard data commit now.