linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-c-programming@vger.kernel.org
Subject: Re: About combined console/X11 programs
Date: Wed, 7 Aug 2002 15:30:02 +0200	[thread overview]
Message-ID: <20020807133002.GZ758@lug-owl.de> (raw)
In-Reply-To: <15697.3024.599591.170344@cerise.nosuchdomain.co.uk>

[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]

On Wed, 2002-08-07 13:00:16 +0100, Glynn Clements <glynn.clements@virgin.net>
wrote in message <15697.3024.599591.170344@cerise.nosuchdomain.co.uk>:
> +Rudymartin wrote:

> > thats why I need to use the meta and control keys.
> 
> GUI toolkits don't normally report events for pressing and releasing
> modifier keys (Ctrl, Shift, Meta etc). Instead, the modifiers are
> normally reported as flags with each key or button event.

I won't go into those my-one-is-bigger-than-... wars, but using GTK+, I
can easily fetch single keypresses/keyreleases. Look at this snipplet:

static gint
keyboard_event_handler(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
	switch(event->type) {
		case GDK_KEY_PRESS:
			printf("Press:   0x%04x\n", event->keyval);
			break;
		case GDK_KEY_RELEASE:
			printf("Release: 0x%04x\n", event->keyval);
			break;
		default:
			/* Make compiler happy at using enums */;
			break;
	}

	return TRUE;
}

window_main  = gtk_window_new(GTK_WINDOW_TOPLEVEL);
...
gtk_signal_connect(GTK_OBJECT(window_main),
	"key_press_event",
	GTK_SIGNAL_FUNC(keyboard_event_handler),
	NULL);
gtk_signal_connect(GTK_OBJECT(pl_window_main),
	"key_release_event",
	GTK_SIGNAL_FUNC(keyboard_event_handler),
	NULL);
...

MfG, JBG

-- 
Jan-Benedict Glaw   .   jbglaw@lug-owl.de   .   +49-172-7608481
	 -- New APT-Proxy written in shell script --
	   http://lug-owl.de/~jbglaw/software/ap2/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2002-08-07 13:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-05  7:25 question about gcc and keyboard hadling +Rudymartin
2002-08-05 14:43 ` Glynn Clements
2002-08-06  6:13   ` Jan-Benedict Glaw
2002-08-06  6:19   ` Jan-Benedict Glaw
2002-08-06 16:22     ` Glynn Clements
2002-08-06 18:08       ` About combined console/X11 programs (was: question about gcc and keyboard hadling) Jan-Benedict Glaw
2002-08-06 22:07         ` Glynn Clements
2002-08-07  1:48           ` +Rudymartin
2002-08-07 12:00             ` Glynn Clements
2002-08-07 13:30               ` Jan-Benedict Glaw [this message]
2002-08-07 22:32                 ` About combined console/X11 programs Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020807133002.GZ758@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).