Implement wxColourDisplay() in terms of wxDisplay::GetDepth()
Get rid of another global display-related function, even though this one only had non-trivial implementation under MSW.
This commit is contained in:
@@ -1183,6 +1183,10 @@ const wxSize wxDefaultSize;
|
|||||||
/**
|
/**
|
||||||
Returns @true if the display is colour, @false otherwise.
|
Returns @true if the display is colour, @false otherwise.
|
||||||
|
|
||||||
|
@note Use of this function is not recommended in the new code as it only
|
||||||
|
works for the primary display. Use wxDisplay::GetDepth() to retrieve
|
||||||
|
the depth of the appropriate display and compare it with 1 instead.
|
||||||
|
|
||||||
@header{wx/gdicmn.h}
|
@header{wx/gdicmn.h}
|
||||||
*/
|
*/
|
||||||
bool wxColourDisplay();
|
bool wxColourDisplay();
|
||||||
|
@@ -850,6 +850,13 @@ int wxDisplayDepth()
|
|||||||
return wxDisplay().GetDepth();
|
return wxDisplay().GetDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxColourDisplay()
|
||||||
|
{
|
||||||
|
// If GetDepth() returns 0, meaning unknown, we assume it's a colour
|
||||||
|
// display, hence the use of "!=" rather than ">" here.
|
||||||
|
return wxDisplay().GetDepth() != 1;
|
||||||
|
}
|
||||||
|
|
||||||
void wxDisplaySize(int *width, int *height)
|
void wxDisplaySize(int *width, int *height)
|
||||||
{
|
{
|
||||||
const wxSize size = wxGetDisplaySize();
|
const wxSize size = wxGetDisplaySize();
|
||||||
|
@@ -89,12 +89,6 @@ wxDisplayFactory* wxDisplay::CreateFactory()
|
|||||||
return new wxDisplayFactorySingleDFB;
|
return new wxDisplayFactorySingleDFB;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxColourDisplay()
|
|
||||||
{
|
|
||||||
#warning "FIXME: wxColourDisplay"
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDisplaySizeMM(int *width, int *height)
|
void wxDisplaySizeMM(int *width, int *height)
|
||||||
{
|
{
|
||||||
// FIXME: there's no way to get physical resolution using the DirectDB
|
// FIXME: there's no way to get physical resolution using the DirectDB
|
||||||
|
@@ -90,11 +90,6 @@ void wxDisplaySizeMM( int *width, int *height )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxColourDisplay()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
|
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
|
||||||
{
|
{
|
||||||
return wxGenericFindWindowAtPoint(pt);
|
return wxGenericFindWindowAtPoint(pt);
|
||||||
|
@@ -97,11 +97,6 @@ void wxGetMousePosition( int* x, int* y )
|
|||||||
gdk_window_get_pointer( NULL, x, y, NULL );
|
gdk_window_get_pointer( NULL, x, y, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxColourDisplay()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
|
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
|
||||||
{
|
{
|
||||||
return wxGenericFindWindowAtPoint(pt);
|
return wxGenericFindWindowAtPoint(pt);
|
||||||
|
@@ -225,12 +225,6 @@ void wxGetMousePosition( int* x, int* y )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if we have a colour display
|
|
||||||
bool wxColourDisplay()
|
|
||||||
{
|
|
||||||
return wxDisplayDepth() > 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDisplaySizeMM(int *width, int *height)
|
void wxDisplaySizeMM(int *width, int *height)
|
||||||
{
|
{
|
||||||
Display *dpy = wxGlobalDisplay();
|
Display *dpy = wxGlobalDisplay();
|
||||||
|
@@ -117,27 +117,6 @@ void wxGetMousePosition( int* x, int* y )
|
|||||||
if ( y ) *y = pt.y;
|
if ( y ) *y = pt.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if we have a colour display
|
|
||||||
bool wxColourDisplay()
|
|
||||||
{
|
|
||||||
// this function is called from wxDC ctor so it is called a *lot* of times
|
|
||||||
// hence we optimize it a bit but doing the check only once
|
|
||||||
//
|
|
||||||
// this should be MT safe as only the GUI thread (holding the GUI mutex)
|
|
||||||
// can call us
|
|
||||||
static int s_isColour = -1;
|
|
||||||
|
|
||||||
if ( s_isColour == -1 )
|
|
||||||
{
|
|
||||||
ScreenHDC dc;
|
|
||||||
int noCols = ::GetDeviceCaps(dc, NUMCOLORS);
|
|
||||||
|
|
||||||
s_isColour = (noCols == -1) || (noCols > 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return s_isColour != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDisplaySizeMM(int *width, int *height)
|
void wxDisplaySizeMM(int *width, int *height)
|
||||||
{
|
{
|
||||||
ScreenHDC dc;
|
ScreenHDC dc;
|
||||||
|
@@ -53,14 +53,6 @@ bool wxCheckForInterrupt(wxWindow *WXUNUSED(wnd))
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if we have a colour display
|
|
||||||
bool wxColourDisplay()
|
|
||||||
{
|
|
||||||
// always the case on OS X
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
@@ -140,11 +140,6 @@ wxWindow *wxGetActiveWindow()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxColourDisplay()
|
|
||||||
{
|
|
||||||
return QApplication::desktop()->depth() > 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxLaunchDefaultApplication(const wxString& path, int WXUNUSED( flags ) )
|
bool wxLaunchDefaultApplication(const wxString& path, int WXUNUSED( flags ) )
|
||||||
{
|
{
|
||||||
return QDesktopServices::openUrl( QUrl::fromLocalFile( wxQtConvertString( path ) ) );
|
return QDesktopServices::openUrl( QUrl::fromLocalFile( wxQtConvertString( path ) ) );
|
||||||
|
@@ -148,12 +148,6 @@ void wxGetMousePosition( int* x, int* y )
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return true if we have a colour display
|
|
||||||
bool wxColourDisplay()
|
|
||||||
{
|
|
||||||
return wxDisplayDepth() > 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDisplaySizeMM(int *width, int *height)
|
void wxDisplaySizeMM(int *width, int *height)
|
||||||
{
|
{
|
||||||
Display *dpy = (Display*) wxGetDisplay();
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
|
Reference in New Issue
Block a user