Exemple #1
0
static gboolean
display_animation_func(gpointer data) {
  DISPLAY_INFO* di = (DISPLAY_INFO*) data;

  if (di->timeout-- < 0) {
    gtk_widget_destroy(di->popup);
    notifications = g_list_remove(notifications, di);
    if (di->ni->title) g_free(di->ni->title);
    if (di->ni->text) g_free(di->ni->text);
    if (di->ni->icon) g_free(di->ni->icon);
    if (di->ni->url) g_free(di->ni->url);
    g_free(di->ni);
    g_free(di);
    return FALSE;
  }

  if (di->timeout > 450) {
    gtk_window_set_opacity(GTK_WINDOW(di->popup), (double) (500-di->timeout)/50.0*0.8);
  }

  if (di->timeout < 50) {
    gtk_window_set_opacity(GTK_WINDOW(di->popup), (double) di->timeout/50.0*0.8);
  }
  return TRUE;
}
/* The windows has been exposed after the show_all request to change the background color. */
static void
load_color              ()
{
  gint r = 0;
  gint g = 0;
  gint b = 0;
  gint a = 0;

  if (background_data->background_cr)
    {
      sscanf (background_data->background_color, "%02X%02X%02X%02X", &r, &g, &b, &a);

      cairo_set_operator (background_data->background_cr, CAIRO_OPERATOR_SOURCE);


#ifdef WIN32
      gdouble opacity = BACKGROUND_OPACITY;
      cairo_set_source_rgb (background_data->background_cr, (gdouble) r/256, (gdouble) g/256, (gdouble) b/256);

      /*
       * @TODO Implement with a full opaque windows and use cairo_set_source_rgba
       * function to paint.
       * I set the opacity with alpha and I use cairo_set_source_rgb to workaround
       * the problem on windows with rgba. 
       */
       if (((gdouble) a/256) >  BACKGROUND_OPACITY)
         {
           opacity = (gdouble) a/256;
         }
      gtk_window_set_opacity (GTK_WINDOW (background_data->background_window), opacity);
#else
      gtk_window_set_opacity (GTK_WINDOW (background_data->background_window), 1);
      cairo_set_source_rgba (background_data->background_cr,
                             (gdouble) r/256,
                             (gdouble) g/256,
                             (gdouble) b/256,
                             (gdouble) a/256);
#endif

      cairo_paint (background_data->background_cr);
      cairo_stroke (background_data->background_cr);

#ifndef _WIN32
      if (((gint) a ) < 1)
        {
          gtk_widget_input_shape_combine_region (background_data->background_window, NULL);
        }
#endif

    }
}
/* Load a file image in the window. */
static void
load_file               ()
{
  if (background_data->background_cr)
    {
      cairo_surface_t *surface = cairo_image_surface_create_from_png (background_data->background_image);
      cairo_t *cr = cairo_create (surface);

      gtk_window_set_opacity (GTK_WINDOW (background_data->background_window), 1.0);
	
      gint new_height = 0;
      gint new_width = 0;
      new_height = gdk_window_get_height (gtk_widget_get_window (background_data->background_window));
      new_width = gdk_window_get_width (gtk_widget_get_window (background_data->background_window));

      cairo_surface_t *scaled_surface = scale_surface (surface, new_width, new_height );
	
      cairo_surface_destroy (surface);
	
      cairo_destroy (cr);
	
      cairo_set_source_surface (background_data->background_cr, scaled_surface, 0.0, 0.0);
	
      cairo_paint (background_data->background_cr);
      cairo_stroke (background_data->background_cr);
	
      cairo_surface_destroy (scaled_surface);
	
#ifndef _WIN32
      gtk_widget_input_shape_combine_region (background_data->background_window, NULL);
#endif
    }
}
Exemple #4
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));
}
Exemple #5
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;
}
Exemple #6
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;
}
Exemple #7
0
void
cheese_flash_fire (CheeseFlash *flash)
{
  CheeseFlashPrivate *flash_priv = CHEESE_FLASH_GET_PRIVATE (flash);
  GtkWidget          *parent;
  GdkScreen          *screen;
  GdkRectangle        rect;
  int                 monitor;

  g_return_if_fail (flash_priv->parent != NULL);

  GtkWindow *flash_window = flash_priv->window;

  if (flash_priv->flash_timeout_tag > 0)
    g_source_remove (flash_priv->flash_timeout_tag);
  if (flash_priv->fade_timeout_tag > 0)
    g_source_remove (flash_priv->fade_timeout_tag);

  parent  = gtk_widget_get_toplevel (flash_priv->parent);
  screen  = gtk_widget_get_screen (parent);
  monitor = gdk_screen_get_monitor_at_window (screen,
                                              gtk_widget_get_window (parent));
  gdk_screen_get_monitor_geometry (screen, monitor, &rect);
  gtk_window_set_transient_for (GTK_WINDOW (flash_window), GTK_WINDOW (parent));
  gtk_window_resize (flash_window, rect.width, rect.height);
  gtk_window_move (flash_window, rect.x, rect.y);

  gtk_window_set_opacity (flash_window, 1);
  gtk_widget_show_all (GTK_WIDGET (flash_window));
  flash_priv->flash_timeout_tag = g_timeout_add (FLASH_DURATION, cheese_flash_start_fade, (gpointer) flash);
}
Exemple #8
0
void on_composited_changed ( GdkScreen *screen,
			   gpointer   user_data)
{
  GromitData *data = (GromitData *) user_data;

  if(data->debug)
    g_printerr("DEBUG: got composited-changed event\n");

  data->composited = gdk_screen_is_composited (data->screen);

  if(data->composited)
    {
      // undo shape
      gtk_widget_shape_combine_region(data->win, NULL);
      // re-apply transparency
      gtk_window_set_opacity(GTK_WINDOW(data->win), 0.75);
    }

  // set anti-aliasing
  GHashTableIter it;
  gpointer value;
  g_hash_table_iter_init (&it, data->tool_config);
  while (g_hash_table_iter_next (&it, NULL, &value)) 
    {
      GromitPaintContext *context = value;
      cairo_set_antialias(context->paint_ctx, data->composited ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
    }
      

  GdkRectangle rect = {0, 0, data->width, data->height};
  gdk_window_invalidate_rect(gtk_widget_get_window(data->win), &rect, 0); 
}
Exemple #9
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1set_1opacity
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jdouble _opacity
)
{
	GtkWindow* self;
	gdouble opacity;

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

	// convert parameter opacity
	opacity = (gdouble) _opacity;

	// call function
	gtk_window_set_opacity(self, opacity);

	// cleanup parameter self

	// cleanup parameter opacity
}
gboolean
expose_handler (GtkWidget*      window,
		GdkEventExpose* event,
		gpointer        data)
{
	cairo_t*      cr     = NULL;
	GtkAllocation a;

	gtk_widget_get_allocation (window, &a);

	cr = gdk_cairo_create (gtk_widget_get_window (window));

        /* clear and render drop-shadow and bubble-background */
	cairo_scale (cr, 1.0f, 1.0f);
	cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
	cairo_paint (cr);
	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);

	if (g_distance < 1.0f)
	{
		tile_paint_with_padding (g_tile,
					 cr,
					 0.0f,
					 0.0f,
					 a.width,
					 a.height,
					 g_distance,
					 1.0f - g_distance);
		gtk_window_set_opacity (GTK_WINDOW (window), 0.3f + g_distance * 0.7f);
	}
	else
	{
		tile_paint_with_padding (g_tile,
					 cr,
					 0.0f,
					 0.0f,
					 a.width,
					 a.height,
					 g_distance,
					 0.0f);
		gtk_window_set_opacity (GTK_WINDOW (window), 1.0f);
	}

	cairo_destroy (cr);

	return TRUE;
}
Exemple #11
0
void UI_buildui(IBusHandwriteEngine * engine)
{
	GdkPixmap * pxmp;
	GdkGC * gc;
	GdkColor black, white;

	GdkColormap* colormap = gdk_colormap_get_system();

	gdk_color_black(colormap, &black);
	gdk_color_white(colormap, &white);

	g_object_unref(colormap);

	int R = 5;

	if (!engine->drawpanel)
	//建立绘图窗口, 建立空点
	{
		engine->drawpanel = gtk_window_new(GTK_WINDOW_POPUP);
		gtk_window_move((GtkWindow*) engine->drawpanel, 500, 550);
		gtk_widget_add_events(GTK_WIDGET(engine->drawpanel),
				GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK
						| GDK_BUTTON_PRESS_MASK | GDK_EXPOSURE_MASK);
		g_signal_connect_after(G_OBJECT(engine->drawpanel),"motion_notify_event",G_CALLBACK(on_mouse_move),engine);
		g_signal_connect(G_OBJECT(engine->drawpanel),"expose-event",G_CALLBACK(paint_ui),engine);
		g_signal_connect(G_OBJECT(engine->drawpanel),"button-release-event",G_CALLBACK(on_button),engine);
		g_signal_connect(G_OBJECT(engine->drawpanel),"button-press-event",G_CALLBACK(on_button),engine);

		gtk_window_resize(GTK_WINDOW(engine->drawpanel), 200, 250);

		gtk_widget_show(engine->drawpanel);

		pxmp = gdk_pixmap_new(NULL, 200, 250, 1);
		gc = gdk_gc_new(GDK_DRAWABLE(pxmp));

		gdk_gc_set_foreground(gc, &black);

		gdk_draw_rectangle(GDK_DRAWABLE(pxmp), gc, 1, 0, 0, 200, 250);

		gdk_gc_set_foreground(gc, &white);

		gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 0, 0, R*2, R*2, 0, 360 * 64);
		gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 200 - R*2, 0, R*2, R*2, 0, 360
				* 64);
		gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 200 - R*2, 250 - R*2, R*2, R*2, 0,
				360 * 64);
		gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 0, 250 - R*2, R*2, R*2, 0, 360
				* 64);
		gdk_draw_rectangle(GDK_DRAWABLE(pxmp), gc, 1, 0, R, 200, 250 - R*2);
		gdk_draw_rectangle(GDK_DRAWABLE(pxmp), gc, 1, R, 0, 200 - R*2, 250);
		gdk_window_shape_combine_mask(engine->drawpanel->window, pxmp, 0, 0);
		g_object_unref(gc);
		g_object_unref(pxmp);
		gtk_window_set_opacity(GTK_WINDOW(engine->drawpanel), 0.62);
		//	engine->GdkPoints = NULL;
	}
	//	gtk_widget_show_all(engine->drawpanel);
}
Exemple #12
0
static void on_opacity_lesser(GtkMenuItem *menuitem,
			     gpointer     user_data)
{
  GromitData *data = (GromitData *) user_data;
  data->opacity -= 0.1;
  if(data->opacity<0.0)
    data->opacity = 0.0;
  gtk_window_set_opacity(GTK_WINDOW(data->win), data->opacity);
}
Exemple #13
0
static int gtkDialogSetOpacityAttrib(Ihandle *ih, const char *value)
{
  int opacity;
  if (!iupStrToInt(value, &opacity))
    return 0;

  gtk_window_set_opacity((GtkWindow*)ih->handle, (double)opacity/255.0);
  return 1;
}
Exemple #14
0
int main(int argc, char** argv)
{
    GtkWidget *window;
    gtk_init(&argc, &argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_opacity(GTK_WINDOW(window), 0.7);
	g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), "pressed");
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_widget_show(window);
    gtk_main();
    return 0;
}
Exemple #15
0
static inline DISPLAY_INFO*
reset_display_info(DISPLAY_INFO* const di, NOTIFICATION_INFO* const ni) {
  di->timeout = 500;
  di->pos     = 0;
  di->offset  = 0;
  di->hover   = FALSE;
  free_notification_info(di->ni);
  di->ni = ni;
  gtk_widget_hide_all(di->widget.popup);
  gtk_window_set_opacity(GTK_WINDOW(di->widget.popup), 0.8);
  remove_icon(di);
  return di;
}
Exemple #16
0
gboolean set_window_opacity(GtkRange *range, GtkScrollType scroll, gdouble value, struct Window *win_data)
{
#ifdef DETAIL
	g_debug("! Launch set_window_opacity() with value = %f, win_data = %p", value, win_data);
#endif
#ifdef SAFEMODE
	if (win_data==NULL) return FALSE;
#endif
	// g_debug("Get win_data = %d when set window opacity!", win_data);

	value = CLAMP(value, 0, 1);
	if (win_data->use_rgba == -1)
	{
#ifdef ENABLE_RGBA
		if (win_data->transparent_window)
			gtk_window_set_opacity (GTK_WINDOW(win_data->window), 1-value);
		else
			gtk_window_set_opacity (GTK_WINDOW(win_data->window), 1);
#endif
	}
	return FALSE;
}
Exemple #17
0
static int gtkDialogSetOpacityAttrib(Ihandle *ih, const char *value)
{
  int opacity;
  if (!iupStrToInt(value, &opacity))
    return 0;

#if GTK_CHECK_VERSION(3, 8, 0)
  gtk_widget_set_opacity(ih->handle, (double)opacity/255.0);
#else
  gtk_window_set_opacity((GtkWindow*)ih->handle, (double)opacity/255.0);
#endif
  return 1;
}
Exemple #18
0
/*
 * Create the dialog of 'Go To Line'
 */
void av_dialog_goto_line_new(const av_doc *doc)
{
  GtkWidget *entry = NULL;
  const char *entry_text = NULL;
  guint line = 0;
  gboolean status = FALSE;
  gint result = 0;

  /*
   * Create dialog
   */
  main_widget.dialog_goto_line = gtk_dialog_new();

  gtk_window_set_decorated(GTK_WINDOW(main_widget.dialog_goto_line), FALSE);
  gtk_window_set_resizable(GTK_WINDOW(main_widget.dialog_goto_line), FALSE);
  gtk_window_set_opacity(GTK_WINDOW(main_widget.dialog_goto_line), AV_WIDGET_GOTO_LINE_DIALOG_OPACITY);
  gtk_window_set_position(GTK_WINDOW(main_widget.dialog_goto_line), GTK_WIN_POS_CENTER);

  /*
   * Create entry in dialog
   */
  entry = gtk_entry_new();
  gtk_widget_show(entry);

  gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_GO_FORWARD);
  gtk_entry_set_has_frame(GTK_ENTRY(entry), FALSE);
  gtk_entry_set_width_chars(GTK_ENTRY(entry), AV_WIDGET_GOTO_LINE_DIALOG_ENTRY_WIDTH);

  gtk_dialog_add_action_widget(GTK_DIALOG(main_widget.dialog_goto_line),
                               entry,
                               GTK_RESPONSE_OK);

  result = gtk_dialog_run(GTK_DIALOG(main_widget.dialog_goto_line));
  switch (result)
  {
    case GTK_RESPONSE_CANCEL:
      AV_DBG("%s: canceled\n", __func__);
      break;
    case GTK_RESPONSE_OK:
      entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
      AV_DBG("%s: goto line: %s\n", __func__, entry_text);
      status = dialog_entry_text_to_digit(entry_text, &line);
      if (status == TRUE) av_editor_goto_line(&doc->editor, line);
      break;
    default:
      break;
  }

  gtk_widget_destroy(entry);
  gtk_widget_destroy(main_widget.dialog_goto_line);
}
Exemple #19
0
/*
 * Create the dialog of 'Search'
 */
void av_dialog_search_new(const av_doc *doc)
{
  GtkWidget *entry = NULL;
  const char *entry_text = NULL;
  gint result = 0;

  /*
   * Create dialog
   */
  main_widget.dialog_search = gtk_dialog_new();

  gtk_window_set_decorated(GTK_WINDOW(main_widget.dialog_search), FALSE);
  gtk_window_set_resizable(GTK_WINDOW(main_widget.dialog_search), FALSE);
  gtk_window_set_opacity(GTK_WINDOW(main_widget.dialog_search), AV_WIDGET_SEARCH_DIALOG_OPACITY);
  gtk_window_set_position(GTK_WINDOW(main_widget.dialog_search), GTK_WIN_POS_CENTER_ALWAYS);

  /*
   * Create entry in dialog
   */
  entry = gtk_entry_new();
  gtk_widget_show(entry);

  gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_GO_FORWARD);
  gtk_entry_set_has_frame(GTK_ENTRY(entry), FALSE);
  gtk_entry_set_width_chars(GTK_ENTRY(entry), AV_WIDGET_SEARCH_DIALOG_ENTRY_WIDTH);

  gtk_dialog_add_action_widget(GTK_DIALOG(main_widget.dialog_search),
                               entry,
                               GTK_RESPONSE_OK);

  /* Create completion in entry */
  dialog_entry_completion_new(GTK_WIDGET(entry), dialog_search_entry_completion_cb, (gpointer)doc);

  result = gtk_dialog_run(GTK_DIALOG(main_widget.dialog_search));
  switch (result)
  {
    case GTK_RESPONSE_CANCEL:
      AV_DBG("%s: canceled\n", __func__);
      break;
    case GTK_RESPONSE_OK:
      entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
      AV_DBG("%s: search text: %s\n", __func__, entry_text);
      av_editor_search(&doc->editor, entry_text);
      break;
    default:
      break;
  }

  gtk_widget_destroy(entry);
  gtk_widget_destroy(main_widget.dialog_search);
}
Exemple #20
0
bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
{
    if (m_widget == NULL)
        return false;
#if GTK_CHECK_VERSION(2,12,0)
#ifndef __WXGTK3__
    if (gtk_check_version(2,12,0) == NULL)
#endif
    {
#if GTK_CHECK_VERSION(3,8,0)
        if(gtk_check_version(3,8,0) == NULL)
        {
            gtk_widget_set_opacity(m_widget, alpha / 255.0);
        }
        else
#endif
        {
            // Can't avoid using this deprecated function with older GTK+.
            wxGCC_WARNING_SUPPRESS(deprecated-declarations);
            gtk_window_set_opacity(GTK_WINDOW(m_widget), alpha / 255.0);
            wxGCC_WARNING_RESTORE();
        }
        return true;
    }
#endif // GTK_CHECK_VERSION(2,12,0)
#ifndef __WXGTK3__
#ifdef GDK_WINDOWING_X11
    GdkWindow* window = gtk_widget_get_window(m_widget);
    if (window == NULL)
        return false;

    Display* dpy = GDK_WINDOW_XDISPLAY(window);
    Window win = GDK_WINDOW_XID(window);

    if (alpha == 0xff)
        XDeleteProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False));
    else
    {
        long opacity = alpha * 0x1010101L;
        XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False),
                        XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *) &opacity, 1L);
    }
    XSync(dpy, False);
    return true;
#else // !GDK_WINDOWING_X11
    return false;
#endif // GDK_WINDOWING_X11 / !GDK_WINDOWING_X11
#endif // !__WXGTK3__
}
/* Create the background window. */
GtkWidget *
create_background_window     ()
{
  GError *error = (GError *) NULL;
  GObject *background_obj = (GObject *) NULL;

  background_data = allocate_background_data ();

  /* Initialize the background window. */
  background_data->background_window_gtk_builder = gtk_builder_new ();

  /* Load the gtk builder file created with glade. */
  gtk_builder_add_from_file (background_data->background_window_gtk_builder, BACKGROUND_UI_FILE, &error);

  if (error)
    {
      g_warning ("Failed to load builder file: %s", error->message);
      g_error_free (error);
      return background_data->background_window;
    }

  background_obj = gtk_builder_get_object (background_data->background_window_gtk_builder, "backgroundWindow");
  background_data->background_window = GTK_WIDGET (background_obj);
  gtk_window_set_keep_above (GTK_WINDOW (background_data->background_window), TRUE);

  /* This trys to set an alpha channel. */
  on_back_screen_changed (background_data->background_window, NULL, background_data);
  
  /* In the gtk 2.16.6 used for windows the gtkbuilder the double buffered property
   * is not parsed from glade and then I set this by hands. 
   */
  gtk_widget_set_double_buffered (background_data->background_window, FALSE);

  gtk_window_set_opacity (GTK_WINDOW (background_data->background_window), BACKGROUND_OPACITY);
  
  gtk_widget_set_size_request (background_data->background_window, gdk_screen_width (), gdk_screen_height ());

  /* Connect all the callback from gtkbuilder xml file. */
  gtk_builder_connect_signals (background_data->background_window_gtk_builder, (gpointer) background_data);
    
  //gtk_widget_show_all (background_data->background_window);

  /* This put in full screen; this will generate an exposure. */
  gtk_window_fullscreen (GTK_WINDOW (background_data->background_window));
  
  return  background_data->background_window;
}
Exemple #22
0
/*
 * cheese_flash_opacity_fade:
 * @data: the #CheeseFlash
 *
 * Fade the flash out.
 *
 * Returns: %TRUE if the fade was completed, %FALSE if the flash must continue
 * to fade
 */
static gboolean
cheese_flash_opacity_fade (gpointer data)
{
  GtkWindow *flash_window = GTK_WINDOW (data);
  gdouble opacity = gtk_window_get_opacity (flash_window);

  /* exponentially decrease */
  gtk_window_set_opacity (flash_window, opacity * FLASH_FADE_FACTOR);

  if (opacity <= FLASH_LOW_THRESHOLD)
  {
    /* the flasher has finished when we reach the quit value */
    gtk_widget_hide (GTK_WIDGET (flash_window));
    return G_SOURCE_REMOVE;
  }

  return G_SOURCE_CONTINUE;
}
/* Clear the background. */
void clear_background_window      ()
{
  /*
   * @HACK Deny the mouse input to go below the window putting the opacity greater than 0
   * I avoid a complete transparent window because in some operating system this would become
   * transparent to the pointer input also.
   *
   */
  gtk_window_set_opacity (GTK_WINDOW (background_data->background_window), BACKGROUND_OPACITY);

  clear_cairo_context (background_data->background_cr);

  /* This allows the mouse event to be passed to the window below. */
#ifndef _WIN32
  cairo_region_t* r = gdk_cairo_region_create_from_surface(cairo_get_target (background_data->background_cr));
  gtk_widget_input_shape_combine_region (background_data->background_window, r);
  cairo_region_destroy(r);
#endif
}
GtkWidget * intro_window(){
    GtkWidget *window, *img;

    // Thiet lap window
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_title(GTK_WINDOW(window), "Giới thiệu");
        gtk_window_set_default_size(GTK_WINDOW(window), 500, 300);
        gtk_window_set_type_hint(GTK_WINDOW(window),GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_container_set_border_width(GTK_CONTAINER(window), 5);
        gtk_window_set_opacity(GTK_WINDOW(window),0.9);
        gtk_window_set_icon_from_file(GTK_WINDOW(window),"skin//icon.png",NULL);

    // Them hinh vao window
    img = gtk_image_new_from_file("skin//intro.png");
        gtk_container_add(GTK_CONTAINER(window), img);

    return window;
}
Exemple #25
0
static gboolean
cheese_flash_opacity_fade (gpointer data)
{
  CheeseFlash        *flash        = data;
  CheeseFlashPrivate *flash_priv   = CHEESE_FLASH_GET_PRIVATE (flash);
  GtkWindow          *flash_window = flash_priv->window;
  double              opacity      = gtk_window_get_opacity (flash_window);

  /* exponentially decrease */
  gtk_window_set_opacity (flash_window, opacity * FLASH_FADE_FACTOR);

  if (opacity <= FLASH_LOW_THRESHOLD)
  {
    /* the flasher has finished when we reach the quit value */
    gtk_widget_hide (GTK_WIDGET (flash_window));
    return FALSE;
  }

  return TRUE;
}
Exemple #26
0
static void
xmr_waiting_wnd_init(XmrWaitingWnd *wnd)
{
	XmrWaitingWndPrivate *priv;
	
	wnd->priv = G_TYPE_INSTANCE_GET_PRIVATE(wnd, XMR_TYPE_WAITING_WND, XmrWaitingWndPrivate);
	priv = wnd->priv;
	
	priv->tasks = NULL;
	priv->parent = NULL;
	
	gtk_widget_set_app_paintable(GTK_WIDGET(wnd), TRUE);
	gtk_widget_set_size_request(GTK_WIDGET(wnd), WAITING_WND_W, WAITING_WND_H);
	gtk_window_set_opacity(GTK_WINDOW(wnd), 0.7);
	gtk_window_set_skip_taskbar_hint(GTK_WINDOW(wnd), TRUE);
	gtk_window_set_decorated(GTK_WINDOW(wnd), FALSE);
	
	gtk_widget_set_events(GTK_WIDGET(wnd), GDK_KEY_RELEASE_MASK);
	g_signal_connect(wnd, "draw", G_CALLBACK(on_draw), NULL);
	g_signal_connect(wnd, "key-release-event", G_CALLBACK(on_key_release), NULL);
}
Exemple #27
0
int main(int argc, char** argv)
{
	GtkWidget *label;
	GtkWidget *window;
	GtkWidget *frame;
	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), 300, 180);
	gtk_window_set_title(GTK_WINDOW(window), "Fundkeep (c) Makin 2013");
	
	frame = gtk_fixed_new();
	gtk_container_add(GTK_CONTAINER(window), frame);
	
	
	label = gtk_label_new("argv[1]");
	gtk_fixed_put(GTK_FIXED(frame), label, 190, 58); 
	
	
	
	
	gtk_window_set_opacity(GTK_WINDOW(window), 0.8);
	
	
	gtk_widget_show_all(window);

	g_signal_connect(window, "destroy",G_CALLBACK (gtk_main_quit), NULL);

	//~ g_signal_connect(plus, "clicked", 
	  //~ G_CALLBACK(increase), label);
//~ 
	//~ g_signal_connect(minus, "clicked", 
	  //~ G_CALLBACK(decrease), label);

	gtk_main();
	return 0;

}
Exemple #28
0
bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
{
    if (m_widget == NULL)
        return false;
#if GTK_CHECK_VERSION(2,12,0)
#ifndef __WXGTK3__
    if (gtk_check_version(2,12,0) == NULL)
#endif
    {
        gtk_window_set_opacity(GTK_WINDOW(m_widget), alpha / 255.0);
        return true;
    }
#endif // GTK_CHECK_VERSION(2,12,0)
#ifndef __WXGTK3__
#ifdef GDK_WINDOWING_X11
    GdkWindow* window = gtk_widget_get_window(m_widget);
    if (window == NULL)
        return false;

    Display* dpy = GDK_WINDOW_XDISPLAY(window);
    Window win = GDK_WINDOW_XID(window);

    if (alpha == 0xff)
        XDeleteProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False));
    else
    {
        long opacity = alpha * 0x1010101L;
        XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False),
                        XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *) &opacity, 1L);
    }
    XSync(dpy, False);
    return true;
#else // !GDK_WINDOWING_X11
    return false;
#endif // GDK_WINDOWING_X11 / !GDK_WINDOWING_X11
#endif // !__WXGTK3__
}
Exemple #29
0
static gboolean
display_animation_func(gpointer data) {
  DISPLAY_INFO* const di = (DISPLAY_INFO*) data;

  if (di->hover) return TRUE; // Do nothing.
  --di->timeout;

  if (di->timeout < 0) {
    notifications = g_list_remove(notifications, di);
    popup_collections = g_list_append(popup_collections, di);
    reset_display_info(di, NULL);
    return FALSE;
  }

  if (di->offset < 160) {
    di->offset += 2;
    gdk_window_move_resize(di->widget.popup->window, di->x, di->y - di->offset, 180, di->offset);
  }

  if (di->timeout < 30) {
    gtk_window_set_opacity(GTK_WINDOW(di->widget.popup), (double) di->timeout/30.0*0.8);
  }
  return TRUE;
}
//Gtk_widget initialization
void gtk_initialize()
{
	int i;
	window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_widget_set_size_request(window,200,75);
	gtk_window_set_opacity(GTK_WINDOW(window),.5);
	//gtk_window_set_modal(GTK_WINDOW(window),FALSE);	
	//gtk_window_set_keep_below(GTK_WINDOW(window),TRUE);
	gtk_window_set_decorated(GTK_WINDOW(window),FALSE);
	gtk_window_set_resizable(GTK_WINDOW(window),FALSE);
	gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window),TRUE);
	gtk_window_stick(GTK_WINDOW(window));
	bg=gtk_image_new_from_file("./images/danger.png");
	power=gtk_image_new();
	gtk_window_move(GTK_WINDOW(window),gdk_screen_width()-200,gdk_screen_height()-200);
	vbox=gtk_vbox_new(0,0);
	layout=gtk_layout_new(NULL,NULL);
	for(i=0;i<2;i++)
	{
		label[i]=gtk_label_new("Initializing..");
	}
	close_event=gtk_event_box_new();
	close_img=gtk_image_new_from_file("./images/close.png");
}