Exemplo n.º 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();
}
Exemplo n.º 2
1
bool Ctrl::SetWndFocus()
{
	GuiLock __;
	LLOG("SetWndFocus0 " << Upp::Name(this) << ", top: " << top);
	if(top) {
		LLOG("SetWndFocus0 DO gdk: " << gdk());
		SetWndForeground();
		int t0 = msecs();
		while(!gtk_window_is_active(gtk()) && msecs() - t0 < 500) // Wait up to 500ms for window to become active - not ideal, but only possibility
			FetchEvents(true);
		FocusSync();
	}
	return true;
}
Exemplo n.º 3
1
bool Ctrl::SetWndCapture()
{
	GuiLock __;
	ASSERT(IsMainThread());
	LLOG("SetWndCapture " << Name());
	StopGrabPopup();
	ReleaseWndCapture();
	if(gdk_pointer_grab(gdk(), FALSE,
					    GdkEventMask(GDK_BUTTON_RELEASE_MASK|GDK_BUTTON_PRESS_MASK|GDK_POINTER_MOTION_MASK),
					    NULL, NULL, CurrentTime) == GDK_GRAB_SUCCESS) {
		grabwindow = this;
		return true;
	}
	return false;
}
Exemplo n.º 4
0
void Ctrl::WndInvalidateRect(const Rect& r)
{
	GuiLock __;
	LLOG("WndInvalidateRect " << r);
	gdk_window_invalidate_rect(gdk(), GdkRect(r), TRUE);
//	gtk_widget_queue_draw_area(top->window, r.left, r.top, r.GetWidth(), r.GetHeight());
}
Exemplo n.º 5
0
void Ctrl::WndSetPos(const Rect& rect)
{
	LLOG("WndSetPos0 " << rect);
	GuiLock __;
	if(!IsOpen())
		return;
	Ptr<Ctrl> this_ = this;
	SweepConfigure(false); // Remove any previous GDK_CONFIGURE for this window
	if(!this_ || !IsOpen())
		return;
//	gtk_window_move(gtk(), rect.left, rect.top);
//	gtk_window_resize(gtk(), rect.GetWidth(), rect.GetHeight());
	gdk_window_move_resize(gdk(), rect.left, rect.top, rect.GetWidth(), rect.GetHeight());
	int t0 = msecs();
	do { // Wait up to 500ms for corresponding GDK_CONFIGURE to arrive
		if(SweepConfigure(true))
			break;
	}
	while(msecs() - t0 < 500);
	LLOG("-- WndSetPos0 " << rect << " " << msecs() - t0);
}
Exemplo n.º 6
-5
Rect Ctrl::GetWndScreenRect() const
{
	GuiLock __;
	if(IsOpen()) {
		gint x, y;
		gdk_window_get_position(gdk(), &x, &y);
	#if GTK_CHECK_VERSION(2, 24, 0)
		gint width = gdk_window_get_width(gdk());
		gint height = gdk_window_get_height(gdk());
	#else
		gint width, height;
		gdk_drawable_get_size(gdk(), &width, &height);
	#endif
		return RectC(x, y, width, height);
	}
	return Null;
}