Example #1
1
bool Ctrl::SetWndFocus()
{
	GuiLock __;
	LLOG("SetWndFocus0 " << Upp::Name(this) << ", top: " << top);
	if(top) {
		LLOG("SetWndFocus0 DO gdk: " << gdk());
		SetWndForeground();
		int t0 = msecs();
		while(!gtk_window_is_active(gtk()) && msecs() - t0 < 500) // Wait up to 500ms for window to become active - not ideal, but only possibility
			FetchEvents(true);
		FocusSync();
	}
	return true;
}
Example #2
0
static gboolean ui_is_focused (void)
{
/* gtk_window_is_active() is too unreliable, unfortunately. --jlindgren */
#if 0
    return gtk_window_is_active ((GtkWindow *) mainwin) || gtk_window_is_active
     ((GtkWindow *) equalizerwin) || gtk_window_is_active ((GtkWindow *)
     playlistwin);
#else
    return ui_is_shown ();
#endif
}
Example #3
0
static int heartbeat(gpointer data)
{
    refresh_state_info();
    /* check watchdog */
    if (ctrl_shm->watchdog < 10) {
	ctrl_shm->watchdog++;
    } else {
	handle_watchdog_timeout();
    }
    if (ctrl_usr->pending_restart && ctrl_shm->state == IDLE) {
        ctrl_usr->pending_restart = 0;
        ctrl_usr->run_mode = ctrl_usr->old_run_mode;
        if(ctrl_usr->run_mode != STOP) {
            start_capture();
        }
    }
    if (ctrl_usr->display_refresh_timer > 0) {
	/* decrement timer, did it time out? */
	if (--ctrl_usr->display_refresh_timer == 0) {
	    /* yes, refresh the display */
	    refresh_display();
	}
    }
    if (ctrl_shm->state == DONE) {
        if(!gtk_window_is_active(GTK_WINDOW(ctrl_usr->main_win)))
            gtk_window_set_urgency_hint(GTK_WINDOW(ctrl_usr->main_win), TRUE);
	capture_complete();
    } else if (ctrl_usr->run_mode == ROLL) capture_cont();
    return 1;
}
Example #4
0
static char* gtkDialogGetActiveWindowAttrib(Ihandle* ih)
{
  if (gtk_window_is_active((GtkWindow*)ih->handle))
    return "Yes";
  else
    return "No";
}    
Example #5
0
static gboolean
compare_focus (gpointer data)
{
  AtkObject *atk_focus;
  AtkObject *gtk_focus;
  GtkWidget *focus_widget;
  GList *list, *l;

  atk_focus = atk_get_focus_object ();

  focus_widget = NULL;
  list = gtk_window_list_toplevels ();
  for (l = list; l; l = l->next)
    {
      GtkWindow *w = l->data;
      if (gtk_window_is_active (w))
        {
          focus_widget = gtk_window_get_focus (w);
          break;
        }
    }
  g_list_free (list);

  if (GTK_IS_WIDGET (focus_widget))
    gtk_focus = gtk_widget_get_accessible (focus_widget);
  else
    gtk_focus = NULL;

  if (gtk_focus != atk_focus)
    g_print ("gtk focus: %s != atk focus: %s\n",
             get_name (gtk_focus), get_name (atk_focus));

  return G_SOURCE_CONTINUE;
}
static gboolean
thunar_progress_dialog_toggled (ThunarProgressDialog *dialog,
                                GdkEventButton       *event,
                                GtkStatusIcon        *status_icon)
{
  _thunar_return_val_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog), FALSE);
  _thunar_return_val_if_fail (GTK_IS_STATUS_ICON (status_icon), FALSE);

  /* check if the window is visible and has the focus */
  if (gtk_widget_get_visible (GTK_WIDGET (dialog)) 
      && gtk_window_is_active (GTK_WINDOW (dialog)))
    {
      /* remember the position of the dialog */
      gtk_window_get_position (GTK_WINDOW (dialog), &dialog->x, &dialog->y);

      /* it is, so hide it now */
      gtk_widget_hide (GTK_WIDGET (dialog));
    }
  else
    {
      /* check if the dialog is invisible */
      if (!gtk_widget_get_visible (GTK_WIDGET (dialog)))
        {
          /* restore its previous position before presenting it */
          gtk_window_move (GTK_WINDOW (dialog), dialog->x, dialog->y);
        }

      /* it's not, so we need to raise it above other windows */
      gtk_window_present_with_time (GTK_WINDOW (dialog), event->time);
    }

  return TRUE;
}
bool WebInspectorProxy::platformIsFront()
{
    GtkWidget* parent = gtk_widget_get_toplevel(m_inspectorView);
    if (WebCore::widgetIsOnscreenToplevelWindow(parent))
        return m_isVisible && gtk_window_is_active(GTK_WINDOW(parent));
    return false;
}
Example #8
0
static void
window_removed (AtkObject *atk_obj,
                guint      index,
                AtkObject *child)
{
  GtkWidget *widget;
  GtkWindow *window;

  if (!GTK_IS_WINDOW_ACCESSIBLE (child))
    return;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (child));
  if (!widget)
    return;

  window = GTK_WINDOW (widget);
  /*
   * Deactivate window if it is still focused and we are removing it. This
   * can happen when a dialog displayed by gok is removed.
   */
  if (gtk_window_is_active (window) && gtk_window_has_toplevel_focus (window))
    g_signal_emit_by_name (child, "deactivate");

  g_signal_handlers_disconnect_by_func (widget, (gpointer) window_focus, NULL);
  g_signal_emit_by_name (child, "destroy");
}
void iupdrvSetFocus(Ihandle *ih)
{
  Ihandle* dialog = IupGetDialog(ih);
  if (!gtk_window_is_active((GtkWindow*)dialog->handle))
    gdk_window_focus(iupgtkGetWindow(dialog->handle), gtk_get_current_event_time());
  gtk_widget_grab_focus(ih->handle);
}
Example #10
0
gboolean DrawFunc(gpointer user) {
    ENGD *engd = user;
    GdkGLDrawable *pGLD = 0;
    GdkRectangle rect = {};
    GdkModifierType gmod;
    gint xptr, yptr;
    GdkRegion *creg;
    GdkWindow *hwnd;
    intptr_t *data;
    uint32_t attr;

    cEngineCallback(engd, ECB_GUSR, (intptr_t)&data);
    if (!(hwnd = gtk_widget_get_window(GTK_WIDGET(data[0]))))
        return TRUE;

    gdk_window_get_pointer(hwnd, &xptr, &yptr, &gmod);
    attr = ((gmod & GDK_BUTTON1_MASK)? UFR_LBTN : 0)
         | ((gmod & GDK_BUTTON2_MASK)? UFR_MBTN : 0)
         | ((gmod & GDK_BUTTON3_MASK)? UFR_RBTN : 0)
         | ((gtk_window_is_active(GTK_WINDOW(data[0])))? UFR_MOUS : 0);
    attr = cPrepareFrame(engd, xptr, yptr, attr);
    if (attr & PFR_SKIP)
        usleep(1000);
    if (attr & PFR_HALT)
        return TRUE;
    if (attr & PFR_PICK) {
        rect.width  = (int16_t)(data[2]);
        rect.height = (int16_t)(data[2] >> 16);
    }
Example #11
0
static void on_window_active_changed(GtkWindow *window, GParamSpec *pspec, gpointer data)
{
	GeanyDocument *doc = document_get_current();

	if (doc && gtk_window_is_active(window))
		document_check_disk_status(doc, TRUE);
}
Example #12
0
void mainwindow_toggle(int sig)
{
    if((!sig && GTK_WIDGET_VISIBLE(mainwindow)) || (sig && toggled))
    {
        gdk_threads_enter();
        gtk_widget_hide(GTK_WIDGET(mainwindow));
        gdk_flush();
        gdk_threads_leave();
        toggled = FALSE;
        return;
    }
    
    toggled = TRUE;
    gdk_threads_enter();
    
    /* reset the window position before displaying it to avoid flickering if the
       windos is moved */
    mainwindow_reset_position();
    
    if(gtk_window_is_active(GTK_WINDOW(mainwindow)) == FALSE)
        gtk_window_present(GTK_WINDOW(mainwindow));
    else
        gtk_widget_show(mainwindow);
    
    gtk_window_stick(GTK_WINDOW(mainwindow));
    gtk_window_set_keep_above(GTK_WINDOW(mainwindow), TRUE);
    gdk_window_focus(mainwindow->window, gtk_get_current_event_time());
    gdk_flush();
    gdk_threads_leave();
}
Example #13
0
JNIEXPORT jboolean JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1is_1active
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	gboolean result;
	jboolean _result;
	GtkWindow* self;

	// convert parameter self
	self = (GtkWindow*) _self;

	// call function
	result = gtk_window_is_active(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jboolean) result;

	// and finally
	return _result;
}
Example #14
0
		static gboolean notify (GtkWindow* window, gpointer dummy, MainWindowActive* self)
		{
			if (g_wait.m_window != 0 && gtk_window_is_active(window) && !GTK_WIDGET_VISIBLE(g_wait.m_window)) {
				gtk_widget_show(GTK_WIDGET(g_wait.m_window));
			}

			return FALSE;
		}
Example #15
0
static void config_save (void)
{
    if (gtk_window_is_active ((GtkWindow *) window))
        save_window_size ();

    layout_save ();
    pw_col_save ();
}
Example #16
0
void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room,
								  LinphoneChatMessage *msg ) {
	GtkWidget *main_window=linphone_gtk_get_main_window();
	GtkWidget *friendlist=linphone_gtk_get_widget ( main_window,"contact_list" );
	GtkWidget *w;
	gboolean send=TRUE;
	/*GtkNotebook *notebook= ( GtkNotebook * ) linphone_gtk_get_widget ( main_window,"viewswitch" );*/
	const LinphoneAddress *from= linphone_chat_message_get_from ( msg );
	
	w= ( GtkWidget* ) g_object_get_data ( G_OBJECT ( friendlist ),"chatview" );
	if ( w!=NULL ) {
	/* Chat window opened */
		const LinphoneAddress *from_chatview=linphone_gtk_friend_list_get_active_address();
		if (linphone_address_weak_equal(from,from_chatview)) {
			send=TRUE;
		} else {
			if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) {
				linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) );
			}
			send=FALSE;
		}
	} else {	
	/* Chat window closed */
#ifdef MSG_STORAGE_ENABLED
		send=FALSE;
#else
		send=TRUE;
#endif
		if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) {
			linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) );
		}
		w=linphone_gtk_init_chatroom ( room,linphone_chat_message_get_from ( msg ) );
		g_object_set_data ( G_OBJECT ( friendlist ),"chatview", ( gpointer ) w );
		linphone_gtk_friend_list_set_active_address(from);
	}

#ifdef HAVE_GTK_OSX
	/* Notified when a new message is sent */
	linphone_gtk_status_icon_set_blinking ( TRUE );
#else
	if ( !gtk_window_is_active ( GTK_WINDOW ( main_window ) ) ) {
		if ( !GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( w ),"is_notified" ) ) ) {
			linphone_gtk_notify ( NULL,linphone_chat_message_get_text ( msg ) );
			g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( TRUE ) );
		} else {
			g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( FALSE ) );
		}
	}
#endif
	if ( send ) {
		linphone_gtk_push_text ( w,linphone_chat_message_get_from ( msg ),
								 FALSE,room,msg,FALSE );
	}
	linphone_core_play_local(lc,linphone_gtk_get_sound_path("incoming_chat.wav"));
	linphone_gtk_show_friends();
	
}
Example #17
0
static void
status_icon_toggle_visibility (EmpathyStatusIcon *icon)
{
	EmpathyStatusIconPriv *priv = GET_PRIV (icon);
	gboolean               visible;

	visible = gtk_window_is_active (priv->window);
	status_icon_set_visibility (icon, !visible, TRUE);
}
Example #18
0
static gboolean ui_is_focused (void)
{
/* gtk_window_is_active() is too unreliable, unfortunately. --jlindgren */
#if 0
    return gtk_window_is_active ((GtkWindow *) window);
#else
    return ui_is_shown ();
#endif
}
Example #19
0
static bool MainFrame_isActiveApp (void)
{
	GList* list = gtk_window_list_toplevels();
	for (GList* i = list; i != 0; i = g_list_next(i)) {
		if (gtk_window_is_active(GTK_WINDOW(i->data))) {
			return true;
		}
	}
	return false;
}
Example #20
0
gboolean check_focus(gpointer data)
{
    if(gtk_window_is_active(GTK_WINDOW(fwin)))
        return TRUE;
    else
        {
            gtk_widget_destroy(fwin);
            return FALSE;
        }

}
void manage_window_set_transient(GtkWindow *window)
{
	/* debug_print("manage_window_set_transient(): window = %p, focus_window = %p\n",
		    window, focus_window); */

	if (window && focus_window) {
		if (!gtk_window_is_active(GTK_WINDOW(focus_window)))
			gtkut_window_popup(focus_window);
		gtk_window_set_transient_for(window, GTK_WINDOW(focus_window));
	}
}
void display_gtk()
{
	char text[100];
	if(charger_status==0)
	{
		gtk_image_set_from_file(GTK_IMAGE(power),NULL);
	}
	else
	{
		
		gtk_image_set_from_file(GTK_IMAGE(power),"./images/power.png");
	}
 

    	
    	
	sprintf(text,"<span size=\"xx-large\" ><b> %d%% </b></span>" ,charge);
	gtk_label_set_markup(GTK_LABEL(label[0]),text);
	sprintf(text,"%d hour %d minutes remaining",remaining_time.hour,remaining_time.minute);
	gtk_label_set_text(GTK_LABEL(label[1]),text);
	if(!gtk_window_is_active(GTK_WINDOW(window)))
	{
		gtk_window_deiconify(GTK_WINDOW(window));
		//gtk_window_set_keep_below(GTK_WINDOW(window),TRUE);
	}
	if(charge==100)
	{
		gtk_image_set_from_file(GTK_IMAGE(bg),"./images/full.png");
	}
	else if(charge>60)
	{
		gtk_image_set_from_file(GTK_IMAGE(bg),"./images/75.png");
	}
	else if(charge>35)
	{
		gtk_image_set_from_file(GTK_IMAGE(bg),"./images/50.png");
	}
	else if(charge>10)
	{
		gtk_image_set_from_file(GTK_IMAGE(bg),"./images/25.png");
	}
	else
	{
		gtk_image_set_from_file(GTK_IMAGE(bg),"./images/danger.png");
	}
	if(charger_status==1&&charge==100)
	{
		notify(1);
	}
	else if(charger_status==0&&charge<10)
	{
		notify(0);
	}
}
Example #23
0
void Ctrl::FocusSync()
{
	GuiLock __;
	if(focusCtrlWnd && focusCtrlWnd->IsOpen() && gtk_window_is_active(focusCtrlWnd->gtk()))
		return;
	Ptr<Ctrl> focus = NULL;
	static Ptr<Ctrl> ctrl;
	for(int i = 0; i < wins.GetCount(); i++)
		if(gtk_window_is_active((GtkWindow *)wins[i].gtk)) {
			focus = wins[i].ctrl;
			break;
		}
	if(focus != ctrl) {
		if(ctrl)
			ctrl->KillFocusWnd();
		ctrl = focus;
		if(ctrl)
			ctrl->SetFocusWnd();
		SyncCaret();
	}
}
Example #24
0
EmpathyStatusIcon *
empathy_status_icon_new (GtkWindow *window, gboolean hide_contact_list)
{
	EmpathyStatusIconPriv *priv;
	EmpathyStatusIcon     *icon;
	gboolean               should_hide;
#ifdef HAVE_LIBINDICATE
	gboolean               use_libindicate;
#endif

	g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);

	icon = g_object_new (EMPATHY_TYPE_STATUS_ICON, NULL);
	priv = GET_PRIV (icon);

	priv->window = g_object_ref (window);
#ifdef HAVE_LIBINDICATE
	priv->indicator_manager = empathy_indicator_manager_dup_singleton ();
	g_signal_connect (priv->indicator_manager, "server-activate",
			  G_CALLBACK (indicate_server_activate_cb),
			  icon);
#endif

	g_signal_connect_after (priv->window, "key-press-event",
			  G_CALLBACK (status_icon_key_press_event_cb),
			  icon);

	g_signal_connect (priv->window, "delete-event",
			  G_CALLBACK (status_icon_delete_event_cb),
			  icon);

	if (!hide_contact_list) {
		empathy_conf_get_bool (empathy_conf_get (),
				       EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
			               &should_hide);
	} else {
		should_hide = TRUE;
	}

#ifdef HAVE_LIBINDICATE
	empathy_conf_get_bool (empathy_conf_get (),
			       EMPATHY_PREFS_UI_USE_LIBINDICATE,
		               &use_libindicate);
	status_icon_set_use_libindicate (icon, use_libindicate);
#endif

	if (gtk_window_is_active (priv->window) == should_hide) {
		status_icon_set_visibility (icon, !should_hide, FALSE);
	}

	return icon;
}
Example #25
0
void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room,
                                  LinphoneChatMessage *msg ) {
    GtkWidget *main_window=linphone_gtk_get_main_window();
    GtkWidget *friendlist=linphone_gtk_get_widget ( main_window,"contact_list" );
    GtkWidget *w;
    gboolean send=TRUE;
    /*GtkNotebook *notebook= ( GtkNotebook * ) linphone_gtk_get_widget ( main_window,"viewswitch" );*/
    char *from=linphone_address_as_string ( linphone_chat_message_get_from ( msg ) );

    w= ( GtkWidget* ) g_object_get_data ( G_OBJECT ( friendlist ),"chatview" );
    if ( w!=NULL ) {
        char *from_chatview= ( char * ) g_object_get_data ( G_OBJECT ( friendlist ),"from" );
        if ( g_strcmp0 ( from,from_chatview ) ==0 ) {
            send=TRUE;
        } else {
            if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) {
                linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) );
            }
            send=FALSE;
        }
    } else {
        send=FALSE;
        if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) {
            linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) );
        }
        w=linphone_gtk_init_chatroom ( room,linphone_chat_message_get_from ( msg ) );
        g_object_set_data ( G_OBJECT ( friendlist ),"chatview", ( gpointer ) w );
        g_object_set_data ( G_OBJECT ( friendlist ),"from",from );
    }

#ifdef HAVE_GTK_OSX
    /* Notified when a new message is sent */
    linphone_gtk_status_icon_set_blinking ( TRUE );
#else
    if ( !gtk_window_is_active ( GTK_WINDOW ( main_window ) ) ) {
        if ( !GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( w ),"is_notified" ) ) ) {
            linphone_gtk_notify ( NULL,linphone_chat_message_get_text ( msg ) );
            g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( TRUE ) );
        } else {
            g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( FALSE ) );
        }
    }
#endif
    if ( send ) {
        linphone_gtk_push_text ( w,linphone_chat_message_get_from ( msg ),
                                 FALSE,room,msg,FALSE );
    }
    linphone_gtk_show_friends();

}
Example #26
0
static void ui_show (bool_t show)
{
    if (show)
    {
        if (! gtk_window_is_active ((GtkWindow *) window))
            restore_window_size ();

        gtk_window_present ((GtkWindow *) window);

        /* turn visualization back on if necessary */
        ui_infoarea_show_vis (aud_get_bool ("gtkui", "infoarea_show_vis"));
    }
    else
    {
        if (gtk_window_is_active ((GtkWindow *) window))
            save_window_size ();

        gtk_widget_hide (window);

        /* turn visualization off to reduce CPU usage */
        ui_infoarea_show_vis (FALSE);
    }
}
Example #27
0
static void
on_message_notice_event (GtkWidget* page,
			 gpointer data)
{
  ChatWindow* self = (ChatWindow*)data;
  gint num = -1;

  for (gint ii = 0;
       ii < gtk_notebook_get_n_pages (GTK_NOTEBOOK (self->priv->notebook)) ;
       ii++) {

    if (page == gtk_notebook_get_nth_page (GTK_NOTEBOOK (self->priv->notebook),
					   ii)) {

      num = ii;
      break;
    }
  }

  if (num
      != gtk_notebook_get_current_page (GTK_NOTEBOOK (self->priv->notebook))
      || !gtk_window_is_active (GTK_WINDOW (self))) {

    GtkWidget* hbox = NULL;
    GtkWidget* label = NULL;
    guint unread_count = 0;
    const gchar* base_title = NULL;
    gchar* txt = NULL;

    hbox = gtk_notebook_get_tab_label (GTK_NOTEBOOK (self->priv->notebook),
				       page);
    label = (GtkWidget*)g_object_get_data (G_OBJECT (hbox), "label-widget");
    base_title = (const gchar*)g_object_get_data (G_OBJECT (label),
						  "base-title");
    unread_count = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (label),
							"unread-count"));
    unread_count = unread_count + 1;
    g_object_set_data (G_OBJECT (label), "unread-count",
		       GUINT_TO_POINTER (unread_count));

    txt = g_strdup_printf ("[%d] %s", unread_count, base_title);
    gtk_label_set_text (GTK_LABEL (label), txt);
    g_free (txt);

    g_signal_emit (self, signals[UNREAD_ALERT], 0, NULL);
  }

  update_unread (self);
}
Example #28
0
int
fe_gui_info (session * sess, int info_type)
{
    switch (info_type) {
    case 0:
        if (!gtk_widget_get_visible (GTK_WIDGET (gui.main_window))) {
            return 2;
        }
        if (gtk_window_is_active (GTK_WINDOW (gui.main_window))) {
            return 1;
        }
        return 0;
        break;
    }

    return -1;
}
Example #29
0
void
fe_print_text (struct session *sess, char *text, time_t stamp)
{
    if (text == NULL) {
        g_warning ("NULL passed to fe_print_text.  Perhaps a misbehaving plugin?\n");
        return;
    }

    conversation_panel_print (CONVERSATION_PANEL (gui.conversation_panel),
                              sess, text, prefs.indent_nicks, stamp);
    sess->new_data = TRUE;
    navigation_model_set_hilight (gui.tree_model, sess);
    if (sess->nick_said) {
        if (!gtk_window_is_active (GTK_WINDOW (gui.main_window))) {
            gtk_window_set_urgency_hint (GTK_WINDOW (gui.main_window), TRUE);
        }
    }
}
Example #30
0
void
ui_indicator_update ()
{
	guint index;

	/* Do not update indicators if the user is interacting with the main window */
	if (!indicator_priv || gtk_window_is_active (GTK_WINDOW (liferea_shell_get_window ())))
		return;

	/* Remove all previous indicators from the menu */
	remove_all_indicators ();
	/* ...then walk the tree and add an indicator for each unread feed */
	feedlist_foreach (add_node_indicator);

	/* revert order of items */
	for (index = indicator_priv->indicators->len; index > 0; index--)
		indicate_indicator_show (g_ptr_array_index (indicator_priv->indicators, index - 1));	
}