Re: Having problems with gtk_editable_copy_clipboard



"Bradley F. Hartman" <hartman mcci-arl-va com> writes:

> Owen,
> 
> Thanks for the response.
> 
> > What are you trying to achieve?
> 
> Being relatively new to GTK, I am experimenting with different methods of 
> accomplishing different tasks.  I found that the default copy/paste
> methods worked well but wanted to try my own copy/paste handler to ramp
> up on the available functionality.  I would like, for example, to use the
> Sun copy/paste/cut keys in my text entry fields.

To make the cut/copy/paste keys work, you need to add an entry to 
$(sysconfigdir)/gtk-2.0/gtkrc like:

binding "clipboard-keys" 
{
  bind "F343" { "cut-clipboard" () }
  bind "F344" { "copy-clipboard" () }
  bind "F345" { "paste-clipboard" () }
}

class "GtkEntry" binding "clipboard-keys"
class "GtkTextView" binding "clipboard-keys"
 
I don't remember offhand what the exact function keys that Sun has
mapped these keys to are; experimentation with xev should reveal
it. (If there were actual specific key symbols for these keys, we
might ship GTK+ with them bound out of the box, but they are just
random function keys.)
 
> > When you press <control>c in a 
> > entry, ::copy-clipboard is emitted, and the default handler (built in
> > to GtkEntry) copies the selected text to the clipboard.
> 
> I'm working on a Sun - Control-C does not generate a "copy-clipboard"
> event.  Neither does the Sun "Copy" key, which is why I began experimenting
> with a "copy clipboard" handler (I know that I need to intercept
> key presses and then perform the associated processing to make the Sun 
> keys work).

Most accelerators were broken on Sun X servers for 2.0.0; fixed in CVS:

2002-03-15 Padraig O'Briain <padraig obriain sun com>

	* gdk/x11/gdkkeys-x11.c (update_keymaps): Fudge keymap to have lower
	upper case variants if there is only a single keysym per keycode and
	the key symbol has upper and lower case variants (#74512)

> I just don't understand why my signal handler is called ~5K times before 
> the program dumps core when I select "Copy" after right clicking in the 
> text entry field.  Any ideas?

void
gtk_editable_copy_clipboard (GtkEditable *editable)
{
  g_return_if_fail (GTK_IS_EDITABLE (editable));
  
  gtk_signal_emit_by_name (GTK_OBJECT (editable), "copy_clipboard");
}

So, there was some infinite recursion going on...

Regards,
                                        Owen



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