Re: How to raise / focus a window?



The correct way is to use this code snippet:

// Shows if hidden, gets focus, and is placed on top of other windows
gtk_window_present(GTK_WINDOW(note->w_window));

// Moves window to specified spot
gtk_window_move(GTK_WINDOW(note->w_window), note->x, note->y);

Note that you have to "present" before "moving", because the move
function does not affect a hidden window.

Cheers,
Loban

On Sat, 2003-05-24 at 01:54, David Topper wrote:
I've got an app with several windows and one central "master" window 
which controls hiding / showing of the others.  Unfortunately, I can't 
seem to raise focus for a window.  I'm doing the following:

    if (GTK_IS_WIDGET(s_obj->perl_buf->window)) {
        gtk_widget_set_uposition(GTK_WIDGET(s_obj->perl_buf->window),
                            s_obj->perl_buf->x,
                            s_obj->perl_buf->y);
        gtk_widget_show(GTK_WIDGET(s_obj->perl_buf->window));
        gtk_window_activate_focus(s_obj->perl_buf->window);

But it doesn't seem to work.  I've also changed my WM from "focus 
follows mouse" to "click to focus" and neither works.  I'm running 
Slackware 9 and KDE.  

Anyone have an idea?

Thanks,

DT
-- 
/-------------------------------------------------------------------\
|   Loban Amaan Rahman  <-- anagram of -->  Aha! An Abnormal Man!   |
| loban earthling net, loban caltech edu,  http://loban.caltech.edu |
\-------------------------------------------------------------------/



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