Пример #1
1
void Ctrl::WndUpdate()
{
	GuiLock __;
	LLOG("WndUpdate0");
	gdk_window_process_updates(gdk(), TRUE);
	FetchEvents(FALSE); // Should pickup GDK_EXPOSE and repaint the window
	gdk_flush();
}
Пример #2
0
/*
 * The timer-based process that operates on some variables then invalidates copter's region to trigger
 * an expose_event, thus invoking function "on_copter_expose_event" through the window manager.
 *
 */
static gboolean render_timer_event (gpointer theUser_data)
{
	GdkWindow *parent;
	GtkWidget *theWidget = GTK_WIDGET (theUser_data);


	/*
	 * Only send a redraw request if the render process is not busy.  
	 * This prevents long rendering processes from piling up.
	 */
	if (pthread_mutex_trylock (&copter_render_mutex) != EBUSY)
	{
		// Unlock the mutex before we issue the redraw.
		pthread_mutex_unlock (&copter_render_mutex);
		// Invalidate 3D copter's region to signal the window handler there needs to be an update in that area,
		if (parent = gtk_widget_get_parent_window (theWidget))
			gdk_window_invalidate_rect (parent, &theWidget->allocation, TRUE);
		/*
		 * Force an immediate update - we can omit this and leave the window manager to call the redraw when the
		 * main loop is idle.  However, we get smoother, more consistent updates this way.
		 */
		if (parent = gtk_widget_get_parent_window (theWidget))
			gdk_window_process_updates (parent, TRUE);
	}

	return TRUE;
}
/*
 * The timer-based process that operates on some variables then invalidates drawingarea1's region to trigger
 * an expose_event, thus invoking function "on_drawingarea1_expose_event" through the window manager.
 *
 */
gboolean SludgeGLApplication::render_timer_event(gpointer theUser_data)
{
	GtkWidget *theWidget = GTK_WIDGET (theUser_data);

	/*
	 * Only send a redraw request if the render process is not busy.  This prevents long rendering processes
	 * from piling up.
	 */
	if (g_mutex_trylock(theRender_mutex))
	{
		// Unlock the mutex before we issue the redraw.
		g_mutex_unlock(theRender_mutex);
		// Invalidate drawingarea1's region to signal the window handler there needs to be an update in that area,
		gdk_window_invalidate_rect (gtk_widget_get_parent_window (theWidget), &theWidget->allocation, TRUE);
//		gdk_window_invalidate_rect (theWidget->window, &theWidget->allocation, FALSE);
		/*
		 * Force an immediate update - we can omit this and leave the window manager to call the redraw when the
		 * main loop is idle.  However, we get smoother, more consistent updates this way.
		 */
		gdk_window_process_updates (gtk_widget_get_parent_window (theWidget), TRUE);
//		gdk_window_process_updates (theWidget->window, FALSE);
	}

	return TRUE;
}
Пример #4
0
void wxListBox::Update()
{
    wxWindow::Update();

    if (m_treeview)
        gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(m_treeview)), true);
}
Пример #5
0
void wxListBox::Update()
{
    wxWindow::Update();

    if (m_treeview)
        gdk_window_process_updates(GTK_WIDGET(m_treeview)->window, TRUE);
}
Пример #6
0
/* Draw a rectangle on the screen, size depending on pressure,
   and color on the type of device */
static void
draw_brush (GtkWidget *widget, GdkInputSource source,
	    gdouble x, gdouble y, gdouble pressure)
{
  GdkGC *gc;
  GdkRectangle update_rect;

  switch (source)
    {
    case GDK_SOURCE_MOUSE:
      gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
      break;
    case GDK_SOURCE_PEN:
      gc = widget->style->black_gc;
      break;
    case GDK_SOURCE_ERASER:
      gc = widget->style->white_gc;
      break;
    default:
      gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
    }

  update_rect.x = x - 10 * pressure;
  update_rect.y = y - 10 * pressure;
  update_rect.width = 20 * pressure;
  update_rect.height = 20 * pressure;
  gdk_draw_rectangle (pixmap, gc, TRUE,
		      update_rect.x, update_rect.y,
		      update_rect.width, update_rect.height);
  gtk_widget_queue_draw_area (widget,
			      update_rect.x, update_rect.y,
			      update_rect.width, update_rect.height);
  gdk_window_process_updates (widget->window, TRUE);
}
/* We should probably experiment some more with this.
 * Right now the rendered icon is pretty good for most
 * themes. However, the icon is slightly large for themes
 * with large toolbar icons.
 */
static GdkPixbuf *
new_pixbuf_from_widget (GtkWidget *widget)
{
  GtkWidget *window;
  GdkPixbuf *pixbuf;
  gint icon_height;
  GdkScreen *screen;

  screen = gtk_widget_get_screen (widget);

  if (!gtk_icon_size_lookup_for_settings (gtk_settings_get_for_screen (screen),
					  GTK_ICON_SIZE_LARGE_TOOLBAR,
					  NULL,
					  &icon_height))
    {
      icon_height = DEFAULT_ICON_HEIGHT;
    }

  window = gtk_offscreen_window_new ();
  /* Set the width to -1 as we want the separator to be as thin as possible. */
  gtk_widget_set_size_request (widget, -1, icon_height);
  gtk_container_add (GTK_CONTAINER (window), widget);
  gtk_widget_show_all (window);

  /* Process the waiting events to have the widget actually drawn */
  gdk_window_process_updates (gtk_widget_get_window (window), TRUE);
  pixbuf = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (window));
  gtk_widget_destroy (window);

  return pixbuf;
}
Пример #8
0
JNIEXPORT void JNICALL
Java_org_gnome_gdk_GdkWindow_gdk_1window_1process_1updates
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jboolean _updateChildren
)
{
	GdkWindow* self;
	gboolean updateChildren;

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

	// convert parameter updateChildren
	updateChildren = (gboolean) _updateChildren;

	// call function
	gdk_window_process_updates(self, updateChildren);

	// cleanup parameter self

	// cleanup parameter updateChildren
}
Пример #9
0
/* When GLArea widget size changes, viewport size is set to match the new size */
static gint reshape(GtkWidget *widget, GdkEventConfigure *event)
{
	GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
	GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);

	if(!GTK_IS_WIDGET(widget)) return TRUE;
	if(!GTK_WIDGET_REALIZED(widget)) return TRUE;

	if (gdk_gl_drawable_gl_begin (gldrawable, glcontext))
	{
		/* pthread_mutex_lock (&theRender_mutex);*/
		glViewport(0,0, widget->allocation.width, widget->allocation.height);
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		if(perspective)
			mYPerspective(Zoom,(GLdouble)widget->allocation.width/(GLdouble)widget->allocation.height,zNear,zFar);
		else
		{
			gdouble fw = (GLdouble)widget->allocation.width/(GLdouble)widget->allocation.height;
			gdouble fh = 1.0;
			glOrtho(-fw,fw,-fh,fh,-1,1);
		}
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		gdk_gl_drawable_gl_end (gldrawable);
		/* pthread_mutex_unlock (&theRender_mutex);*/

		gdk_window_invalidate_rect (gtk_widget_get_parent_window (widget), &widget->allocation, TRUE);
		gdk_window_process_updates (gtk_widget_get_parent_window (widget), TRUE);
	}
	return TRUE;
}
Пример #10
0
void force_update(GtkWidget *wid)
{
  if ((wid) && (wid->window))
    {
      gdk_window_invalidate_rect(GDK_WINDOW(wid->window), NULL, true);
      gdk_window_process_updates(GDK_WINDOW(wid->window), true);
    }
}
Пример #11
0
void iupdrvDisplayRedraw(Ihandle *ih)
{
  GdkWindow* window = ih->handle->window;
  /* Post a REDRAW */
  gtk_widget_queue_draw(ih->handle);
  /* Force a REDRAW */
  if (window)
    gdk_window_process_updates(window, FALSE);
}
Пример #12
0
static gboolean applyChanges( gpointer user_data )
{
    GtkWidget* da = GTK_WIDGET( user_data );

    gdk_window_invalidate_rect( da->window, &da->allocation, FALSE );
	gdk_window_process_updates( da->window, FALSE );

	return TRUE;
}
Пример #13
0
void gl_draw (GtkWidget *gl_area) {
//	New drawing function for GTK 2.0
	if (!gl_area)
		return;
	gtk_widget_queue_draw(GTK_WIDGET(gl_area));
//	We force the update, for a more fluid display when the pen is used
	if (gl_area->window)
		gdk_window_process_updates(gl_area->window, FALSE);
}
Пример #14
0
static gboolean rotate_callback(gpointer user_data)
{
	GtkWidget *drawing_area = GTK_WIDGET(user_data);

	/* g_print("rotate\n"); */
	rotate();

	gdk_window_invalidate_rect(drawing_area->window, &drawing_area->allocation, FALSE);
	gdk_window_process_updates(drawing_area->window, FALSE);
	return TRUE;
}
Пример #15
0
static gboolean idle (gpointer user_data)
{
	GtkWidget* widget = GTK_WIDGET (user_data);

	angle = (angle + 1) % 360;

	gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
	gdk_window_process_updates (widget->window, FALSE);

	return TRUE;
}
Пример #16
0
void
gimp_widget_flush_expose (GtkWidget *widget)
{
  g_return_if_fail (GTK_IS_WIDGET (widget));

  if (! gtk_widget_is_drawable (widget))
    return;

  gdk_window_process_updates (gtk_widget_get_window (widget), FALSE);
  gdk_flush ();
}
static gboolean rotate(gpointer user_data)
{
	GtkWidget *drawing_area = GTK_WIDGET(user_data);

	if (rotate_func)
	        rotate_func();

	gdk_window_invalidate_rect(drawing_area->window, &drawing_area->allocation, FALSE);
	gdk_window_process_updates(drawing_area->window, FALSE);
	return TRUE;
}
void ChromeClient::invalidateWindow(const IntRect&, bool immediate)
{
    // If we've invalidated regions for scrolling, force GDK to process those invalidations
    // now. This will also cause child windows to move right away. This prevents redraw
    // artifacts with child windows (e.g. Flash plugin instances).
    if (immediate && m_pendingScrollInvalidations) {
        m_pendingScrollInvalidations = false;
        if (GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(m_webView)))
            gdk_window_process_updates(window, TRUE);
    }
}
Пример #19
0
static void set_value(GtkWidget * widget, gpointer data)
{
  GdkRegion *region;

  GtkRange *range = (GtkRange *) widget;
  GtkWidget *cpu = (GtkWidget *) data;
  GTK_CPU(cpu)->sel = gtk_range_get_value(range);

  region = gdk_drawable_get_clip_region(cpu->window);
  gdk_window_invalidate_region(cpu->window, region, TRUE);
  gdk_window_process_updates(cpu->window, TRUE);
}
Пример #20
0
void
uidisplay_frame_end( void )
{
#if GTK_CHECK_VERSION( 3, 0, 0 )
  if( display_updated ) {
    gdk_window_process_updates( gtk_widget_get_window( gtkui_drawing_area ),
                                FALSE );
    display_updated = 0;
  }
#endif                /* #if GTK_CHECK_VERSION( 3, 0, 0 ) */

  return;
}
Пример #21
0
void gtk_attractor_view_redraw(GtkWidget *widget)
{
    GdkRegion *region;
    if (!widget->window) return;

// 	gdk_window_get_size(widget->window, &W, &H);
    region = gdk_drawable_get_clip_region (widget->window);
    /* redraw the cairo canvas completely by exposing it */
    gdk_window_invalidate_region (widget->window, region, TRUE);
    gdk_window_process_updates (widget->window, TRUE);
    gdk_region_destroy (region);

}
static void
draw_background (MateBGCrossfade *fade)
{
	if (GDK_WINDOW_TYPE (fade->priv->window) == GDK_WINDOW_ROOT) {
		GdkDisplay *display;
		display = gdk_drawable_get_display (fade->priv->window);
		gdk_window_clear (fade->priv->window);
		gdk_flush ();
	} else {
		gdk_window_invalidate_rect (fade->priv->window, NULL, FALSE);
		gdk_window_process_updates (fade->priv->window, FALSE);
	}
}
/*
 * The "configure_event" signal handler for drawingarea1. When the area is reconfigured (such as a resize)
 * this gets called - so we change the OpenGL viewport accordingly,
 */
gboolean SludgeGLApplication::on_drawingarea1_configure_event (GtkWidget *theWidget, GdkEventConfigure *theEvent)
{
GdkGLContext *glContext;
GdkGLDrawable *glDrawable;


	// Don't continue if we get fed a dud window type.
	if (theWidget->window == NULL)
	{
		return FALSE;
	}

	/*
	 * Wait until the rendering process is complete before issuing a context change,
	 * then lock it - to prevent possible driver issues on long rendering processes.
	 * You can add a timeout here or g_mutex_trylock according to taste.
	 */
	g_mutex_lock(theRender_mutex);

	glContext = gtk_widget_get_gl_context (theWidget);
	glDrawable = gtk_widget_get_gl_drawable (theWidget);

	// Signal to gdk the start OpenGL operations.
	if (!gdk_gl_drawable_gl_begin (glDrawable, glContext))
	{
		g_mutex_unlock(theRender_mutex);
		return FALSE;
	}

/*	glViewport (0, 0, theWidget->allocation.width, theWidget->allocation.height);
	glMatrixMode (GL_PROJECTION);
	glLoadIdentity ();
	glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
	glMatrixMode (GL_MODELVIEW);
*/
    reshape();

	glFlush ();

	// Signal to gdk we're done with OpenGL operations.
	gdk_gl_drawable_gl_end (glDrawable);

	// Unlock the rendering mutex before sending an immediate redraw request.
	g_mutex_unlock(theRender_mutex);
	gdk_window_invalidate_rect (gtk_widget_get_parent_window (theWidget), &theWidget->allocation, TRUE);
	gdk_window_process_updates (gtk_widget_get_parent_window (theWidget), TRUE);
//	gdk_window_invalidate_rect (theWidget->window, &theWidget->allocation, FALSE);
//	gdk_window_process_updates (theWidget->window, FALSE);

	return FALSE;
}
Пример #24
0
static gboolean
update (gpointer user_data)
{
	GtkWidget *da = GTK_WIDGET (user_data);

	//update code starts here

	//end of update code

	gdk_window_invalidate_rect (da->window, &da->allocation, FALSE);
	gdk_window_process_updates (da->window, FALSE);

	return TRUE;
}
Пример #25
0
/**
@brief "motion-notify" signal callback
@param widget where the signal was initiated
@param event pointer to event data
@param rt pointer to runtime data

@return FALSE always
*/
static gboolean _e2_gesture_dialog_moved_cb (GtkWidget *widget,
	GdkEventMotion *event, E2_GestureDialogRuntime *rt)
{
	if (rt->handle == NULL)
		g_return_val_if_reached (FALSE);

	if (rt->is_drag)
	{
		GdkWindow *win;
//		if (rt->handle != NULL) see test above
			stroke_record (rt->handle, (gint)event->x, (gint)event->y);
		NEEDCLOSEBGL
#ifdef USE_GTK3_0
//* FIXME make this work with less overhead. Changes are often just a pixel or two
		GdkRectangle r;
		r.width = (gint)(rt->prevx - event->x); if (r.width < 0) r.width = -r.width;
		r.height = (gint)(rt->prevy - event->y); if (r.height < 0) r.height = -r.height;
		if (r.width <= 2 && r.height <= 2)
			return FALSE;
		r.x = (gint)MIN(rt->prevx, event->x);
		r.y = (gint)MIN(rt->prevy, event->y);
		win = gtk_widget_get_window (widget);
		cairo_t *cr = gdk_cairo_create (win);
		_e2_gesture_dialog_cairo_setup (cr, widget);
		cairo_move_to (cr, rt->prevx, rt->prevy);
		cairo_line_to (cr, event->x, event->y);
		cairo_stroke (cr);
		gdk_window_invalidate_rect (win, &r, FALSE);
		gdk_window_process_updates (win, FALSE);
		cairo_destroy (cr);
#else
		if (rt->gc == NULL)
		{
			GtkStyle *style = gtk_widget_get_style (widget);
			rt->gc = style->black_gc;
		}
		win =
# ifdef USE_GTK2_14
			gtk_widget_get_window (widget); //CHECKME cache this ?
# else
			widget->window;
# endif
		gdk_draw_line (GDK_DRAWABLE (win), rt->gc, (gint)rt->prevx, (gint)rt->prevy,
			(gint)event->x, (gint)event->y);
#endif
		rt->prevx = event->x;
		rt->prevy = event->y;

		NEEDOPENBGL
	}
Пример #26
0
int
main(int argc, char* argv[]) {
	GtkWidget *win;
	GtkCssProvider *cssprovider;
	GdkScreen *screen;
	GError *error;

	/* Disable global menus */
	g_unsetenv ("UBUNTU_MENUPROXY");
	gtk_init(&argc, &argv);
	ido_init ();
	screen = gdk_screen_get_default();
	win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size (GTK_WINDOW (win), -1, 28);
	g_signal_connect(win, "realize", G_CALLBACK(on_realize), NULL);
	g_signal_connect(screen, "monitors-changed", G_CALLBACK(on_screen_change), win);
	g_signal_connect(screen, "size-changed", G_CALLBACK(on_screen_change), win);

	cssprovider = gtk_css_provider_new ();
	gtk_css_provider_load_from_data(cssprovider,
			"GtkMenuBar {\n"
			"    -GtkMenuBar-internal-padding: 0;\n"
			"    -GtkMenuBar-shadow-type: none;\n"
			"}\n"
			"GtkWidget {\n"
			"    -GtkWidget-focus-line-width: 0;\n"
			"    -GtkWidget-focus-padding: 0;\n"
			"}\n", -1, NULL);

	gtk_style_context_add_provider_for_screen(screen,
		GTK_STYLE_PROVIDER (cssprovider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

	GtkWidget* menubar = gtk_menu_bar_new();

	load_indicator_files (INDICATOR_DIR, menubar);
	IndicatorObject * io = indicator_object_new_from_file("/usr/lib/indicators3/7/libapplication.so");
	load_indicator(io, menubar);

	GtkWidget* hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3);
	gtk_container_add(GTK_CONTAINER(win), hbox);
	gtk_box_pack_end(GTK_BOX(hbox), menubar, FALSE, FALSE, 0);
	g_signal_connect_after(menubar, "draw", G_CALLBACK(on_draw), NULL);
	g_signal_connect(win, "draw", G_CALLBACK(on_draw), NULL);
	gtk_widget_show_all(win);
	gdk_window_process_updates(gtk_widget_get_window(win), TRUE);
	gtk_widget_set_app_paintable(win, TRUE);
	gtk_main();
	return 0;
}
Пример #27
0
/**
 * gtk_layout_thaw:
 * @layout: a #GtkLayout
 * 
 * This is a deprecated function, it doesn't do anything useful.
 **/
void
gtk_layout_thaw (GtkLayout *layout)
{
  g_return_if_fail (GTK_IS_LAYOUT (layout));

  if (layout->freeze_count)
    {
      if (!(--layout->freeze_count))
	{
	  gtk_widget_queue_draw (GTK_WIDGET (layout));
	  gdk_window_process_updates (GTK_WIDGET (layout)->window, TRUE);
	}
    }

}
Пример #28
0
static gboolean
timeout(GtkWidget *widget)
{
  GtkAllocation allocation;
  GdkWindow *window;

  gtk_widget_get_allocation (widget, &allocation);

  /* Invalidate the whole window. */
  gdk_window_invalidate_rect (window, &allocation, FALSE);

  /* Update synchronously. */
  gdk_window_process_updates (window, FALSE);

  return TRUE;
}
Пример #29
0
static void
draw_background (MateBGCrossfade *fade)
{
	if (gdk_window_get_window_type (fade->priv->window) == GDK_WINDOW_ROOT) {
		XClearArea (GDK_WINDOW_XDISPLAY (fade->priv->window),
			    GDK_WINDOW_XID (fade->priv->window),
			    0, 0,
			    gdk_window_get_width (fade->priv->window),
			    gdk_window_get_height (fade->priv->window),
			    False);
		gdk_flush ();
	} else {
		gdk_window_invalidate_rect (fade->priv->window, NULL, FALSE);
		gdk_window_process_updates (fade->priv->window, FALSE);
	}
}
Пример #30
0
int
main(int argc, char* argv[]) {
	GtkWidget *win;
	GtkCssProvider *cssprovider;

	/* Disable global menus */
	g_unsetenv ("UBUNTU_MENUPROXY");
	gtk_init(&argc, &argv);
	win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	g_signal_connect(win, "realize", G_CALLBACK(on_realize), NULL);

	cssprovider = gtk_css_provider_new ();
	gtk_css_provider_load_from_data(cssprovider,
			"GtkMenuBar {\n"
			"    -GtkMenuBar-internal-padding: 0;\n"
			"    -GtkMenuBar-shadow-type: none;\n"
			"}\n"
			"GtkWidget {\n"
			"    -GtkWidget-focus-line-width: 0;\n"
			"    -GtkWidget-focus-padding: 0;\n"
			"}\n"
			".menuitem {\n"
			"    padding: 0px 0px 0px 0px;\n"
			"}\n", -1, NULL);

	gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
		GTK_STYLE_PROVIDER (cssprovider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

	GtkWidget* menubar = gtk_menu_bar_new();
	gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar), GTK_PACK_DIRECTION_RTL);
	int i;
	for(i = 0; indicators[i]; i++) {
		if (!load_module(indicators[i], menubar)) {
			g_error("Unable to load module");
		}
	}
	GtkWidget* hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3);
	gtk_container_add(GTK_CONTAINER(win), hbox);
	gtk_box_pack_end(GTK_BOX(hbox), menubar, FALSE, FALSE, 0);
	g_signal_connect_after(menubar, "draw", G_CALLBACK(on_draw), NULL);
	g_signal_connect(win, "draw", G_CALLBACK(on_draw), NULL);
	gtk_widget_show_all(win);
	gdk_window_process_updates(gtk_widget_get_window(win), TRUE);
	gtk_widget_set_app_paintable(win, TRUE);
	gtk_main();
	return 0;
}