Re: global cursor setting?



Function gtk_file_selection_populate() is called via a callback connected to
a gtkentry contained within a gtkfileselection.  The gtkfileselection window
is being displayed when I trigger this callback.  In addition to this, I was
able to step through it's execution with ddd/gdb.  Is it possible for
someone to independently verify this odd behavior?  Any suggestion would
also be greatly appreciated.

I confirm the behavior. We've also made a similar change locally to Gtk,
since some of our GtkAda users asked for it (in particular when looking
through network directories).

Here is the patch we've ended up with in case someone else is interested.
Would such a patch be integrated into the official Gtk+ ?
We'd perfer to avoid having to maintain a separate version of Gtk+ if
possible.

Arno
--
*** gtk/gtkfilesel.c.old        Sat Jan 13 16:32:04 2001
--- gtk/gtkfilesel.c    Sat Jan 13 17:31:24 2001
*************** gtk_file_selection_populate (GtkFileSele
*** 1308,1317 ****
    gint selection_index = -1;
    gint file_list_width;
    gint dir_list_width;
    
    g_return_if_fail (fs != NULL);
    g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
!   
    cmpl_state = (CompletionState*) fs->cmpl_state;
    poss = cmpl_completion_matches (rel_path, &rem_path, cmpl_state);
  
--- 1308,1329 ----
    gint selection_index = -1;
    gint file_list_width;
    gint dir_list_width;
+   GdkCursor *cursor = NULL;
+   GdkWindow *window;
    
    g_return_if_fail (fs != NULL);
    g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
! 
!   window = GTK_WIDGET (fs)->window;
! 
!   if (window != NULL)
!     {
!       cursor = gdk_cursor_new (GDK_WATCH);
!       gdk_window_set_cursor (window, cursor);
!       gdk_cursor_destroy (cursor);
!       cursor = gdk_cursor_new (GDK_LEFT_PTR);
!     }
! 
    cmpl_state = (CompletionState*) fs->cmpl_state;
    poss = cmpl_completion_matches (rel_path, &rem_path, cmpl_state);
  
*************** gtk_file_selection_populate (GtkFileSele
*** 1319,1324 ****
--- 1331,1342 ----
      {
        /* Something went wrong. */
        gtk_file_selection_abort (fs);
+ 
+       if (window != NULL)
+       {
+         gdk_window_set_cursor (window, cursor);
+         gdk_cursor_destroy (cursor);
+       }
        return;
      }
  
*************** gtk_file_selection_populate (GtkFileSele
*** 1455,1460 ****
--- 1473,1484 ----
          gtk_file_selection_update_history_menu (fs, cmpl_reference_position (cmpl_state));
        }
        
+     }
+ 
+   if (window != NULL)
+     {
+       gdk_window_set_cursor (window, cursor);
+       gdk_cursor_destroy (cursor);
      }
  }
  




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