X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0ecf47c409f1cb4c034d50fcd47e6863070ae140..772c017b2c30f5cb8072d7b22f39da175e101e9a:/src/x11/window.cpp?ds=inline diff --git a/src/x11/window.cpp b/src/x11/window.cpp index ba61bd3939..a83a67877c 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -479,7 +479,7 @@ bool wxWindowX11::SetCursor(const wxCursor& cursor) Cursor xcursor = (Cursor) cursorToUse.GetCursor(); - XDefineCursor( (Display*) wxGlobalDisplay(), xwindow, xcursor ); + XDefineCursor( wxGlobalDisplay(), xwindow, xcursor ); return TRUE; } @@ -529,14 +529,15 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect) GC xgc = XCreateGC( xdisplay, xwindow, 0, NULL ); XSetGraphicsExposures( xdisplay, xgc, True ); - int s_x; - int s_y; + int s_x = 0; + int s_y = 0; int cw; int ch; if (rect) { s_x = rect->x; s_y = rect->y; + cw = rect->width; ch = rect->height; } @@ -550,7 +551,7 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect) wxPoint offset = GetClientAreaOrigin(); s_x += offset.x; s_y += offset.y; - + int w = cw - abs(dx); int h = ch - abs(dy); @@ -561,23 +562,24 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect) else { wxRect rect; - if (dx < 0) rect.x = cw+dx; else rect.x = s_x; - if (dy < 0) rect.y = ch+dy; else rect.y = s_y; + if (dx < 0) rect.x = cw+dx + offset.x; else rect.x = s_x; + if (dy < 0) rect.y = ch+dy + offset.y; else rect.y = s_y; if (dy != 0) rect.width = cw; else rect.width = abs(dx); if (dx != 0) rect.height = ch; else rect.height = abs(dy); int d_x = s_x; int d_y = s_y; + if (dx < 0) s_x += -dx; if (dy < 0) s_y += -dy; - if (dx > 0) d_x = dx; - if (dy > 0) d_y = dy; + if (dx > 0) d_x = dx + offset.x; + if (dy > 0) d_y = dy + offset.y; XCopyArea( xdisplay, xwindow, xwindow, xgc, s_x, s_y, w, h, d_x, d_y ); - // printf( "s_x %d s_y %d w %d h %d d_x %d d_y %d\n", s_x, s_y, w, h, d_x, d_y ); + // wxLogDebug( "Copy: s_x %d s_y %d w %d h %d d_x %d d_y %d", s_x, s_y, w, h, d_x, d_y ); - // printf( "rect %d %d %d %d\n", rect.x, rect.y, rect.width, rect.height ); + // wxLogDebug( "Update: %d %d %d %d", rect.x, rect.y, rect.width, rect.height ); m_updateRegion.Union( rect ); m_clearRegion.Union( rect ); @@ -634,7 +636,7 @@ void wxWindowX11::DoGetSize(int *x, int *y) const wxCHECK_RET( xwindow, wxT("invalid window") ); - XSync(wxGlobalDisplay(), False); + // XSync(wxGlobalDisplay(), False); XWindowAttributes attr; Status status = XGetWindowAttributes( wxGlobalDisplay(), xwindow, &attr ); @@ -652,7 +654,7 @@ void wxWindowX11::DoGetPosition(int *x, int *y) const Window window = (Window) m_mainWidget; if (window) { - XSync(wxGlobalDisplay(), False); + // XSync(wxGlobalDisplay(), False); XWindowAttributes attr; Status status = XGetWindowAttributes(wxGlobalDisplay(), window, & attr); wxASSERT(status); @@ -706,7 +708,7 @@ void wxWindowX11::DoGetClientSize(int *x, int *y) const if (window) { - XSync(wxGlobalDisplay(), False); // Is this really a good idea? + // XSync(wxGlobalDisplay(), False); // Is this really a good idea? XWindowAttributes attr; Status status = XGetWindowAttributes( wxGlobalDisplay(), window, &attr ); wxASSERT(status); @@ -958,6 +960,7 @@ void wxWindowX11::Update() { if (!m_updateRegion.IsEmpty()) { + // wxLogDebug("wxWindowX11::Update: %s", GetClassInfo()->GetClassName()); // Actually send erase events. SendEraseEvents(); @@ -985,7 +988,7 @@ void wxWindowX11::SendEraseEvents() wxEraseEvent erase_event( GetId(), &dc ); erase_event.SetEventObject( this ); - + if (!GetEventHandler()->ProcessEvent(erase_event)) { Window xwindow = (Window) GetMainWindow(); @@ -1020,9 +1023,8 @@ void wxWindowX11::SendPaintEvents() wxPaintEvent paint_event( GetId() ); paint_event.SetEventObject( this ); GetEventHandler()->ProcessEvent( paint_event ); - - m_updateRegion.Clear(); + m_updateRegion.Clear(); m_clipPaintRegion = FALSE; } @@ -1060,7 +1062,9 @@ void wxWindowX11::OnInternalIdle() // Set the input focus if couldn't do it before if (m_needsInputFocus) + { SetFocus(); + } } // ----------------------------------------------------------------------------