#include "wx/scrolwin.h"
#include "wx/layout.h"
#include "wx/menuitem.h"
+ #include "wx/module.h"
#endif
-#include "wx/module.h"
#include "wx/fontutil.h"
#include "wx/univ/renderer.h"
if (pos2.y == wxDefaultCoord)
pos2.y = 0;
+ AdjustForParentClientOrigin(pos2.x, pos2.y);
+
#if wxUSE_TWO_WINDOWS
bool need_two_windows =
((( wxSUNKEN_BORDER | wxRAISED_BORDER | wxSIMPLE_BORDER | wxHSCROLL | wxVSCROLL ) & m_windowStyle) != 0);
}
// Destroy the window
- Window xwindow = (Window) m_mainWindow;
- wxDeleteWindowFromTable( xwindow );
- XDestroyWindow( wxGlobalDisplay(), xwindow );
- m_mainWindow = NULL;
+ if ( m_mainWindow )
+ {
+ Window xwindow = (Window) m_mainWindow;
+ wxDeleteWindowFromTable( xwindow );
+ XDestroyWindow( wxGlobalDisplay(), xwindow );
+ m_mainWindow = NULL;
+ }
}
// ---------------------------------------------------------------------------
if (dx < 0) s_x += -dx;
if (dy < 0) s_y += -dy;
- if (dx > 0) d_x = dx + offset.x;
- if (dy > 0) d_y = dy + offset.y;
+ 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 );
Window thisWindow = (Window) m_clientWindow;
Window childWindow;
- int xx = *x;
- int yy = *y;
- XTranslateCoordinates(display, rootWindow, thisWindow, xx, yy, x, y, &childWindow);
+ int xx = x ? *x : 0;
+ int yy = y ? *y : 0;
+ XTranslateCoordinates(display, rootWindow, thisWindow,
+ xx, yy, x ? x : &xx, y ? y : &yy,
+ &childWindow);
}
void wxWindowX11::DoClientToScreen(int *x, int *y) const
Window thisWindow = (Window) m_clientWindow;
Window childWindow;
- int xx = *x;
- int yy = *y;
- XTranslateCoordinates(display, thisWindow, rootWindow, xx, yy, x, y, &childWindow);
+ int xx = x ? *x : 0;
+ int yy = y ? *y : 0;
+ XTranslateCoordinates(display, thisWindow, rootWindow,
+ xx, yy, x ? x : &xx, y ? y : &yy,
+ &childWindow);
}
XCharStruct overall;
int slen = string.length();
- XTextExtents((XFontStruct*) pFontStruct, (char*) string.c_str(), slen,
+ XTextExtents((XFontStruct*) pFontStruct, (const char*) string.c_str(), slen,
&direction, &ascent, &descent2, &overall);
if ( x )
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
- if (wxUpdateUIEvent::CanUpdate((wxWindow*) this))
+ if (wxUpdateUIEvent::CanUpdate((wxWindow*) this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
// Set the input focus if couldn't do it before
eventType = wxEVT_RIGHT_DOWN;
button = 3;
}
+ else if ( xevent->xbutton.button == Button4 ||
+ xevent->xbutton.button == Button5 )
+ {
+ // this is the same value as used under wxMSW
+ static const int WHEEL_DELTA = 120;
+
+ eventType = wxEVT_MOUSEWHEEL;
+ button = xevent->xbutton.button;
+
+ wxevent.m_linesPerAction = 3;
+ wxevent.m_wheelDelta = WHEEL_DELTA;
+
+ // Button 4 means mousewheel up, 5 means down
+ wxevent.m_wheelRotation = button == Button4 ? WHEEL_DELTA
+ : -WHEEL_DELTA;
+ }
// check for a double click
// TODO: where can we get this value from?
class wxWinModule : public wxModule
{
public:
- bool OnInit();
- void OnExit();
+ wxWinModule()
+ {
+ // we must be cleaned up before the display is closed
+ AddDependency(wxClassInfo::FindClass(_T("wxX11DisplayModule")));
+ }
+
+ virtual bool OnInit();
+ virtual void OnExit();
private:
DECLARE_DYNAMIC_CLASS(wxWinModule)