Strange focus for POPUP-type windows
- From: Simon Gornall <simon unique-id com>
- To: GTK mailing list <gtk-list redhat com>
- Subject: Strange focus for POPUP-type windows
- Date: Sun, 16 Jan 2000 22:25:28 +0000
I'm having difficulty getting a popup window (one without the
window-manager
bits) to reliably accept key-presses. The below code works fine for
windows
of type GTK_WINDOW_TOPLEVEL instead of GTK_WINDOW_POPUP.
Here's a small snippet of code that demonstrates what I'm doing (wrong
:-) ...
//========================================================================
// Create the window to draw in
//========================================================================
if ((_window = gtk_widget_new (gtk_window_get_type(),
"GtkObject::user_data", NULL,
"GtkWindow::type", GTK_WINDOW_POPUP,
"GtkWindow::title", "Video Stream",
"GtkWindow::allow_shrink", FALSE,
NULL)) == NULL)
{
cerr << "Cannot create window on display. Exiting\n";
exit(-2);
}
gtk_window_position((GtkWindow*)_window, GTK_WIN_POS_MOUSE );
//========================================================================
// Set the events that the window will respond to
//========================================================================
gtk_widget_set_events(_window, gtk_widget_get_events(_window ) |
GDK_BUTTON_PRESS_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_KEY_PRESS_MASK
);
GTK_WIDGET_SET_FLAGS(_window, GTK_CAN_FOCUS);
//========================================================================
// Assign callbacks to the relevant events
//========================================================================
gtk_signal_connect( GTK_OBJECT(_window), "button_press_event",
GTK_SIGNAL_FUNC(buttonPress), this );
... (etc.)
The keypress events are bound to both main window, and gtk_drawing_area
under
GTK 1.2.4.
What is *really* weird is that I can get key events some of the time
when the
window type is _POPUP. If I take the mouse into another window, then out
onto
the desktop, then directly into my window, all the key events seem to
work
fine. Does this make it a window-manager problem ? I'm using
Enlightenment
(Version: 0.16.pre.1)
Another weird thing is that the 'arrow' keys crash the application
without a
stack trace :-( This could just be a bug in my code, though :-(
Here's hoping someone can shed light...
Simon.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]