« Return to Thread: [gtk+osx] window is visible but does not accept focus

[gtk+osx] window is visible but does not accept focus

by KieSoft :: Rate this Message:

Reply to Author | View in Thread

Hi!

I'm trying to port my Linux app on MAC OS X. I can compile the code and
window is visible but does not accept focus, nor is it movable. I thought
that's my problem and wrote a small GTK app. I get the same result with that
test app too: window does not accept focus. Can you help me to solve the
problem?

Here are my code:

----------------------------------------------------------------------------
--------------
gtktest.mak:

CXXFLAGS=-g -Wno-long-double -Werror -D_FILE_OFFSET_BITS=64 -I/gtk-osx-0.6 -
I/gtk-osx-0.6/glib-1.2.10 -I/gtk-osx-0.6/gdk
OBJS=gtktest.o

gtktest : $(OBJS) ; \
    gcc -o gtktest $(OBJS) -lpthread -ldl -lstdc++
`/gtk-osx-0.6/gtk-config/gtk-config --libs`;

----------------------------------------------------------------------------
--------------
gtktest.cpp:

#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <math.h>
#include <time.h>
#include <locale.h>
#include <assert.h>
#include <ctype.h>
#include <gtk/gtk.h>

static gint close_app_event(GtkWidget *widget, GdkEvent *event, gpointer
data)
{
gtk_main_quit();
return FALSE;
}


int main(int argc, char* argv[])
{
gchar buffer[64];
srand (time (NULL));

gtk_set_locale ();
gtk_init (&argc, &argv);
gdk_rgb_init();

GtkBindingSet *binding_set = gtk_binding_set_by_class (gtk_type_class
(GTK_TYPE_WIDGET));
gtk_binding_entry_add_signal(binding_set, '9', GDK_CONTROL_MASK |
GDK_RELEASE_MASK, "debug_msg", 1, GTK_TYPE_STRING, "GtkWidgetClass
<ctrl><release>9 test");

GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE);
gtk_widget_set_name (window, "main window");
gtk_widget_set_usize (window, 200, 400);
gtk_widget_set_uposition (window, 20, 20);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC(gtk_main_quit),  NULL);
gtk_signal_connect (GTK_OBJECT (window), "delete-event", GTK_SIGNAL_FUNC
(gtk_false), NULL);

GtkWidget *box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);

if (gtk_micro_version > 0)  sprintf (buffer, "Gtk+ v%d.%d.%d",
gtk_major_version, gtk_minor_version, gtk_micro_version);
else sprintf (buffer, "Gtk+ v%d.%d", gtk_major_version, gtk_minor_version);

GtkWidget *label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);

GtkWidget *button = gtk_button_new_with_label ("close");
gtk_signal_connect(GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC
(close_app_event), window);
gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);

gtk_widget_show_all (window);
gtk_main ();
return 0;
}


----------------------------------------------------------------------------
--------------

I took the code from gtk-osx-0.6 demo app.

Looking forward to hearing from you soon,

Best regards,
Igor




-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Gtk-osx-developer mailing list
Gtk-osx-developer@...
https://lists.sourceforge.net/lists/listinfo/gtk-osx-developer

 « Return to Thread: [gtk+osx] window is visible but does not accept focus

LightInTheBox - Buy quality products at wholesale price!