From 6033bbc1ff95fb69b65b081d03b4a679dd958e75 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 25 May 2004 20:41:54 +0000 Subject: [PATCH] Must have valid colours for X11 popup window implementation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27446 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/x11/popupwin.h | 2 +- src/x11/dcclient.cpp | 4 ++++ src/x11/popupwin.cpp | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/wx/x11/popupwin.h b/include/wx/x11/popupwin.h index 3e023e06ce..6cb6d721e9 100644 --- a/include/wx/x11/popupwin.h +++ b/include/wx/x11/popupwin.h @@ -27,7 +27,7 @@ class wxPopupWindow: public wxPopupWindowBase { public: wxPopupWindow() { } - virtual ~wxPopupWindow() { } + virtual ~wxPopupWindow() ; wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) { (void)Create(parent, flags); } diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index d3601d5985..2b8e355341 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -266,6 +266,9 @@ void wxWindowDC::SetUpDC() m_backgroundBrush.GetColour().CalcPixel( m_cmap ); unsigned long bg_col = m_backgroundBrush.GetColour().GetPixel(); + m_textForegroundColour = *wxBLACK; + m_textBackgroundColour = *wxWHITE; + /* m_textGC */ m_textForegroundColour.CalcPixel( m_cmap ); XSetForeground( (Display*) m_display, (GC) m_textGC, m_textForegroundColour.GetPixel() ); @@ -1554,6 +1557,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) cx = overall_return.width; cy = ascent + descent; m_textBackgroundColour.CalcPixel(m_cmap); + m_textForegroundColour.CalcPixel(m_cmap); XSetForeground ((Display*) m_display, (GC) m_textGC, m_textBackgroundColour.GetPixel()); XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_textGC, x, y, cx, cy ); diff --git a/src/x11/popupwin.cpp b/src/x11/popupwin.cpp index 35bbf8c99f..34d95b1f2c 100644 --- a/src/x11/popupwin.cpp +++ b/src/x11/popupwin.cpp @@ -12,6 +12,7 @@ #endif #include "wx/defs.h" +#include "wx/log.h" #if wxUSE_POPUPWIN @@ -32,6 +33,10 @@ END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) +wxPopupWindow::~wxPopupWindow() +{ +} + bool wxPopupWindow::Create( wxWindow *parent, int style ) { if (!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("popup") )) @@ -56,6 +61,7 @@ bool wxPopupWindow::Create( wxWindow *parent, int style ) int xscreen = DefaultScreen( xdisplay ); Visual *xvisual = DefaultVisual( xdisplay, xscreen ); Window xparent = RootWindow( xdisplay, xscreen ); + Colormap cm = DefaultColormap( xdisplay, xscreen); #if wxUSE_TWO_WINDOWS bool need_two_windows = @@ -70,6 +76,12 @@ bool wxPopupWindow::Create( wxWindow *parent, int style ) XSetWindowAttributes xattributes; long xattributes_mask = 0; + + m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); + m_backgroundColour.CalcPixel( (WXColormap) cm); + + m_foregroundColour = *wxBLACK; + m_foregroundColour.CalcPixel( (WXColormap) cm); xattributes_mask |= CWBackPixel; xattributes.background_pixel = m_backgroundColour.GetPixel(); -- 2.45.2