Re: [PATCH v2] Implement custom grab key combination definition



On Tue, Jun 08, 2010 at 06:44:30PM +0200, Michal Novotny wrote:
>  Hi all,
>  this is the second version of my patch to set your own key combination  
> to grab the window.

Thanks for updating this again! I've made some further enhancements to
it, so that it plays better with the GObject system for benefit of other
language bindings.

>  Now I'd like to mentioned that VncGrabSequence structure which carries  
> the information
>  about the pressed keys. There are 2 instances of this structure  
> allocated, one to carry
>  the grab key combination and second one to to carry the current keys  
> pressed in the VNC window.
> This structure is one of the input parameters for  
> vnc_display_set_grab_keys()
>  function and the return value of vnc_display_get_grab_keys() function  
> call. Since the
>  structure itself can't be printed as string there's also one more  
> function defined,
>  called vnc_display_translate_grab_keys(), which basically translates  
> the VncGrabSequence
>  using the gdk_keyval_name() function. This also introduced an issue  
> with python bindings
>  and therefore the vnc.override file contents have changed to define a  
> the wrappers for
>  both getting and setting the grab key combination.
>
> The python binding syntax is as follows (vnc is a vncdisplay object):
>
> vnc.set_grab_keys(list)
>
> where list is a comma delimited list of symbol strings, like "Control_L"  
> or "Alt_L".

There are actually python constants available for key symbols
so my update of the patch uses those instead, eg

  vnc.set_grab_keys([ gtk.keysyms.Alt_L, gtk.keysyms.Control_L ])

> diff --git a/src/vncdisplay.h b/src/vncdisplay.h
> index 1b5b297..bd8dc67 100644
> --- a/src/vncdisplay.h
> +++ b/src/vncdisplay.h
> @@ -80,6 +80,11 @@ typedef enum
>  	VNC_DISPLAY_DEPTH_COLOR_ULTRA_LOW
>  } VncDisplayDepthColor;
>  
> +typedef struct {
> +	guint *keysyms;
> +	guint numkeys;
> +} VncGrabSequence;

I decided that this should become a full boxed data type, so that it
works better with GObject introspection and lets us use GObject
properties too. So this definition is now in a vncgrabsequence.h
header file

> +
>  GType		vnc_display_get_type(void);
>  GtkWidget *	vnc_display_new(void);
>  
> @@ -94,6 +99,9 @@ void            vnc_display_send_keys_ex(VncDisplay *obj, const guint *keyvals,
>  					 int nkeyvals, VncDisplayKeyEvent kind);
>  
>  void		vnc_display_send_pointer(VncDisplay *obj, gint x, gint y, int button_mask);
> +void		vnc_display_set_grab_keys(VncDisplay *obj, VncGrabSequence seq);
> +VncGrabSequence	vnc_display_get_grab_keys(VncDisplay *obj);

I kept these two, but

> +const gchar*	vnc_display_translate_grab_keys(VncDisplay *obj, VncGrabSequence seq);

Moved into vncgrabsequence.h to provide a function

   gchar *vnc_grab_sequence_as_string(VncGrabSequence *seq);


I've just posted my update of your patch. Appreciate if you can double
check that it still looks sane to you

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]