Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread jcupitt
That lets you detect ctrl-esc anywhere on the desktop. If you only
need to detect crtl-ecs within your window you can just set
ControlEscape as an accelerator, see:

http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html

On 30 August 2011 06:33, czk czon...@gmail.com wrote:
 try gdk_window_add_filter or gtk_key_snooper_install

 2011/8/30 Andrew Wood a@me.com

 Is there a way to regiser a handler function which will be called whenever
 the user presses Ctrl-Esc in a GTK app?

 Thanks

 __**_
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/**listinfo/gtk-app-devel-listhttp://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread Andrew Wood
Thanks for the tip.  Can accelerators only be used with menu items, only 
Ive just tried doing it by linking it to the clicked signal on a 
(hidden) GtkButton but it doesnt work?


My idea was when the key combo was pressed the accelerator would emit a 
clicked signal on the button and the buttons handler would then be called.


On 30/08/11 09:52, jcup...@gmail.com wrote:

That lets you detect ctrl-esc anywhere on the desktop. If you only
need to detect crtl-ecs within your window you can just set
ControlEscape as an accelerator, see:

http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html

On 30 August 2011 06:33, czkczon...@gmail.com  wrote:

try gdk_window_add_filter or gtk_key_snooper_install

2011/8/30 Andrew Wooda@me.com


Is there a way to regiser a handler function which will be called whenever
the user presses Ctrl-Esc in a GTK app?

Thanks

__**_
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/**listinfo/gtk-app-devel-listhttp://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread jcupitt
Hi Andrew,

You can add an accelerator to a window and it'll be called when that
key combination is pressed. It doesn't need to be associated with a
widget.

However I think it's generally considered good form to have a menu
item somewhere with the accelerator as a shortcut. That way the user
can discover your handy keypress and get some idea what it does.

John

On 30 August 2011 14:03, Andrew Wood a@me.com wrote:
 Thanks for the tip.  Can accelerators only be used with menu items, only Ive
 just tried doing it by linking it to the clicked signal on a (hidden)
 GtkButton but it doesnt work?

 My idea was when the key combo was pressed the accelerator would emit a
 clicked signal on the button and the buttons handler would then be called.

 On 30/08/11 09:52, jcup...@gmail.com wrote:

 That lets you detect ctrl-esc anywhere on the desktop. If you only
 need to detect crtl-ecs within your window you can just set
 ControlEscape as an accelerator, see:

 http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html

 On 30 August 2011 06:33, czkczon...@gmail.com  wrote:

 try gdk_window_add_filter or gtk_key_snooper_install

 2011/8/30 Andrew Wooda@me.com

 Is there a way to regiser a handler function which will be called
 whenever
 the user presses Ctrl-Esc in a GTK app?

 Thanks

 __**_
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org

 http://mail.gnome.org/mailman/**listinfo/gtk-app-devel-listhttp://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread Andrew Wood

How would you link it directly to the window then rather than to a widget?

As far as I can see you need to associate it with a signal, but looking 
down the list of signals for windows I cant really see one suitable, 
hence I was using this:


gtk_widget_add_accelerator(quitbutton,clicked,accelgroup,GDK_Q,GDK_CONTROL_MASK,GTK_ACCEL_LOCKED);
g_signal_connect(G_OBJECT(quitbutton),clicked,G_CALLBACK(handleControlQ),NULL);

Im using Ctrl Q for the time being as I havent worked out how to set it 
up for Esc yet.


The reason for doing this is Im writing an app for a public kiosk which 
will take over the whole screen and not provide any way for the user to 
exit the app.  The admin will press Ctrl Esc (or Ctrl Q for the moment) 
which will pop up a dialog for a password to exit the app.


On 30/08/11 14:19, jcup...@gmail.com wrote:

Hi Andrew,

You can add an accelerator to a window and it'll be called when that
key combination is pressed. It doesn't need to be associated with a
widget.

However I think it's generally considered good form to have a menu
item somewhere with the accelerator as a shortcut. That way the user
can discover your handy keypress and get some idea what it does.

John

On 30 August 2011 14:03, Andrew Wooda@me.com  wrote:

Thanks for the tip.  Can accelerators only be used with menu items, only Ive
just tried doing it by linking it to the clicked signal on a (hidden)
GtkButton but it doesnt work?

My idea was when the key combo was pressed the accelerator would emit a
clicked signal on the button and the buttons handler would then be called.

On 30/08/11 09:52, jcup...@gmail.com wrote:

That lets you detect ctrl-esc anywhere on the desktop. If you only
need to detect crtl-ecs within your window you can just set
ControlEscape as an accelerator, see:

http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html

On 30 August 2011 06:33, czkczon...@gmail.comwrote:

try gdk_window_add_filter or gtk_key_snooper_install

2011/8/30 Andrew Wooda@me.com


Is there a way to regiser a handler function which will be called
whenever
the user presses Ctrl-Esc in a GTK app?

Thanks

__**_
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org

http://mail.gnome.org/mailman/**listinfo/gtk-app-devel-listhttp://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread jcupitt
On 30 August 2011 15:22, Andrew Wood a@me.com wrote:
 How would you link it directly to the window then rather than to a widget?

You can link a GClosure to a key press with this:

http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html#gtk-accel-group-connect

Parse ctrlesc to key/mod with

gtk_accelerator_parse( ctrlesc, key, mods );

(I've not actually done this, I always use a widget, but I think it should work)

John
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread Michal Suchanek
On 30 August 2011 16:50,  jcup...@gmail.com wrote:
 On 30 August 2011 15:22, Andrew Wood a@me.com wrote:
 How would you link it directly to the window then rather than to a widget?

 You can link a GClosure to a key press with this:

 http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html#gtk-accel-group-connect

 Parse ctrlesc to key/mod with

 gtk_accelerator_parse( ctrlesc, key, mods );

 (I've not actually done this, I always use a widget, but I think it should 
 work)


You have the key name wrong (the example is not in C but anyway):


Gtk::Accelerator.to_name *(Gtk::Accelerator.parse ctrlesc)
= Control

Gtk::Accelerator.to_name *(Gtk::Accelerator.parse ctrlEscape)
= ControlEscape

Gtk::Accelerator.parse ctrlEscape
= [65307, #Gdk::Window::ModifierType control-mask]

HTH

Michal
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Key Repeats

2011-08-30 Thread Craig
Hi Jannis,

Yes, yes.  I should have thought of this.  I am just going to put a
Key_Down variable in scope of the key-pressed-event function and the
key-released-event function, and set it accordingly.  God, I am getting
old.  

Yet, you have got my interest with the XKeyboardControl control thing.
I never knew it existed.  Thanks.

Craig Bakalian



On Tue, 2011-08-30 at 12:00 +, gtk-app-devel-list-requ...@gnome.org
wrote:
  Hi All,
  
  Don't we have a way to program (via gtk) if a key, when pressed,
  repeats its signal?  Example- the 'a' key, if repeat is on key, I
 get Hi All,
 
 Don't we have a way to program (via gtk) if a key, when pressed,
 repeats its signal?  Example- the 'a' key, if repeat is on key, I get
 aaa, or if repeat is off I get one a.  Right now I am using
 the System Settings.

Connect to the key-press-event signal, remember the last key and ignore
follow-up press events for that particular key? (This requires to reset
the remembered key whenever a different key is pressed.)

If you want this behavior globally and not just in your application or
widget, you can do something like

  XKeyboardControl control;
  control.auto_repeat_mode = 0;

  gdk_error_trap_push ();
  XChangeKeyboardControl (GDK_DISPLAY (), KBAutoRepeatMode, control);
  gdk_error_trap_pop ();

That will suppress repeated key press events entirely.

HTH,
Jannise
  aaa, or if repeat is off I get one a.  Right now I am using
  the System Settings.
 
 Connect to the key-press-event signal, remember the last key and
 ignore
 follow-up press events for that particular key? (This requires to
 reset
 the remembered key whenever a different key is pressed.)
 
 If you want this behavior globally and not just in your application or
 widget, you can do something like
 
   XKeyboardControl control;
   control.auto_repeat_mode = 0;
 
   gdk_error_trap_push ();
   XChangeKeyboardControl (GDK_DISPLAY (), KBAutoRepeatMode, control);
   gdk_error_trap_pop ();
 
 That will suppress repeated key press events entirely.
 
 HTH,
 Jannis 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Detecting Ctrl Esc in GTK app

2011-08-30 Thread Andrew Wood
Thanks John thats solved that one. Now onto the next issue to do with 
the window type for which I will start a new thread


On 30/08/11 15:50, jcup...@gmail.com wrote:

On 30 August 2011 15:22, Andrew Wooda@me.com  wrote:

How would you link it directly to the window then rather than to a widget?

You can link a GClosure to a key press with this:

http://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html#gtk-accel-group-connect

Parse ctrlesc to key/mod with

gtk_accelerator_parse( ctrlesc,key,mods );

(I've not actually done this, I always use a widget, but I think it should work)

John


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Notebooks and GLists

2011-08-30 Thread Neil Munro
Hi folks
   Not a very descript title, but I fail to come up with a better
one. Anyway my problem is as follows.

I have a notebook with reorderable tabs which each displays a sourceview
widget.
Each sourceview widget represents a document where a document is an instance
of an object/struct.
When the tabs are re-ordered the glist becomes out of order with the tabs
and needs to be updated to reflect the new page positions.

Using the page-reordered signal and callback I can get the new page position
but not the old position.

If there is a better way to go about implementing a system like this, I
would be willing to hear it and any help is appreciated.

Finally you can get the code here: https://gitorious.org/x2

The file layout should be rather obvious.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


How to achieve functionality of GTK_WINDOW_POPUP but with keyboard input

2011-08-30 Thread Andrew Wood
How can I achieve the same 'screen invasion' effect (i.e covers 
everything including the Gnome Panels and prevents other windows being 
brought to the front with Alt-Tab) that GTK_WINDOW_POPUP has but also 
allow keyboard input to the widgets in the window.


Ive tried  GDK_WINDOW_TYPE_HINT_DOCK  which invades screen ok but has no 
keyboard input


GDK_WINDOW_TYPE_HINT_SPLASHSCREEN doesnt invade screen - other windows 
can be placed on top, alt-tab works, but keyboard input works


GDK_WINDOW_TYPE_HINT_DESKTOP no display

GDK_WINDOW_TYPE_HINT_UTILITY
doesnt invade screen - other windows can be placed on top, alt-tab 
works

GDK_WINDOW_TYPE_HINT_TOOLBAR
doesnt invade screen - other windows can be placed on top, alt-tab 
works

GDK_WINDOW_TYPE_HINT_MENU
doesnt invade screen - other windows can be placed on top, alt-tab 
works


The reason is Im trying to write a program for a public kiosk hence I 
effectively want to lock the screen.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to achieve functionality of GTK_WINDOW_POPUP but with keyboard input

2011-08-30 Thread Bernhard Schuster
2011/8/30 Andrew Wood a@me.com:
 How can I achieve the same 'screen invasion' effect (i.e covers everything
 including the Gnome Panels and prevents other windows being brought to the
 front with Alt-Tab) that GTK_WINDOW_POPUP has but also allow keyboard input
 to the widgets in the window.

 Ive tried  GDK_WINDOW_TYPE_HINT_DOCK  which invades screen ok but has no
 keyboard input

 GDK_WINDOW_TYPE_HINT_SPLASHSCREEN doesnt invade screen - other windows can
 be placed on top, alt-tab works, but keyboard input works

 GDK_WINDOW_TYPE_HINT_DESKTOP no display

 GDK_WINDOW_TYPE_HINT_UTILITY
    doesnt invade screen - other windows can be placed on top, alt-tab works
 GDK_WINDOW_TYPE_HINT_TOOLBAR
    doesnt invade screen - other windows can be placed on top, alt-tab works
 GDK_WINDOW_TYPE_HINT_MENU
    doesnt invade screen - other windows can be placed on top, alt-tab works

 The reason is Im trying to write a program for a public kiosk hence I
 effectively want to lock the screen.
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


gtk_window_fullscreen (window)

- either just disable all hotkeys within your DE environment
or
-  run a bare X server without a DE (see xinit)

Regards

Bernhard
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Notebooks and GLists

2011-08-30 Thread Michal Suchanek
On 30 August 2011 23:08, Neil Munro neilmu...@gmail.com wrote:
 Hi folks
           Not a very descript title, but I fail to come up with a better
 one. Anyway my problem is as follows.

 I have a notebook with reorderable tabs which each displays a sourceview
 widget.
 Each sourceview widget represents a document where a document is an instance
 of an object/struct.
 When the tabs are re-ordered the glist becomes out of order with the tabs
 and needs to be updated to reflect the new page positions.

 Using the page-reordered signal and callback I can get the new page position
 but not the old position.

 If there is a better way to go about implementing a system like this, I
 would be willing to hear it and any help is appreciated.

 Finally you can get the code here: https://gitorious.org/x2

You did not implement any Reorder. In absence of any code to comment
on I suggest you save the old order (= the last order known to your
code) in another GList and when you receive a reorder event you can
compare the new position with the saved position.

You need these two GLists to hold the same (or convertible) unique
values. eg. pointer to tab is one sufficiently unique value.

Pointer to tab and pointer a struct containing a pointer to tab is an
example of trivially convertible (and often very useful) unique
values.

HTH

Michal
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Question on touchscreen devices

2011-08-30 Thread Robert Latest
Hello all,

I'm tinkering with the idea of writing a GTK+ app targeted at an
industrial touchscreen all-in-one device (like this one:
http://www.faytech.com/product_show.php?id=52). But I first would like
to write the app to see if works on a conventional PC (with mouse)
and then port it to the touchscreen device. My questions:

1) Is there (from the application's point of view) any difference
between a (left) mouse click and a tap on the screen? That's actually
the only action I need -- no dragging, no right or middle mouse
buttons.

2) I will do the developing on a Linux box, but the app may end up on
a Windows device (this depends on what my employer will ultimately
buy). Is the touchscreen handling on Windows different than that on
X-Windows?

Thanks,
robert
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list