Пример #1
0
Файл: main.c Проект: macrat/rusk
void addressbarToggle(RuskWindow *rusk)
{
	if(!gtk_widget_is_visible(GTK_WIDGET(rusk->addressbar)))
	{
		gtk_entry_set_text(rusk->addressbar, webkit_web_view_get_uri(rusk->webview));
		gtk_widget_set_visible(GTK_WIDGET(rusk->addressbar), TRUE);
		gtk_window_set_focus(rusk->window, GTK_WIDGET(rusk->addressbar));
	}else
	{
		gtk_widget_set_visible(GTK_WIDGET(rusk->addressbar), FALSE);
		gtk_window_set_focus(rusk->window, GTK_WIDGET(rusk->webview));
	}
}
Пример #2
0
wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
{
    if ( m_netFrameExtentsTimerId )
    {
        // Don't let the timer callback fire as the window pointer passed to it
        // will become invalid very soon.
        g_source_remove(m_netFrameExtentsTimerId);
    }

    if (m_grabbed)
    {
        wxFAIL_MSG(wxT("Window still grabbed"));
        RemoveGrab();
    }

    SendDestroyEvent();

    // it may also be GtkScrolledWindow in the case of an MDI child
    if (GTK_IS_WINDOW(m_widget))
    {
        gtk_window_set_focus( GTK_WINDOW(m_widget), NULL );
    }

    if (g_activeFrame == this)
        g_activeFrame = NULL;
    if (g_lastActiveFrame == this)
        g_lastActiveFrame = NULL;
}
Пример #3
0
void termit_toggle_search()
{
    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(termit.b_toggle_search))) {
        gtk_widget_show(termit.search_entry);
        gtk_widget_show(termit.b_find_prev);
        gtk_widget_show(termit.b_find_next);
        gtk_window_set_focus(GTK_WINDOW(termit.main_window), termit.search_entry);
    } else {
        gtk_widget_hide(termit.search_entry);
        gtk_widget_hide(termit.b_find_prev);
        gtk_widget_hide(termit.b_find_next);
        gint page = gtk_notebook_get_current_page(GTK_NOTEBOOK(termit.notebook));
        TERMIT_GET_TAB_BY_INDEX(pTab, page, return);
        gtk_window_set_focus(GTK_WINDOW(termit.main_window), pTab->vte);
    }
}
Пример #4
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1set_1focus
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jlong _focus
)
{
	GtkWindow* self;
	GtkWidget* focus;

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

	// convert parameter focus
	focus = (GtkWidget*) _focus;

	// call function
	gtk_window_set_focus(self, focus);

	// cleanup parameter self

	// cleanup parameter focus
}
Пример #5
0
static void mate_app_activate_statusbar(MateApp *app)
{
  gtk_window_set_focus(GTK_WINDOW(app),
		       mate_appbar_get_status(MATE_APPBAR(app->statusbar)));
  gtk_window_activate_focus(GTK_WINDOW(app));
  gdk_window_raise(GTK_WIDGET(app)->window);
}
Пример #6
0
gboolean
git_pane_check_input (GtkWidget *parent, GtkWidget *widget, const gchar *input,
                      const gchar *error_message)
{
	gboolean ret;
	GtkWidget *dialog;

	ret = FALSE;

	if (input)
	{
		if (strlen (input) > 0)
			ret = TRUE;
	}

	if (!ret)
	{
		dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
										 GTK_DIALOG_DESTROY_WITH_PARENT,
										 GTK_MESSAGE_WARNING,
										 GTK_BUTTONS_OK,
		                                 "%s",
										 error_message);

		gtk_dialog_run (GTK_DIALOG (dialog));
		gtk_widget_destroy (dialog);

		gtk_window_set_focus (GTK_WINDOW (parent), widget);
	}


	return ret;
}
Пример #7
0
static void
contacts_edit_pane_hide (ContactsData *data)
{
	GtkWidget *widget;
	GtkWindow *window;

	/* All changed are instant-apply, so just remove the edit components
	 * and switch back to main view.
	 */
	window = GTK_WINDOW (data->ui->main_window);
	widget = data->ui->edit_table;
	gtk_container_foreach (GTK_CONTAINER (widget),
			       (GtkCallback)contacts_remove_edit_widgets_cb,
			       widget);
	if ((widget = data->ui->contact_menu))
		gtk_widget_hide (widget);
	if ((widget = data->ui->contacts_menu))
		gtk_widget_show (widget);
	widget = data->ui->main_notebook;
	gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
	gtk_window_set_title (window, _("Contacts"));
	contacts_set_available_options (data, TRUE, TRUE, TRUE);
	if (data->ui->edit_button)
		gtk_window_set_default (window, data->ui->edit_button);
	if ((widget = data->ui->search_entry) && GTK_WIDGET_VISIBLE (widget))
		gtk_window_set_focus (window, data->ui->search_entry);
}
Пример #8
0
gboolean 
check_input (GtkWidget *parent, GtkWidget *entry, const gchar *error_message)
{
	gchar *input;
	gboolean ret;
	GtkWidget *dialog;
	
	input = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
	
	if (strlen (input) > 0)
		ret = TRUE;
	else
	{
		dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
										 GTK_DIALOG_DESTROY_WITH_PARENT,
										 GTK_MESSAGE_WARNING,
										 GTK_BUTTONS_OK,
										 "%s", error_message);
		
		gtk_dialog_run (GTK_DIALOG (dialog));
		gtk_widget_destroy (dialog);
		
		gtk_window_set_focus (GTK_WINDOW (parent), entry);
		
		ret = FALSE;
	}
	
	g_free (input);
	
	return ret;
}
Пример #9
0
void
ViewAutoDrawer_Close(ViewAutoDrawer *that)   // IN
{
   GtkWindow *window;
   GtkWidget *focus;
   GtkWidget *toplevel;

   g_return_if_fail(VIEW_IS_AUTODRAWER(that));
   toplevel = gtk_widget_get_toplevel(GTK_WIDGET(that));

   if (!toplevel || !gtk_widget_is_toplevel(toplevel)) {
      // The autoDrawer cannot function properly without a toplevel.
      return;
   }
   window = GTK_WINDOW(toplevel);

   focus = gtk_window_get_focus(window);
   if (focus && gtk_widget_is_ancestor(focus, that->priv->evBox)) {
      gtk_window_set_focus(window, NULL);
   }

   that->priv->forceClosing = TRUE;
   that->priv->closeConnection =
      g_timeout_add(ViewDrawer_GetCloseTime(&that->parent) +
                    that->priv->delayValue,
      (GSourceFunc)ViewAutoDrawerOnCloseDelay, that);

   /* This change happens programmatically. Always react to it immediately. */
   ViewAutoDrawerUpdate(that, TRUE);
}
Пример #10
0
	inline gboolean escape_clear_focus_widget (GtkWidget* widget, GdkEventKey* event, gpointer data)
	{
		if (event->keyval == GDK_Escape) {
			gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(widget))), NULL);
			return TRUE;
		}
		return FALSE;
	}
Пример #11
0
static void
gimp_dialog_hide (GtkWidget *widget)
{
  /*  set focus to NULL so focus_out callbacks are invoked synchronously  */
  gtk_window_set_focus (GTK_WINDOW (widget), NULL);

  GTK_WIDGET_CLASS (parent_class)->hide (widget);
}
Пример #12
0
void ChromeClient::unfocus()
{
    if (!m_webView)
        return;
    GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
    if (window)
        gtk_window_set_focus(GTK_WINDOW(window), NULL);
}
Пример #13
0
static void
extspinbutton_value_changed (GtkSpinButton *spin)
{
    if(gtk_window_get_focus(GTK_WINDOW(mainwindow))) {
	// Should only do this if this widget is really in the main window.
	gtk_window_set_focus(GTK_WINDOW(mainwindow), NULL);
    }
}
Пример #14
0
gint MainBoxConversionEvent(GtkWidget *widget, GdkEvent event, gpointer data)
{
    MainBoxUnfocus();
    gtk_entry_set_text(GTK_ENTRY(conversionbox.file),
                       gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
    gtk_window_set_focus(GTK_WINDOW(conversionbox.window), conversionbox.file);
    gtk_widget_show_all(conversionbox.window);
    return(TRUE);
} // END MainBoxBrowseEvent()
Пример #15
0
Файл: main.c Проект: macrat/rusk
void inSiteSearchToggle(RuskWindow *rusk)
{
	if(!gtk_widget_is_visible(GTK_WIDGET(rusk->insiteSearch)))
	{
		gtk_widget_set_visible(GTK_WIDGET(rusk->insiteSearch), TRUE);
		gtk_window_set_focus(rusk->window, GTK_WIDGET(rusk->insiteSearch));

		WebKitFindController *finder = webkit_web_view_get_find_controller(rusk->webview);
		runInSiteSearch(rusk, webkit_find_controller_get_search_text(finder), TRUE);

		webkit_find_controller_search_previous(finder);
	}else
	{
		webkit_find_controller_search_finish(webkit_web_view_get_find_controller(rusk->webview));
		gtk_widget_set_visible(GTK_WIDGET(rusk->insiteSearch), FALSE);
		gtk_window_set_focus(rusk->window, GTK_WIDGET(rusk->webview));
	}
}
Пример #16
0
static gboolean callback_filter_grab_unselected(GtkWidget* widget, gpointer data)
{
    if(!g_MainWindow.accelUnsafeActive)
        {
        gtk_window_add_accel_group(GTK_WINDOW(g_MainWindow.window), g_MainWindow.accelUnsafe);
        g_MainWindow.accelUnsafeActive = TRUE;
        }
    gtk_window_set_focus(GTK_WINDOW(g_MainWindow.window), NULL);
    return FALSE;
}
Пример #17
0
static gboolean panel_menu_bar_hide_tooltip_and_focus(GtkWidget* widget, PanelMenuBar* menubar)
{
	/* remove focus that would be drawn on the currently focused child of
	 * the toplevel. See bug#308632. */
	gtk_window_set_focus(GTK_WINDOW(menubar->priv->panel->toplevel), NULL);

	g_object_set(widget, "has-tooltip", FALSE, NULL);

	return FALSE;
}
void
x_unfocus_widget (Widget_Item *p)
{
	GtkWidget *w = get_gtk_widget (p);
	GtkWidget *toplevel = gtk_widget_get_toplevel (w);

	/* Only happens if the widget is not yet added to its container */
	/* I am not yet sure why this happens */
	if (GTK_IS_WINDOW (toplevel))
		gtk_window_set_focus (GTK_WINDOW (gtk_widget_get_toplevel (w)), NULL);
}
Пример #19
0
/* Sets focus to widget */
int
clip_GTK_WINDOWSETFOCUS(ClipMachine * cm)
{
	C_widget *cwin  = _fetch_cw_arg(cm);
	C_widget *cwid  = _fetch_cwidget(cm,_clip_spar(cm,2));
	CHECKARG2(2,MAP_t,NUMERIC_t);
	CHECKCWID(cwin,GTK_IS_WINDOW); CHECKCWID(cwid,GTK_IS_WIDGET);
	gtk_window_set_focus(GTK_WINDOW(cwin->widget),cwid->widget);
	return 0;
err:
	return 1;
}
Пример #20
0
/* Workaround GTK+ 2.0 focus slipping problem. */
void
gtk_utils_workaround_set_default_response (GtkDialog *dialog, gint response_id)
{
  GtkWidget *focused_widget = gtk_window_get_focus (GTK_WINDOW (dialog));

  gtk_dialog_set_default_response (dialog, response_id);

  /* Can't use gtk_widget_grab_focus() since `focused_widget' can be
   * NULL.
   */
  gtk_window_set_focus (GTK_WINDOW (dialog), focused_widget);
}
Пример #21
0
void notification_trayicon_on_activate(GtkStatusIcon *status_icon, gpointer user_data)
{
  MainWindow *mainwin = mainwindow_get_mainwindow();

  if(mainwin && gtk_widget_get_visible(GTK_WIDGET(mainwin->window)) == TRUE)
    focused_widget = gtk_window_get_focus(GTK_WINDOW(mainwin->window));

  notification_toggle_hide_show_window();

  if(mainwin && gtk_widget_get_visible(GTK_WIDGET(mainwin->window)) == TRUE)
    gtk_window_set_focus(GTK_WINDOW(mainwin->window), focused_widget);
}
Пример #22
0
void MainBoxRefocus()
{
	GdkEvent event;

	MainBoxFile1Event(NULL, event, NULL);
	MainBoxFile2Event(NULL, event, NULL);

	gtk_widget_set_sensitive(mainbox.file1, TRUE);
	gtk_widget_set_sensitive(mainbox.file2, TRUE);
	gtk_widget_set_sensitive(mainbox.okbutton, TRUE);
	gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.file1);
	gtk_window_deiconify(GTK_WINDOW(mainbox.window));
} // END MainBoxRefocus()
Пример #23
0
static void _mouse_over_image_callback(gpointer instace, gpointer user_data)
{
  const dt_lib_module_t *self = (dt_lib_module_t *)user_data;
  const dt_lib_metadata_t *d = (dt_lib_metadata_t *)self->data;

  /* lets trigger an expose for a redraw of widget */
  if(d->editing)
  {
    write_metadata(user_data);
    gtk_window_set_focus(GTK_WINDOW(dt_ui_main_window(darktable.gui->ui)), NULL);
  }
  gtk_widget_queue_draw(GTK_WIDGET(self->widget));
}
Пример #24
0
static void
presence_chooser_set_status_editing (EmpathyPresenceChooser *self,
                                     gboolean editing)
{
	EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
	GtkWidget *entry;

	if (priv->block_set_editing) {
		return;
	}

	entry = gtk_bin_get_child (GTK_BIN (self));
	if (editing) {
		priv->editing_status = TRUE;

		gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
					       GTK_ENTRY_ICON_SECONDARY,
					       GTK_STOCK_OK);
		gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry),
						 GTK_ENTRY_ICON_SECONDARY,
						 _("Set status"));
		gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
					      GTK_ENTRY_ICON_PRIMARY,
					      FALSE);
	} else {
		GtkWidget *window;

		presence_chooser_set_favorite_icon (self);
		gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
					      GTK_ENTRY_ICON_PRIMARY,
					      TRUE);

		/* attempt to get the toplevel for this widget */
		window = gtk_widget_get_toplevel (GTK_WIDGET (self));
		if (GTK_WIDGET_TOPLEVEL (window) && GTK_IS_WINDOW (window)) {
			/* unset the focus */
			gtk_window_set_focus (GTK_WINDOW (window), NULL);
		}

		/* see presence_chooser_entry_focus_out_cb ()
		 * for what this does */
		if (priv->focus_out_idle_source != 0) {
			g_source_remove (priv->focus_out_idle_source);
			priv->focus_out_idle_source = 0;
		}

		gtk_editable_set_position (GTK_EDITABLE (entry), 0);

		priv->editing_status = FALSE;
	}
}
Пример #25
0
static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
  const dt_lib_module_t *self = (dt_lib_module_t *)user_data;
  dt_lib_metadata_t *d = (dt_lib_metadata_t *)self->data;

  switch(event->keyval)
  {
    case GDK_KEY_Return:
    case GDK_KEY_KP_Enter:
      write_metadata(user_data);
      gtk_window_set_focus(GTK_WINDOW(dt_ui_main_window(darktable.gui->ui)), NULL);
      break;
    case GDK_KEY_Escape:
      update(user_data, FALSE);
      gtk_window_set_focus(GTK_WINDOW(dt_ui_main_window(darktable.gui->ui)), NULL);
      break;
    case GDK_KEY_Tab:
      write_metadata(user_data);
      break;
    default:
      d->editing = TRUE;
  }
  return FALSE;
}
Пример #26
0
/* Sets focus to widget */
int
clip_GTK_WINDOWSETFOCUS(ClipMachine * ClipMachineMemory)
{
   C_widget *cwin = _fetch_cw_arg(ClipMachineMemory);

   C_widget *cwid = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(cwin, GTK_IS_WINDOW);
   CHECKCWID(cwid, GTK_IS_WIDGET);
   gtk_window_set_focus(GTK_WINDOW(cwin->widget), cwid->widget);
   return 0;
 err:
   return 1;
}
Пример #27
0
void
contacts_remove_field_cb (GtkWidget *button, gpointer data)
{
	GtkWidget *window = gtk_widget_get_toplevel (button);
	GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
	GtkWidget *ancestor = gtk_widget_get_ancestor (
		widget, GTK_TYPE_EXPANDER);
	
	gtk_window_set_focus (GTK_WINDOW (window), NULL);

	if (ancestor) {
		contacts_remove_entries (ancestor);
		return;
	}

	ancestor = gtk_widget_get_ancestor (widget, GTK_TYPE_COMBO_BOX_ENTRY);
	if (ancestor) {
		const gchar *name;
		guint top, left;
		GtkWidget *table;
		GList *c, *children;
		
		ancestor = gtk_widget_get_ancestor (
			ancestor, GTK_TYPE_EVENT_BOX);
		name = gtk_widget_get_name (ancestor);
		table = gtk_widget_get_ancestor (ancestor, GTK_TYPE_TABLE);
		gtk_container_child_get (GTK_CONTAINER (table),
			ancestor, "left-attach", &left,
			"top-attach", &top, NULL);
			
		children = gtk_container_get_children (GTK_CONTAINER (table));
		for (c = children; c; c = c->next) {
			guint ctop, cleft;
			gtk_container_child_get (GTK_CONTAINER (table),
				GTK_WIDGET (c->data),
				"left-attach", &cleft,
				"top-attach", &ctop, NULL);
			if ((cleft == left+1) && (ctop == top)) {
				contacts_remove_entries (GTK_WIDGET (c->data));
				break;
			}
		}
		g_list_free (c);
		return;
	}
	
	contacts_remove_entries (widget);
}
Пример #28
0
void MainBoxRefocus()
{
    GdkEvent event;

    MainBoxFileEvent(NULL, event, NULL);

    gtk_widget_set_sensitive(mainbox.file, TRUE);
    gtk_widget_set_sensitive(mainbox.selectbutton, TRUE);
    gtk_widget_set_sensitive(mainbox.startcheck, TRUE);
    gtk_widget_set_sensitive(mainbox.restartcheck, TRUE);
    gtk_widget_set_sensitive(mainbox.okbutton, TRUE);
    gtk_widget_set_sensitive(mainbox.devbutton, TRUE);
    gtk_widget_set_sensitive(mainbox.convbutton, TRUE);
    gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.file);
    gtk_window_deiconify(GTK_WINDOW(mainbox.window));
} // END MainBoxRefocus()
Пример #29
0
void ConversionBoxRefocus()
{
	GdkEvent event;

	ConversionBoxFileEvent(NULL, event, NULL);

	gtk_widget_set_sensitive(conversionbox.file, TRUE);
	gtk_widget_set_sensitive(conversionbox.selectbutton, TRUE);
	gtk_widget_set_sensitive(conversionbox.compress, TRUE);
	gtk_widget_set_sensitive(conversionbox.multi, TRUE);
	gtk_widget_set_sensitive(conversionbox.okbutton, TRUE);
	gtk_widget_set_sensitive(conversionbox.cancelbutton, TRUE);
	gtk_window_set_focus(GTK_WINDOW(conversionbox.window), conversionbox.file);
	gtk_widget_show_all(conversionbox.window);
	gtk_window_deiconify(GTK_WINDOW(conversionbox.window));
} // END ConversionBoxRefocus()
Пример #30
0
void DeviceBoxRefocus()
{
	GdkEvent event;
	DeviceBoxDeviceEvent(NULL, event, NULL);
	DeviceBoxFileEvent(NULL, event, NULL);
	gtk_widget_set_sensitive(devicebox.device, TRUE);
	gtk_widget_set_sensitive(devicebox.file, TRUE);
	gtk_widget_set_sensitive(devicebox.selectbutton, TRUE);
	gtk_widget_set_sensitive(devicebox.compress, TRUE);
	gtk_widget_set_sensitive(devicebox.multi, TRUE);
	gtk_widget_set_sensitive(devicebox.okbutton, TRUE);
	gtk_widget_set_sensitive(devicebox.cancelbutton, TRUE);
	gtk_window_set_focus(GTK_WINDOW(devicebox.window), devicebox.file);
	gtk_widget_show_all(devicebox.window);
	gtk_window_deiconify(GTK_WINDOW(devicebox.window));
} // END DeviceBoxRefocus()