* Janek Kozicki [2008-08-30 15:10+0200] writes:

> what about that "simple GTK application" which tests this patch?

Here is one:

#include <gtk/gtk.h>

int main (int argc, char *argv[]) {
  int flag;
  if (argc!=2) goto usage;
  if (strcmp ("true", argv[1]) == 0) flag = TRUE;
  else if (strcmp ("false", argv[1]) == 0) flag = FALSE;
  else goto usage;
  gtk_init (&argc, &argv);
    GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    GtkWidget *label = gtk_label_new (argv[1]);
    gtk_container_add (GTK_CONTAINER (window), label);
    gtk_window_set_focus_on_map (GTK_WINDOW (window), flag);
    gtk_widget_show_all (window);
    gtk_main ();
  return 0;
  printf ("Usage: %s true|false\n", argv[0]);
  return 1;

** Local Variables:
** compile-command: "gcc `pkg-config --cflags --libs gtk+-2.0` focus-when-mapped.c"
** End:

Without the patch, the new window always receives the focus, regardless
of gtk_window_set_focus_on_map's argument.  With the patch
gtk_window_set_focus_on_map should work as expected.


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