Esempio n. 1
0
static void
mate_volume_applet_dock_init (MateVolumeAppletDock *dock)
{
  dock->orientation = -1;
  dock->timeout = 0;

#if 1
  /* We can't use a simple GDK_WINDOW_TYPE_HINT_DOCK here since
   * the dock windows don't accept input by default. Instead we use
   * the popup menu type. In the end we set everything by hand anyway
   * since what happens depends very heavily on the window manager. */
//  gtk_window_set_type_hint (GTK_WINDOW (dock),
//      			    GDK_WINDOW_TYPE_HINT_POPUP_MENU);
  gtk_window_set_keep_above (GTK_WINDOW (dock), TRUE);
  gtk_window_set_decorated (GTK_WINDOW (dock), FALSE);
  gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dock), TRUE);
  gtk_window_set_skip_pager_hint (GTK_WINDOW (dock), TRUE);
  gtk_window_set_resizable (GTK_WINDOW (dock), FALSE);
  gtk_window_stick (GTK_WINDOW (dock));
#else
  /* This works well, except that keyboard focus is impossible. */
  gtk_window_set_type_hint (GTK_WINDOW (dock),
      			    GDK_WINDOW_TYPE_HINT_DOCK);
  gtk_window_set_decorated (GTK_WINDOW (dock), FALSE);
  gtk_window_set_resizable (GTK_WINDOW (dock), FALSE);
  gtk_window_stick (GTK_WINDOW (dock));
  GTK_WIDGET_SET_FLAGS (dock, GTK_CAN_FOCUS);
#endif
}
Esempio n. 2
0
void gMainWindow::showPopup(int x, int y)
{
  gMainWindow *save;
	bool has_border;
	int oldx, oldy;
	//int type;
	
	if (!isTopLevel()) return;
	if (isModal()) return;
	
	//gtk_widget_unrealize(border);
	//((GtkWindow *)border)->type = GTK_WINDOW_POPUP;
	//gtk_widget_realize(border);

	oldx = left();
	oldy = top();
	
	has_border = gtk_window_get_decorated(GTK_WINDOW(border));
	//type = getType();
	
	//setType(_NET_WM_WINDOW_TYPE_COMBO);
	gtk_window_set_decorated(GTK_WINDOW(border), false);
	//gtk_window_set_type_hint(GTK_WINDOW(border), GDK_WINDOW_TYPE_HINT_POPUP_MENU);
	
  move(x, y);
	gtk_window_resize(GTK_WINDOW(border), bufW, bufH);
	
	//reparent(NULL, x, y, GTK_WINDOW_POPUP);

	_popup = true;
	save = _current;
	_current = this;
	
	gApplication::enterPopup(this);
	
	_current = save;
	_popup = false;
	
	if (!persistent)
	{
		destroyNow();
	}
	else
	{
		hide();
		
		//gdk_window_set_override_redirect(gtk_widget_get_window(GTK_WINDOW(border)), false);
		gtk_window_set_decorated(GTK_WINDOW(border), has_border);
		//setType(type);
		//gtk_window_set_type_hint(GTK_WINDOW(border), type);
		
		move(oldx, oldy);
	}
}
Esempio n. 3
0
static void
cheese_flash_init (CheeseFlash *self)
{
  CheeseFlashPrivate *priv = self->priv = CHEESE_FLASH_GET_PRIVATE (self);
  cairo_region_t *input_region;
  GtkWindow *window = GTK_WINDOW (self);
  const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };

  priv->flash_timeout_tag = 0;
  priv->fade_timeout_tag  = 0;

  /* make it so it doesn't look like a window on the desktop (+fullscreen) */
  gtk_window_set_decorated (window, FALSE);
  gtk_window_set_skip_taskbar_hint (window, TRUE);
  gtk_window_set_skip_pager_hint (window, TRUE);
  gtk_window_set_keep_above (window, TRUE);

  /* Don't take focus */
  gtk_window_set_accept_focus (window, FALSE);
  gtk_window_set_focus_on_map (window, FALSE);

  /* Make it white */
  gtk_widget_override_background_color (GTK_WIDGET (window), GTK_STATE_NORMAL,
                                        &white);

  /* Don't consume input */
  gtk_widget_realize (GTK_WIDGET (window));
  input_region = cairo_region_create ();
  gdk_window_input_shape_combine_region (gtk_widget_get_window (GTK_WIDGET (window)), input_region, 0, 0);
  cairo_region_destroy (input_region);
}
Esempio n. 4
0
void tooltip_window_create( GtkWidget* dock_window )
{
    eric_window* w = eric_window_create( 10, 10, "" );
    gtk_window_move( GTK_WINDOW( w->window ), 0, 1040 );
    gtk_window_set_type_hint( GTK_WINDOW( w->window ), GDK_WINDOW_TYPE_HINT_DIALOG );
    gtk_window_set_decorated( GTK_WINDOW( w->window ), FALSE );
    gtk_window_set_skip_pager_hint( GTK_WINDOW( w->window ), TRUE );
    gtk_window_set_transient_for( GTK_WINDOW( w->window ), GTK_WINDOW( dock_window ) );
    gtk_window_set_keep_above( GTK_WINDOW( w->window ), TRUE );
    
    gtk_widget_add_events( w->window, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK );
    g_signal_connect( G_OBJECT( w->window ), "focus-out-event", G_CALLBACK(tooltip_window_lose_focus), NULL );

    //Add Dock icon box
    pager_items_box = gtk_button_box_new( GTK_ORIENTATION_VERTICAL );
    gtk_button_box_set_layout( GTK_BUTTON_BOX( pager_items_box ), GTK_BUTTONBOX_CENTER );
    //gtk_button_box_set_child_non_homogeneous( GTK_BUTTON_BOX( dock_icons_box ), TRUE );
    gtk_container_add( GTK_CONTAINER( w->window ), pager_items_box );
    gtk_widget_show( pager_items_box );

    //Pango stuff
    char fontdesc[80];
    pango_context = gtk_widget_create_pango_context( w->window );
    sprintf( fontdesc, "Source Sans Pro Regular %ipx", (int)(SCALE_VALUE( 16 )) );
    PangoFontDescription* font = pango_font_description_from_string( fontdesc );
    pango_context_set_font_description( pango_context, font );

    tooltip_window = w;
}
static void
msd_osd_window_init (MsdOsdWindow *window)
{
        GdkScreen *screen;

        window->priv = MSD_OSD_WINDOW_GET_PRIVATE (window);

        screen = gtk_widget_get_screen (GTK_WIDGET (window));

        window->priv->is_composited = gdk_screen_is_composited (screen);

        if (window->priv->is_composited) {
                gdouble scalew, scaleh, scale;
                gint size;

                gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
                gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);

                /* assume 130x130 on a 640x480 display and scale from there */
                scalew = gdk_screen_get_width (screen) / 640.0;
                scaleh = gdk_screen_get_height (screen) / 480.0;
                scale = MIN (scalew, scaleh);
                size = 130 * MAX (1, scale);

                gtk_window_set_default_size (GTK_WINDOW (window), size, size);

                window->priv->fade_out_alpha = 1.0;
        } else {
		gtk_container_set_border_width (GTK_CONTAINER (window), 12);
        }
}
Esempio n. 6
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1set_1decorated
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jboolean _setting
)
{
	GtkWindow* self;
	gboolean setting;

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

	// convert parameter setting
	setting = (gboolean) _setting;

	// call function
	gtk_window_set_decorated(self, setting);

	// cleanup parameter self

	// cleanup parameter setting
}
Esempio n. 7
0
static void
nemo_blank_desktop_window_constructed (GObject *obj)
{
	AtkObject *accessible;
	NemoBlankDesktopWindow *window = NEMO_BLANK_DESKTOP_WINDOW (obj);

	G_OBJECT_CLASS (nemo_blank_desktop_window_parent_class)->constructed (obj);

	/* Set the accessible name so that it doesn't inherit the cryptic desktop URI. */
	accessible = gtk_widget_get_accessible (GTK_WIDGET (window));

	if (accessible) {
		atk_object_set_name (accessible, _("Desktop"));
	}

    nemo_blank_desktop_window_update_geometry (window);

    gtk_window_set_resizable (GTK_WINDOW (window),
                  FALSE);
    gtk_window_set_decorated (GTK_WINDOW (window),
                  FALSE);

    gtk_widget_show_all (GTK_WIDGET (window));

    g_signal_connect (GTK_WIDGET (window), "button-press-event", G_CALLBACK (on_button_press), window);
    g_signal_connect (GTK_WIDGET (window), "popup-menu", G_CALLBACK (on_popup_menu), window);
}
Esempio n. 8
0
int main( int   argc, char *argv[] )
{
    GtkWidget *window;
    GtkWidget *button;
   
    /* init the program */
    gtk_init (&argc, &argv);
       
    /* make a new button */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    window = gtk_window_new (GTK_WINDOW_POPUP);
    gtk_window_resize(GTK_WINDOW(window), 250, 250);
    gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
    gtk_window_set_opacity(GTK_WINDOW(window), 0.5);

    g_signal_connect (G_OBJECT (window), "destroy",
        G_CALLBACK (gtk_main_quit), NULL);
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);
   
    /* make a new button */
    button = gtk_button_new_with_label ("Hello World");
    g_signal_connect (G_OBJECT (button), "clicked",
        G_CALLBACK (hello), NULL);
   
    /* add the button to the window */
    gtk_container_add (GTK_CONTAINER (window), button);
       
    /* show the widgets */
    gtk_widget_show (button);
    gtk_widget_show (window);
      
    gtk_main ();
   
    return 0;
}
Esempio n. 9
0
static GtkWidget *show_video_controls(GtkWidget *video_window){
	GtkWidget *w;
	w=(GtkWidget*)g_object_get_data(G_OBJECT(video_window),"controls");
	if (!w){
		gboolean isfullscreen=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(video_window),"fullscreen"));
		const char *stock_button=isfullscreen ? GTK_STOCK_LEAVE_FULLSCREEN : GTK_STOCK_FULLSCREEN;
		gint response_id=isfullscreen ? GTK_RESPONSE_NO : GTK_RESPONSE_YES ;
		GtkWidget *image = gtk_image_new_from_icon_name(linphone_gtk_get_ui_config("stop_call_icon_name","linphone-stop-call"), GTK_ICON_SIZE_BUTTON);
		GtkWidget *button;
		w=gtk_dialog_new_with_buttons("",GTK_WINDOW(video_window),GTK_DIALOG_DESTROY_WITH_PARENT,stock_button,response_id,NULL);
		gtk_window_set_opacity(GTK_WINDOW(w),0.5);
		gtk_window_set_decorated(GTK_WINDOW(w),FALSE);
		button=gtk_button_new_with_label(_("Hang up"));
		gtk_button_set_image(GTK_BUTTON(button), image);
		gtk_widget_show(button);
		gtk_dialog_add_action_widget(GTK_DIALOG(w),button,GTK_RESPONSE_REJECT);
		button=gtk_button_new_with_label(_("Take screenshot"));
		image = gtk_image_new_from_icon_name("linphone-take-screenshot", GTK_ICON_SIZE_BUTTON);
		gtk_button_set_image(GTK_BUTTON(button), image);
		gtk_widget_show(button);
		gtk_dialog_add_action_widget(GTK_DIALOG(w),button,GTK_RESPONSE_APPLY);
		g_signal_connect(w,"response",(GCallback)on_controls_response,video_window);
		schedule_video_controls_disapearance(w);
		g_signal_connect(w,"destroy",(GCallback)on_controls_destroy,NULL);
		g_object_set_data(G_OBJECT(w),"video_window",video_window);
		g_object_set_data(G_OBJECT(video_window),"controls",w);
		set_video_controls_position(video_window);
		gtk_widget_show(w);
	}else{
		schedule_video_controls_disapearance(w);
	}
	return w;
}
Esempio n. 10
0
void fx_search_initialize(FxSearch *search , GtkTreeModel *model
		, const char *str , int x , int y)
{
	GtkWidget *frame;

	search->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_decorated(GTK_WINDOW(search->window) , FALSE);
	gtk_window_set_type_hint(GTK_WINDOW(search->window), GDK_WINDOW_TYPE_HINT_DIALOG);
//	gtk_widget_set_name(search->window , "mainwindow");
	gtk_window_set_default_size(GTK_WINDOW(search->window) , 240 , 60);
        gtk_window_set_skip_taskbar_hint (GTK_WINDOW(search->window), TRUE);
	gtk_window_move(GTK_WINDOW(search->window) , x , y);
	g_signal_connect(search->window , "focus-out-event"
			, GTK_SIGNAL_FUNC(window_focus_out) , search);

	frame = gtk_frame_new(NULL);
	gtk_frame_set_shadow_type(GTK_FRAME(frame) , GTK_SHADOW_ETCHED_IN);

	GtkTreeModel *nmodel = create_model(model , str);
	search->view = gtk_tree_view_new_with_model(nmodel);

	gtk_widget_set_usize(search->view , 320 , 0);
	create_column(search->view , search->fxmain);
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(search->view) , FALSE);
 	//gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (search->view), TRUE);
	gtk_tree_view_set_hover_selection(GTK_TREE_VIEW(search->view) , TRUE);
	gtk_container_add(GTK_CONTAINER(search->window) , frame);
	gtk_container_add(GTK_CONTAINER(frame) , search->view);

	g_signal_connect(search->view , "row-activated" , G_CALLBACK(row_activate_func) , search);
	g_signal_connect(search->view , "button-press-event" , G_CALLBACK(button_press_func) , search);
	g_signal_connect(search->view , "key-press-event" , G_CALLBACK(key_press_func) , search);

	gtk_widget_show_all(search->window);
}
Esempio n. 11
0
static gint
luaH_window_newindex(lua_State *L, luapdf_token_t token)
{
    widget_t *w = luaH_checkwidget(L, 1);

    switch(token)
    {
      LUAPDF_WIDGET_BIN_NEWINDEX_COMMON(w)

      case L_TK_DECORATED:
        gtk_window_set_decorated(GTK_WINDOW(w->widget),
                luaH_checkboolean(L, 3));
        break;

      case L_TK_TITLE:
        gtk_window_set_title(GTK_WINDOW(w->widget),
            luaL_checkstring(L, 3));
        break;

      case L_TK_ICON:
        gtk_window_set_icon_from_file(GTK_WINDOW(w->widget),
            luaL_checkstring(L, 3), NULL);
        break;

      default:
        return 0;
    }

    return luaH_object_emit_property_signal(L, 1);
}
Esempio n. 12
0
float_shape_t *make_shape_from_pixbuf(GdkPixbuf *pixbuf)
{
   float_shape_t *s = alloc_shape();
   s->x = 0;
   s->y = 0;
   s->pixbuf = pixbuf;
   s->width = gdk_pixbuf_get_width(pixbuf);
   s->height = gdk_pixbuf_get_height(pixbuf);
   
   s->window = gtk_window_new(GTK_WINDOW_POPUP);
   gtk_window_set_decorated(GTK_WINDOW(s->window), FALSE);
   gtk_window_set_title(GTK_WINDOW(s->window), "shape");
   gtk_window_set_skip_taskbar_hint(GTK_WINDOW(s->window), TRUE);
   gtk_window_set_keep_above(GTK_WINDOW(s->window), TRUE);
   
   s->image = gtk_image_new_from_pixbuf(pixbuf);
   gtk_container_add(GTK_CONTAINER(s->window), s->image);

   get_alpha_mask(s);
   gtk_widget_shape_combine_mask(s->window, s->mask_bitmap, 0, 0);
   
   g_signal_connect(G_OBJECT(s->window), "destroy",
                    G_CALLBACK(quit_callback), NULL);

   return s;
}
Esempio n. 13
0
static void
cheese_flash_init (CheeseFlash *self)
{
  CheeseFlashPrivate *priv = CHEESE_FLASH_GET_PRIVATE (self);

  GtkWindow *window;

  priv->flash_timeout_tag = 0;
  priv->fade_timeout_tag  = 0;

  window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_POPUP));

  /* make it so it doesn't look like a window on the desktop (+fullscreen) */
  gtk_window_set_decorated (window, FALSE);
  gtk_window_set_skip_taskbar_hint (window, TRUE);
  gtk_window_set_skip_pager_hint (window, TRUE);
  gtk_window_set_keep_above (window, TRUE);

  /* Don't take focus */
  gtk_window_set_accept_focus (window, FALSE);
  gtk_window_set_focus_on_map (window, FALSE);

  /* Don't consume input */
  gtk_widget_realize (GTK_WIDGET (window));
  GdkRegion *input_region;
  input_region = gdk_region_new ();
  gdk_window_input_shape_combine_region (gtk_widget_get_window (GTK_WIDGET (window)), input_region, 0, 0);
  gdk_region_destroy (input_region);

  g_signal_connect (G_OBJECT (window), "expose-event", G_CALLBACK (cheese_flash_window_expose_event_cb), NULL);
  priv->window = window;
}
Esempio n. 14
0
/* Display a window containing the standard calendar widget. */
static GtkWidget * dclock_create_calendar(DClockPlugin * dc)
{
    /* Create a new window. */
    GtkWidget * win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(win), 180, 180);
    gtk_window_set_decorated(GTK_WINDOW(win), FALSE);
    gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(win), 5);
    gtk_window_set_skip_taskbar_hint(GTK_WINDOW(win), TRUE);
    gtk_window_set_skip_pager_hint(GTK_WINDOW(win), TRUE);
    gtk_window_stick(GTK_WINDOW(win));

    /* Create a vertical box as a child of the window. */
    GtkWidget * box = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(box));

    /* Create a standard calendar widget as a child of the vertical box. */
    GtkWidget * calendar = gtk_calendar_new();
    gtk_calendar_display_options(
        GTK_CALENDAR(calendar),
        GTK_CALENDAR_SHOW_WEEK_NUMBERS | GTK_CALENDAR_SHOW_DAY_NAMES | GTK_CALENDAR_SHOW_HEADING);
    gtk_box_pack_start_defaults(GTK_BOX(box), calendar);

    /* Connect signals. */
    g_signal_connect(G_OBJECT(win), "map", G_CALLBACK(dclock_popup_map), dc);

    /* Return the widget. */
    return win;
}
Esempio n. 15
0
int main(int argc, char** argv) {
  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size(GTK_WINDOW(window), HEIGHT, WIDTH);
  // hardwired position GTK_WIN_POS_CENTER_ALWAYS
  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ALWAYS);

  g_signal_connect(window, "key-press-event", G_CALLBACK(on_key_press), NULL);
  g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

  web_view = WEBKIT_WEB_VIEW(webkit_web_view_new());

  signal(SIGHUP, reload_browser);

  gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(web_view));

  webkit_web_view_load_uri(web_view, DEFAULT_URL);
  
  // maximize()
  gtk_window_maximize(GTK_WINDOW(window));
  gtk_window_fullscreen(GTK_WINDOW(window));
  gtk_window_set_decorated(GTK_WINDOW(window), FALSE);

  gtk_widget_show_all(window);
  gtk_main();

  return 0;
}
Esempio n. 16
0
int main(int argc, char *argv[])
{
    GtkWidget *window;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_default_size(GTK_WINDOW(window), 230, 150);
    gtk_window_set_title(GTK_WINDOW(window), "Drag & drop");
    gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
    gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);

    g_signal_connect(G_OBJECT(window), "button-press-event",
        G_CALLBACK(on_button_press), NULL);

    g_signal_connect_swapped(G_OBJECT(window), "destroy",
        G_CALLBACK(gtk_main_quit), G_OBJECT(window));

    gtk_widget_show(window);

    gtk_main();

    return 0;
}
Esempio n. 17
0
/* Splash Screen Initialization Function */
void splash_screen_start(void)
{
    GtkWidget *image, *vbox, *ver_lbl;
    GdkColor color;
    GdkPixbuf *pixbuf;
    gchar *version_string;

    // Is Splash Screen started?
    if (splashscreen.enabled == 1)
        return;

    // Make the Splash Screen
     splashscreen.splash = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     gtk_window_set_title(GTK_WINDOW(splashscreen.splash), "GFM Loading...");
     gtk_window_set_position(GTK_WINDOW(splashscreen.splash), GTK_WIN_POS_CENTER_ALWAYS);
     gtk_window_set_decorated(GTK_WINDOW(splashscreen.splash), FALSE);
     gtk_window_set_role(GTK_WINDOW(splashscreen.splash), "splash");
     gtk_window_set_resizable(GTK_WINDOW(splashscreen.splash), FALSE);
     gtk_window_set_default_size(GTK_WINDOW(splashscreen.splash), 150, 110); // 150x110 pixels

     // Set the Colors
     color.red = 65535;
     color.green = 65535;
     color.blue = 65535;
     gtk_widget_modify_bg(splashscreen.splash, GTK_STATE_NORMAL, &color);

     // Create a VBOX
     vbox = gtk_vbox_new(FALSE, 0);
     gtk_container_add(GTK_CONTAINER(splashscreen.splash), vbox);
     gtk_widget_show(vbox);

     // Set the Text Label
     splashscreen.text = gtk_label_new(_("Starting Group File Manager..."));
     gtk_box_pack_end(GTK_BOX(vbox), splashscreen.text, FALSE, FALSE, 0);
     gtk_widget_show(splashscreen.text);

     // Set the Version
     version_string = g_strconcat("Version ", GFM_VERSION, NULL);
     ver_lbl = gtk_label_new(version_string);
     gtk_box_pack_end(GTK_BOX(vbox), ver_lbl, FALSE, FALSE, 0);
     gtk_widget_show(ver_lbl);
     g_free(version_string);

     // Setup the Splash Logo
     pixbuf = create_pixbuf("gfm.xpm");
     image = gtk_image_new_from_pixbuf(pixbuf);
     gtk_box_pack_end(GTK_BOX(vbox), image, FALSE, FALSE, 0);
     g_object_unref(pixbuf);

     // Lets show the Splash Screen now
     gtk_widget_show(image);
     gtk_widget_show(splashscreen.splash);

     // Lets Make sure this works
     GTK_REFRESH(); // Defintion in support.h

     // Ok, done
     splashscreen.enabled = 1;
     return;
}
Esempio n. 18
0
void ami_desktop_init(AmiDesktop *desktop) {

    gint sw, sh;

    gtk_window_set_screen(GTK_WINDOW(desktop->window), desktop->gscreen);
    gtk_window_set_title(GTK_WINDOW(desktop->window), "Desktop");
    gtk_window_set_type_hint(GTK_WINDOW(desktop->window), GDK_WINDOW_TYPE_HINT_DESKTOP);
    gtk_window_set_accept_focus(GTK_WINDOW(desktop->window), FALSE);

    sw = gdk_screen_get_width(desktop->gscreen);
    sh = gdk_screen_get_height(desktop->gscreen);

    gtk_widget_set_size_request(GTK_WIDGET(desktop->window), sw, sh);
    gtk_window_resize(GTK_WINDOW(desktop->window), sw, sh);
    gtk_window_move(GTK_WINDOW(desktop->window), 0, 0);
    gtk_window_set_resizable(GTK_WINDOW(desktop->window), FALSE);

    gtk_widget_set_events(desktop->window, GDK_BUTTON_RELEASE_MASK | GDK_KEY_RELEASE_MASK);

    ami_desktop_connect_signals(desktop);
    ami_desktop_set_background(desktop);

    gtk_widget_show_all(desktop->window);
    gtk_widget_queue_draw(GTK_WIDGET(desktop->window));

    gtk_window_set_decorated(GTK_WINDOW(desktop->window), FALSE);
}
Esempio n. 19
0
static void
_lib_geotagging_show_offset_window(GtkWidget *widget, dt_lib_module_t *self)
{
  dt_lib_geotagging_t *d = self->data;
  gint x, y;
  gint px, py, center_w, center_h, window_w, window_h;
  GtkWidget *window = dt_ui_main_window(darktable.gui->ui);
  GtkWidget *center = dt_ui_center(darktable.gui->ui);
  gdk_window_get_origin(gtk_widget_get_window(center), &px, &py);

  center_w = gdk_window_get_width(gtk_widget_get_window(center));
  center_h = gdk_window_get_height(gtk_widget_get_window(center));

  d->floating_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_can_focus(d->floating_window, TRUE);
  gtk_window_set_decorated(GTK_WINDOW(d->floating_window), FALSE);
  gtk_window_set_type_hint(GTK_WINDOW(d->floating_window), GDK_WINDOW_TYPE_HINT_POPUP_MENU);
  gtk_window_set_transient_for(GTK_WINDOW(d->floating_window), GTK_WINDOW(window));
  gtk_window_set_opacity(GTK_WINDOW(d->floating_window), 0.8);
  gtk_window_set_modal(GTK_WINDOW(d->floating_window), TRUE);

  GtkWidget *alignment = gtk_alignment_new(0.5, 0.5, 1, 1);
  gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 5, 5, 5);
  GtkWidget *vbox = gtk_vbox_new(TRUE, 5);
  gtk_container_add(GTK_CONTAINER(alignment), vbox);

  d->floating_window_entry = gtk_entry_new();
  gtk_widget_add_events(d->floating_window_entry, GDK_FOCUS_CHANGE_MASK);
  g_signal_connect_swapped(d->floating_window, "focus-out-event", G_CALLBACK(gtk_widget_destroy), d->floating_window);
  g_object_set(G_OBJECT(d->floating_window_entry), "tooltip-text", _("enter the time shown on the selected picture\nformat: hh:mm:ss"), (char *)NULL);

  gtk_editable_select_region(GTK_EDITABLE(d->floating_window_entry), 0, -1);
  gtk_box_pack_start(GTK_BOX(vbox), d->floating_window_entry, TRUE, TRUE, 0);
  g_signal_connect(d->floating_window_entry, "key-press-event", G_CALLBACK(_lib_geotagging_floating_key_press), self);

  GtkWidget *hbox = gtk_hbox_new(TRUE, 5);
  GtkWidget *cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
  GtkWidget *ok_button = gtk_button_new_from_stock(GTK_STOCK_OK);

  gtk_box_pack_start(GTK_BOX(hbox), cancel_button, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(hbox), ok_button, TRUE, TRUE, 0);
  g_signal_connect_swapped(G_OBJECT(cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), d->floating_window);
  g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(_lib_geotagging_calculate_offset_callback), self);

  gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);

  gtk_container_add(GTK_CONTAINER(d->floating_window), alignment);

  gtk_widget_show_all(d->floating_window);
  gtk_widget_grab_focus(d->floating_window_entry);

  window_w = gdk_window_get_width(gtk_widget_get_window(d->floating_window));
  window_h = gdk_window_get_height(gtk_widget_get_window(d->floating_window));

  x = px + 0.5*(center_w-window_w);
  y = py + center_h - 20 - window_h;
  gtk_window_move(GTK_WINDOW(d->floating_window), x, y);

  gtk_window_present(GTK_WINDOW(d->floating_window));
}
Esempio n. 20
0
int
ShowProgressUI()
{
  if (!sEnableUI)
    return -1;

  // Only show the Progress UI if the process is taking a significant amount of
  // time where a significant amount of time is defined as .5 seconds after
  // ShowProgressUI is called sProgress is less than 70.
  usleep(500000);

  if (sQuit || sProgressVal > 70.0f)
    return 0;

  char ini_path[PATH_MAX];
  snprintf(ini_path, sizeof(ini_path), "%s.ini", sProgramPath);

  StringTable strings;
  if (ReadStrings(ini_path, &strings) != OK)
    return -1;

  sWin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  if (!sWin)
    return -1;

  static GdkPixbuf *pixbuf;
  char icon_path[PATH_MAX];
  snprintf(icon_path, sizeof(icon_path), "%s.png", sProgramPath);

  g_signal_connect(G_OBJECT(sWin), "delete_event",
                   G_CALLBACK(OnDeleteEvent), NULL);

  gtk_window_set_title(GTK_WINDOW(sWin), strings.title);
  gtk_window_set_type_hint(GTK_WINDOW(sWin), GDK_WINDOW_TYPE_HINT_DIALOG);
  gtk_window_set_position(GTK_WINDOW(sWin), GTK_WIN_POS_CENTER_ALWAYS);
  gtk_window_set_resizable(GTK_WINDOW(sWin), FALSE);
  gtk_window_set_decorated(GTK_WINDOW(sWin), TRUE);
  gtk_window_set_deletable(GTK_WINDOW(sWin),FALSE);
  pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL);
  gtk_window_set_icon(GTK_WINDOW(sWin), pixbuf);
  g_object_unref(pixbuf);

  GtkWidget *vbox = gtk_vbox_new(TRUE, 6);
  sLabel = gtk_label_new(strings.info);
  gtk_misc_set_alignment(GTK_MISC(sLabel), 0.0f, 0.0f);
  sProgressBar = gtk_progress_bar_new();

  gtk_box_pack_start(GTK_BOX(vbox), sLabel, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox), sProgressBar, TRUE, TRUE, 0);

  sTimerID = g_timeout_add(TIMER_INTERVAL, UpdateDialog, NULL);

  gtk_container_set_border_width(GTK_CONTAINER(sWin), 10);
  gtk_container_add(GTK_CONTAINER(sWin), vbox);
  gtk_widget_show_all(sWin);

  gtk_main();
  return 0;
}
Esempio n. 21
0
int
setupwindow()
{
  GdkPixmap *background;
  GdkPixbuf *pixbuf;
  GdkPixbuf *scaled;
  GdkScreen *screen;
  GdkColormap *colormap;
  GError *error=NULL;
  GtkStyle *style;

  window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  g_signal_connect(G_OBJECT(window), "expose_event", G_CALLBACK(expose_window),NULL);
  gtk_window_set_title(GTK_WINDOW(window), "clock");
  gtk_window_stick(GTK_WINDOW(window));
  gtk_window_set_resizable(GTK_WINDOW(window),TRUE);
  gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window),TRUE);
  gtk_window_set_keep_above(GTK_WINDOW(window),TRUE);
  gtk_container_set_border_width(GTK_CONTAINER(window), 3);
  gtk_window_set_decorated(GTK_WINDOW(window),TRUE);
  gtk_window_set_default_size(GTK_WINDOW(window),100,100);
  gtk_widget_set_app_paintable(window,TRUE);

  /* Get the screen to get the colormap */
  screen=gtk_widget_get_screen(window);
  colormap = gdk_screen_get_rgba_colormap(screen);
  if(colormap != NULL){
    alpha_channel_support=TRUE;
  } else {
    alpha_channel_support=FALSE;
    colormap=gdk_screen_get_rgb_colormap(screen);
    g_print("Sorry, no alpha!\n");
  }
  /* Tell the window to use the colormap */
  gtk_widget_set_colormap(window,colormap);

  /* Get a pixbuf from the image file */
  pixbuf=gdk_pixbuf_new_from_file("clockface.png",&error);

  if(pixbuf==NULL){
    g_print("Failed to open background image: %s\n", error->message);
    g_error_free(error);
    error=NULL;
    return 0;
  }
  /* Make it the same size as the window */
  scaled=gdk_pixbuf_scale_simple(pixbuf,100,100, GDK_INTERP_BILINEAR);
  /* Render it using the colormap of the window */
  gdk_pixbuf_render_pixmap_and_mask_for_colormap(scaled,colormap,&background,NULL,0);
  /* Make a new style, stick the background in it, tell window to use it. */
  style = gtk_style_new();
  style->bg_pixmap[0] = background;
  gtk_widget_set_style(GTK_WIDGET(window),GTK_STYLE(style));

  /*gtk_window_set_opacity(GTK_WINDOW(window),0.3);*/
  gtk_window_move(GTK_WINDOW(window), 0, 0);
  gtk_widget_show_all(window);
  return 1;
}
Esempio n. 22
0
File: iopen.c Progetto: szfn/teddy
void iopen_init(GtkWidget *window) {
	parent_window = window;

	GtkWidget *main_vbox = gtk_vbox_new(false, 0);

	iopen_buffer = buffer_create();
	iopen_buffer->single_line = true;
	load_empty(iopen_buffer);
	iopen_editor = new_editor(iopen_buffer, true);

	buffer_set_onchange(iopen_buffer, iopen_buffer_onchange);

	config_set(&(iopen_buffer->config), CFG_AUTOWRAP, "0");
	config_set(&(iopen_buffer->config), CFG_AUTOCOMPL_POPUP, "0");

	iopen_editor->single_line_escape = &iopen_escape;
	iopen_editor->single_line_return = &iopen_enter;
	iopen_editor->single_line_other_keys = &iopen_other_keys;

	gtk_box_pack_start(GTK_BOX(main_vbox), GTK_WIDGET(iopen_editor), FALSE, FALSE, 0);

	results_list = gtk_list_store_new(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_DOUBLE);
	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(results_list), 3, GTK_SORT_ASCENDING);
	results_tree = gtk_tree_view_new();

	crt = gtk_cell_renderer_text_new();

	iopen_recoloring();

	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(results_tree), -1, "Show", crt, "markup", 0, NULL);
	gtk_tree_view_set_model(GTK_TREE_VIEW(results_tree), GTK_TREE_MODEL(results_list));
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(results_tree), FALSE);
	gtk_tree_view_set_search_column(GTK_TREE_VIEW(results_tree), 1);

	g_signal_connect(G_OBJECT(results_tree), "row-activated", G_CALLBACK(result_activated_callback), NULL);

	GtkWidget *results_scroll = gtk_scrolled_window_new(NULL, NULL);
	gtk_container_add(GTK_CONTAINER(results_scroll), results_tree);

	gtk_box_pack_start(GTK_BOX(main_vbox), frame_piece(TRUE), FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(main_vbox),  results_scroll, TRUE, TRUE, 0);

	iopen_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_decorated(GTK_WINDOW(iopen_window), TRUE);
	gtk_window_set_default_size(GTK_WINDOW(iopen_window), 640, 480);

	g_signal_connect(G_OBJECT(iopen_window), "delete-event", G_CALLBACK(delete_callback), NULL);
	g_signal_connect(G_OBJECT(iopen_window), "map_event", G_CALLBACK(map_callback), NULL);

	gtk_container_add(GTK_CONTAINER(iopen_window), main_vbox);

	file_recursor_requests = g_async_queue_new();
	tags_requests = g_async_queue_new();
	buffers_requests = g_async_queue_new();
	g_thread_new("iopen file recursion", iopen_recursor_thread, NULL);
	g_thread_new("tags iteration", iopen_tags_thread, NULL);
	g_thread_new("buffer iteration", iopen_buffer_thread, NULL);
}
int
ShowProgressUI()
{
  if (!sEnableUI)
    return -1;

  // Only show the Progress UI if the process is taking significant time.
  // Here we measure significant time as taking more than one second.

  usleep(500000);

  if (sQuit || sProgressVal > 50.0f)
    return 0;

  char path[PATH_MAX];
  snprintf(path, sizeof(path), "%s.ini", sProgramPath);

  StringTable strings;
  if (ReadStrings(path, &strings) != OK)
    return -1;
  
  sWin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  if (!sWin)
    return -1;

  // GTK 2.2 seems unable to prevent our dialog from being closed when
  // the user hits the close button on the dialog.  This problem only
  // occurs when either one of the following methods are called:
  //   gtk_window_set_position
  //   gtk_window_set_type_hint
  // For this reason, we disable window decorations.
 
  g_signal_connect(G_OBJECT(sWin), "delete_event",
                   G_CALLBACK(OnDeleteEvent), NULL);

  gtk_window_set_title(GTK_WINDOW(sWin), strings.title);
  gtk_window_set_type_hint(GTK_WINDOW(sWin), GDK_WINDOW_TYPE_HINT_DIALOG);
  gtk_window_set_position(GTK_WINDOW(sWin), GTK_WIN_POS_CENTER_ALWAYS);
  gtk_window_set_resizable(GTK_WINDOW(sWin), FALSE);
  gtk_window_set_decorated(GTK_WINDOW(sWin), FALSE);

  GtkWidget *vbox = gtk_vbox_new(TRUE, 6);
  sLabel = gtk_label_new(strings.info);
  gtk_misc_set_alignment(GTK_MISC(sLabel), 0.0f, 0.0f);
  sProgressBar = gtk_progress_bar_new();

  gtk_box_pack_start(GTK_BOX(vbox), sLabel, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox), sProgressBar, TRUE, TRUE, 0);

  sTimerID = g_timeout_add(TIMER_INTERVAL, UpdateDialog, NULL);

  gtk_container_set_border_width(GTK_CONTAINER(sWin), 10);
  gtk_container_add(GTK_CONTAINER(sWin), vbox);
  gtk_widget_show_all(sWin);

  gtk_main();
  return 0;
}
/**
 * hildon_remote_texture_new:
 *
 * Creates a new #HildonRemoteTexture.
 *
 * Return value: A #HildonRemoteTexture
 *
 * Since: 2.2
 **/
GtkWidget*
hildon_remote_texture_new                     (void)
{
    HildonRemoteTexture *newwindow = g_object_new (HILDON_TYPE_REMOTE_TEXTURE, NULL);

    gtk_window_set_decorated (GTK_WINDOW (newwindow), FALSE);

    return GTK_WIDGET (newwindow);
}
Esempio n. 25
0
static GtkWidget *
pop_calendar_window(GtkWidget *parent,
		    int orientation,
		    gboolean week_start_monday,
		    const char *date_string)
{
    GtkWidget *window;
    GtkWidget *frame;
    GtkWidget *vbox;
    GtkWidget *hbox;
    GtkWidget *cal;
    GtkWidget *entry;
    GtkWidget *label;
    GtkCalendarDisplayOptions display_options;

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
    gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window), TRUE);
    gtk_window_set_skip_pager_hint(GTK_WINDOW(window), TRUE);
    g_object_set_data(G_OBJECT(window), "calendar-parent", parent);

    frame = gtk_frame_new(NULL);
    gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_OUT);
    gtk_container_add (GTK_CONTAINER(window), frame);

    vbox = gtk_vbox_new(FALSE, 0);
    gtk_container_add (GTK_CONTAINER(frame), vbox);

    cal = gtk_calendar_new();
    display_options = GTK_CALENDAR_SHOW_HEADING |
		      GTK_CALENDAR_SHOW_WEEK_NUMBERS |
		      GTK_CALENDAR_SHOW_DAY_NAMES;
    if (week_start_monday)
	display_options |= GTK_CALENDAR_WEEK_START_MONDAY;
    gtk_calendar_display_options(GTK_CALENDAR (cal), display_options);
    gtk_box_pack_start(GTK_BOX(vbox), cal, TRUE, TRUE, 0);

    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

    label = gtk_label_new(_("Date:"));
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);

    entry = gtk_entry_new();
    gtk_entry_set_text(GTK_ENTRY(entry), date_string);
    gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);
    g_signal_connect(G_OBJECT(entry), "activate",
		     G_CALLBACK(on_calendar_entry_activated), cal);

    g_signal_connect_after(G_OBJECT(window), "realize",
			   G_CALLBACK(on_calendar_realized),
			   GINT_TO_POINTER(orientation));
    gtk_widget_show_all(window);

    return window;
}
Esempio n. 26
0
void
message_dialog (gchar *message)
{
  GtkWidget *dialog;
  GtkWidget *vbox;
  GtkWidget *hbox;

  GdkColormap *colormap;
  GtkStyle *style;
  GdkBitmap *mask;
  GdkPixmap *pixmap;
  GtkWidget *image;

  GtkWidget *label;
  GtkWidget *button;

  dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
#if GTK_MAJOR_VERSION == 2
  gtk_window_set_decorated (GTK_WINDOW(dialog), FALSE);
#endif
  gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS);
  gtk_container_set_border_width (GTK_CONTAINER(dialog), 12);
  
  vbox = gtk_vbox_new (FALSE, 10);
  gtk_container_add (GTK_CONTAINER(dialog), vbox);

  hbox = gtk_hbox_new (FALSE, 10);
  gtk_box_pack_start_defaults (GTK_BOX(vbox), hbox);

  style = gtk_widget_get_style (dialog);
  colormap = gtk_widget_get_colormap(dialog);
  pixmap = gdk_pixmap_colormap_create_from_xpm (dialog->window, colormap, 
						&mask, NULL,
						"/etc/icons/error.xpm");
  image = gtk_pixmap_new (pixmap, mask);
  gtk_box_pack_start_defaults (GTK_BOX(hbox), image);

  label = gtk_label_new (message);
  gtk_box_pack_start_defaults (GTK_BOX(hbox), label);

  button = gtk_button_new_with_label ("Fechar");
  gtk_signal_connect (GTK_OBJECT(button), "clicked",
		      GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
  gtk_box_pack_start_defaults (GTK_BOX(vbox), button);

  gtk_widget_show_all (dialog);

  gtk_widget_grab_focus (button);

  gtk_main ();

  gtk_widget_destroy (dialog);
  
  while (gtk_events_pending ())
    gtk_main_iteration ();
}
GtkWidget *gui_show_temp_window()
{
	GtkWidget *temp_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(temp_window), "Working...");
	gtk_window_set_default_size(GTK_WINDOW(temp_window), 300, 0);
	gtk_window_set_position(GTK_WINDOW(temp_window), GTK_WIN_POS_CENTER_ALWAYS);
	gtk_window_set_decorated(GTK_WINDOW(temp_window), FALSE);
	gtk_widget_show_all(temp_window);
	return temp_window;
}
Esempio n. 28
0
static void
toggle_decorated_cb (GtkWidget *button,
                     gpointer   data)
{
  GtkWidget *window;
  window = gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW);
  if (window)
    gtk_window_set_decorated (GTK_WINDOW (window),
                              !gtk_window_get_decorated (GTK_WINDOW (window)));
}
static void
gsd_media_keys_window_init (GsdMediaKeysWindow *window)
{
        GdkScreen *screen;

        window->priv = GSD_MEDIA_KEYS_WINDOW_GET_PRIVATE (window);

        screen = gtk_widget_get_screen (GTK_WIDGET (window));

        window->priv->is_composited = gdk_screen_is_composited (screen);

        if (window->priv->is_composited) {
                gdouble scalew, scaleh, scale;
                gint size;

                gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
                gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);

                /* assume 130x130 on a 640x480 display and scale from there */
                scalew = gdk_screen_get_width (screen) / 640.0;
                scaleh = gdk_screen_get_height (screen) / 480.0;
                scale = MIN (scalew, scaleh);
                size = 130 * MAX (1, scale);

                gtk_window_set_default_size (GTK_WINDOW (window), size, size);
                g_signal_connect (window, "expose-event", G_CALLBACK (on_expose_event), window);

                window->priv->fade_out_alpha = 1.0;
        } else {
                GtkBuilder *builder;
                const gchar *objects[] = {"acme_frame", NULL};
                GtkWidget *frame;

                builder = gtk_builder_new ();
                gtk_builder_add_objects_from_file (builder,
                                                   GTKBUILDERDIR "/acme.ui",
                                                   (char **) objects,
                                                   NULL);

                window->priv->image = GTK_IMAGE (gtk_builder_get_object (builder, "acme_image"));
                window->priv->progress = GTK_WIDGET (gtk_builder_get_object (builder, "acme_volume_progressbar"));
                frame = GTK_WIDGET (gtk_builder_get_object (builder,
                                                            "acme_frame"));

                if (frame != NULL) {
                        gtk_container_add (GTK_CONTAINER (window), frame);
                        gtk_widget_show_all (frame);
                }

                /* The builder needs to stay alive until the window
                   takes ownership of the frame (and its children)  */
                g_object_unref (builder);
        }
}
Esempio n. 30
0
static void
toggle_decorated_cb (GSimpleAction *action,
                     GVariant      *parameter,
                     gpointer       data)
{
  GtkWidget *window;
  window = gtk_widget_get_ancestor (data, GTK_TYPE_WINDOW);
  if (window)
    gtk_window_set_decorated (GTK_WINDOW (window),
                              !gtk_window_get_decorated (GTK_WINDOW (window)));
}