Add opaque move support to wxGTK's wxMiniFrame.

Use it in wxAUI (much less flicker and frame
    activation problems). wxMiniFrame and the
    Docked panes in wxAUI should use the same
    code to draw titlebar etc.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40774 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2006-08-23 14:02:53 +00:00
parent c959d91228
commit d02d8b4c27
2 changed files with 14 additions and 27 deletions

View File

@ -22,7 +22,7 @@
#include "wx/frame.h"
#if defined( __WXMSW__ ) || defined( __WXMAC__ )
#if defined( __WXMSW__ ) || defined( __WXMAC__ ) || defined( __WXGTK__ )
#include "wx/minifram.h"
#define wxFloatingPaneBaseClass wxMiniFrame
#else

View File

@ -34,28 +34,6 @@ extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
extern GtkWidget *wxGetRootWindow();
//-----------------------------------------------------------------------------
// local functions
//-----------------------------------------------------------------------------
/* draw XOR rectangle when moving mine frame around */
static void DrawFrame( GtkWidget *widget, int x, int y, int w, int h )
{
int org_x = 0;
int org_y = 0;
gdk_window_get_origin( widget->window, &org_x, &org_y );
x += org_x;
y += org_y;
GdkGC *gc = gdk_gc_new( gdk_get_default_root_window() );
gdk_gc_set_subwindow( gc, GDK_INCLUDE_INFERIORS );
gdk_gc_set_function( gc, GDK_INVERT );
gdk_draw_rectangle( gdk_get_default_root_window(), gc, FALSE, x, y, w, h );
g_object_unref (gc);
}
//-----------------------------------------------------------------------------
// "expose_event" of m_mainWidget
//-----------------------------------------------------------------------------
@ -144,7 +122,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
win->m_diffX = (int)gdk_event->x;
win->m_diffY = (int)gdk_event->y;
DrawFrame( widget, 0, 0, win->m_width, win->m_height );
win->m_oldX = 0;
win->m_oldY = 0;
@ -174,7 +151,6 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
int x = (int)gdk_event->x;
int y = (int)gdk_event->y;
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
gdk_pointer_ungrab ( (guint32)GDK_CURRENT_TIME );
int org_x = 0;
int org_y = 0;
@ -215,10 +191,21 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
gdk_event->state = state;
}
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
win->m_oldX = (int)gdk_event->x - win->m_diffX;
win->m_oldY = (int)gdk_event->y - win->m_diffY;
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
int x = (int)gdk_event->x;
int y = (int)gdk_event->y;
int org_x = 0;
int org_y = 0;
gdk_window_get_origin( widget->window, &org_x, &org_y );
x += org_x - win->m_diffX;
y += org_y - win->m_diffY;
win->m_x = x;
win->m_y = y;
gtk_window_move( GTK_WINDOW(win->m_widget), x, y );
return TRUE;
}