if (pos2.y == -1)
pos2.y = 0;
-#if !wxUSE_NANOX
-
#if wxUSE_TWO_WINDOWS
bool need_two_windows =
((( wxSUNKEN_BORDER | wxRAISED_BORDER | wxSIMPLE_BORDER | wxHSCROLL | wxVSCROLL ) & m_windowStyle) != 0);
bool need_two_windows = FALSE;
#endif
+#if wxUSE_NANOX
+ long xattributes = 0;
+#else
XSetWindowAttributes xattributes;
long xattributes_mask = 0;
xattributes.border_pixel = BlackPixel( xdisplay, xscreen );
xattributes_mask |= CWEventMask;
+#endif
if (need_two_windows)
{
+#if wxUSE_NANOX
+ long backColor, foreColor;
+ backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
+ foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
+
+ Window xwindow = XCreateWindowWithColor( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
+ 0, 0, InputOutput, xvisual, backColor, foreColor);
+ XSelectInput( xdisplay, xwindow,
+ GR_EVENT_MASK_CLOSE_REQ | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
+ ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
+ KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
+ PropertyChangeMask );
+
+#else
+ // Normal X11
xattributes.event_mask =
ExposureMask | StructureNotifyMask | ColormapChangeMask;
Window xwindow = XCreateWindow( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
-
+
+#endif
+
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
m_mainWindow = (WXWindow) xwindow;
wxAddWindowToTable( xwindow, (wxWindow*) this );
XMapWindow( xdisplay, xwindow );
-
+
+#if !wxUSE_NANOX
xattributes.event_mask =
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
xattributes_mask |= CWBitGravity;
xattributes.bit_gravity = StaticGravity;
}
-
+#endif
+
if (HasFlag( wxSUNKEN_BORDER) || HasFlag( wxRAISED_BORDER))
{
pos2.x = 2;
pos2.x = 0;
pos2.y = 0;
}
+#if wxUSE_NANOX
+ backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
+ foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
+
+ xwindow = XCreateWindowWithColor( xdisplay, xwindow, pos2.x, pos2.y, size2.x, size2.y,
+ 0, 0, InputOutput, xvisual, backColor, foreColor);
+ XSelectInput( xdisplay, xwindow,
+ GR_EVENT_MASK_CLOSE_REQ | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
+ ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
+ KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
+ PropertyChangeMask );
+#else
xwindow = XCreateWindow( xdisplay, xwindow, pos2.x, pos2.y, size2.x, size2.y,
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
-
+#endif
+
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
m_clientWindow = (WXWindow) xwindow;
else
{
// wxLogDebug( "No two windows needed %s", GetName().c_str() );
+#if wxUSE_NANOX
+ long backColor, foreColor;
+ backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
+ foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
+ Window xwindow = XCreateWindowWithColor( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
+ 0, 0, InputOutput, xvisual, backColor, foreColor);
+ XSelectInput( xdisplay, xwindow,
+ GR_EVENT_MASK_CLOSE_REQ | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
+ ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
+ KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
+ PropertyChangeMask );
+
+#else
xattributes.event_mask =
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
Window xwindow = XCreateWindow( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
-
+#endif
+
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
m_mainWindow = (WXWindow) xwindow;
XMapWindow( xdisplay, xwindow );
}
-#else
-
- int extraFlags = GR_EVENT_MASK_CLOSE_REQ;
-
- long backColor, foreColor;
- backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
- foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
-
- Window xwindow = XCreateWindowWithColor( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
- 0, 0, InputOutput, xvisual, backColor, foreColor);
- XSelectInput( xdisplay, xwindow,
- extraFlags | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
- ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
- KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
- PropertyChangeMask );
-
- XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
-
- m_mainWindow = (WXWindow) xwindow;
- wxAddWindowToTable( xwindow, (wxWindow*) this );
-
- XMapWindow( xdisplay, xwindow );
-#endif
// Is a subwindow, so map immediately
m_isShown = TRUE;
if (wxWindowIsVisible(xwindow))
{
- XSetInputFocus( wxGlobalDisplay(), xwindow, RevertToParent, CurrentTime );
+ wxLogTrace( _T("focus"), _T("wxWindowX11::SetFocus: %s"), GetClassInfo()->GetClassName());
+ // XSetInputFocus( wxGlobalDisplay(), xwindow, RevertToParent, CurrentTime );
+ XSetInputFocus( wxGlobalDisplay(), xwindow, RevertToNone, CurrentTime );
m_needsInputFocus = FALSE;
}
else
}
}
+// See handler for InFocus case in app.cpp for details.
+wxWindow* g_GettingFocus = NULL;
+
void wxWindowX11::OnInternalIdle()
{
// Update invalidated regions.
// Set the input focus if couldn't do it before
if (m_needsInputFocus)
{
+#if 0
+ wxString msg;
+ msg.Printf("Setting focus for %s from OnInternalIdle\n", GetClassInfo()->GetClassName());
+ printf(msg.c_str());
+#endif
SetFocus();
+ // If it couldn't set the focus now, there's
+ // no point in trying again.
+ m_needsInputFocus = FALSE;
}
+ g_GettingFocus = NULL;
}
// ----------------------------------------------------------------------------