Implement wxDisplaySize() and wxClientDisplayRect() via wxDisplay

Instead of forwarding to these functions from wxDisplay implementation
in wxUSE_DISPLAY==0 case, make the functions themselves wrappers around
wxDisplay, which may, or not, depending on the platform, have a simpler
implementation in wxUSE_DISPLAY==0 case, but is always available in any
case.

As part of this change, only use src/osx/core/display.cpp in macOS
builds, not iOS ones and update the Xcode project accordingly too.

This cuts down on code duplication, especially in wxGTK, and facilitates
further additions to wxDisplay API.
This commit is contained in:
Vadim Zeitlin
2018-09-29 22:18:02 +02:00
parent c98d504b6d
commit c2162792cf
22 changed files with 406 additions and 394 deletions

View File

@@ -3783,7 +3783,6 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
wx/dialup.h \ wx/dialup.h \
wx/dirctrl.h \ wx/dirctrl.h \
wx/display.h \ wx/display.h \
wx/display_impl.h \
wx/dnd.h \ wx/dnd.h \
wx/docmdi.h \ wx/docmdi.h \
wx/docview.h \ wx/docview.h \
@@ -5606,7 +5605,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS = \
monodll_timectrl_osx.o \ monodll_timectrl_osx.o \
monodll_taskbarcmn.o \ monodll_taskbarcmn.o \
monodll_cocoa_activityindicator.o \ monodll_cocoa_activityindicator.o \
monodll_cocoa_statbmp.o monodll_cocoa_statbmp.o \
monodll_core_display.o
@COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS) @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS)
COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS = \ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS = \
$(__OSX_COMMON_SRC_OBJECTS) \ $(__OSX_COMMON_SRC_OBJECTS) \
@@ -7571,7 +7571,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1 = \
monolib_timectrl_osx.o \ monolib_timectrl_osx.o \
monolib_taskbarcmn.o \ monolib_taskbarcmn.o \
monolib_cocoa_activityindicator.o \ monolib_cocoa_activityindicator.o \
monolib_cocoa_statbmp.o monolib_cocoa_statbmp.o \
monolib_core_display.o
@COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1) @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1)
COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_1 = \ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_1 = \
$(__OSX_COMMON_SRC_OBJECTS_0) \ $(__OSX_COMMON_SRC_OBJECTS_0) \
@@ -9683,7 +9684,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2 = \
coredll_timectrl_osx.o \ coredll_timectrl_osx.o \
coredll_taskbarcmn.o \ coredll_taskbarcmn.o \
coredll_cocoa_activityindicator.o \ coredll_cocoa_activityindicator.o \
coredll_cocoa_statbmp.o coredll_cocoa_statbmp.o \
coredll_core_display.o
@COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2) @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2)
COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_2 = \ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_2 = \
$(__OSX_COMMON_SRC_OBJECTS_8) \ $(__OSX_COMMON_SRC_OBJECTS_8) \
@@ -11390,7 +11392,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3 = \
corelib_timectrl_osx.o \ corelib_timectrl_osx.o \
corelib_taskbarcmn.o \ corelib_taskbarcmn.o \
corelib_cocoa_activityindicator.o \ corelib_cocoa_activityindicator.o \
corelib_cocoa_statbmp.o corelib_cocoa_statbmp.o \
corelib_core_display.o
@COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3) @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3)
COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_3 = \ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_3 = \
$(__OSX_COMMON_SRC_OBJECTS_9) \ $(__OSX_COMMON_SRC_OBJECTS_9) \
@@ -13193,7 +13196,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS = \
monodll_core_bitmap.o \ monodll_core_bitmap.o \
monodll_core_colour.o \ monodll_core_colour.o \
monodll_core_dcmemory.o \ monodll_core_dcmemory.o \
monodll_core_display.o \
monodll_core_fontenum.o \ monodll_core_fontenum.o \
monodll_hid.o \ monodll_hid.o \
monodll_printmac.o \ monodll_printmac.o \
@@ -13337,7 +13339,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_17 = \
monolib_core_bitmap.o \ monolib_core_bitmap.o \
monolib_core_colour.o \ monolib_core_colour.o \
monolib_core_dcmemory.o \ monolib_core_dcmemory.o \
monolib_core_display.o \
monolib_core_fontenum.o \ monolib_core_fontenum.o \
monolib_hid.o \ monolib_hid.o \
monolib_printmac.o \ monolib_printmac.o \
@@ -13481,7 +13482,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_1 = \
coredll_core_bitmap.o \ coredll_core_bitmap.o \
coredll_core_colour.o \ coredll_core_colour.o \
coredll_core_dcmemory.o \ coredll_core_dcmemory.o \
coredll_core_display.o \
coredll_core_fontenum.o \ coredll_core_fontenum.o \
coredll_hid.o \ coredll_hid.o \
coredll_printmac.o \ coredll_printmac.o \
@@ -13622,7 +13622,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4 = \
corelib_core_bitmap.o \ corelib_core_bitmap.o \
corelib_core_colour.o \ corelib_core_colour.o \
corelib_core_dcmemory.o \ corelib_core_dcmemory.o \
corelib_core_display.o \
corelib_core_fontenum.o \ corelib_core_fontenum.o \
corelib_hid.o \ corelib_hid.o \
corelib_printmac.o \ corelib_printmac.o \
@@ -16471,6 +16470,9 @@ monodll_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm
monodll_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(MONODLL_ODEP) monodll_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm
monodll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
monodll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONODLL_ODEP) monodll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp
@@ -18748,12 +18750,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp
@@ -21721,6 +21717,9 @@ monolib_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm
monolib_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(MONOLIB_ODEP) monolib_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm
monolib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
monolib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONOLIB_ODEP) monolib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp
@@ -23998,12 +23997,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp
@@ -27634,6 +27627,9 @@ coredll_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm
coredll_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(COREDLL_ODEP) coredll_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(COREDLL_ODEP)
$(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm
coredll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(COREDLL_ODEP)
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
coredll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(COREDLL_ODEP) coredll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(COREDLL_ODEP)
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp
@@ -29341,12 +29337,6 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp
@@ -31879,6 +31869,9 @@ corelib_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm
corelib_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(CORELIB_ODEP) corelib_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm
corelib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
corelib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(CORELIB_ODEP) corelib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp
@@ -33586,12 +33579,6 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp

View File

@@ -2381,7 +2381,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/osx/core/bitmap.cpp src/osx/core/bitmap.cpp
src/osx/core/colour.cpp src/osx/core/colour.cpp
src/osx/core/dcmemory.cpp src/osx/core/dcmemory.cpp
src/osx/core/display.cpp
src/osx/core/fontenum.cpp src/osx/core/fontenum.cpp
src/osx/core/hid.cpp src/osx/core/hid.cpp
src/osx/core/printmac.cpp src/osx/core/printmac.cpp
@@ -2628,6 +2627,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/common/taskbarcmn.cpp src/common/taskbarcmn.cpp
src/osx/cocoa/activityindicator.mm src/osx/cocoa/activityindicator.mm
src/osx/cocoa/statbmp.mm src/osx/cocoa/statbmp.mm
src/osx/core/display.cpp
</set> </set>
<set var="OSX_COCOA_HDR" hints="files"> <set var="OSX_COCOA_HDR" hints="files">
wx/osx/cocoa/chkconf.h wx/osx/cocoa/chkconf.h

View File

@@ -2258,7 +2258,6 @@ set(OSX_LOWLEVEL_SRC
src/osx/core/bitmap.cpp src/osx/core/bitmap.cpp
src/osx/core/colour.cpp src/osx/core/colour.cpp
src/osx/core/dcmemory.cpp src/osx/core/dcmemory.cpp
src/osx/core/display.cpp
src/osx/core/fontenum.cpp src/osx/core/fontenum.cpp
src/osx/core/hid.cpp src/osx/core/hid.cpp
src/osx/core/printmac.cpp src/osx/core/printmac.cpp
@@ -2500,6 +2499,7 @@ set(OSX_COCOA_SRC
src/osx/datectrl_osx.cpp src/osx/datectrl_osx.cpp
src/osx/core/sound.cpp src/osx/core/sound.cpp
src/osx/cocoa/statbmp.mm src/osx/cocoa/statbmp.mm
src/osx/core/display.cpp
) )
set(OSX_COCOA_HDR set(OSX_COCOA_HDR

View File

@@ -2246,7 +2246,6 @@ OSX_LOWLEVEL_SRC =
src/osx/core/bitmap.cpp src/osx/core/bitmap.cpp
src/osx/core/colour.cpp src/osx/core/colour.cpp
src/osx/core/dcmemory.cpp src/osx/core/dcmemory.cpp
src/osx/core/display.cpp
src/osx/core/fontenum.cpp src/osx/core/fontenum.cpp
src/osx/core/hid.cpp src/osx/core/hid.cpp
src/osx/core/printmac.cpp src/osx/core/printmac.cpp
@@ -2477,6 +2476,7 @@ OSX_COCOA_SRC =
src/osx/cocoa/toolbar.mm src/osx/cocoa/toolbar.mm
src/osx/cocoa/tooltip.mm src/osx/cocoa/tooltip.mm
src/osx/cocoa/window.mm src/osx/cocoa/window.mm
src/osx/core/display.cpp
src/osx/core/hidjoystick.cpp src/osx/core/hidjoystick.cpp
src/osx/core/sound.cpp src/osx/core/sound.cpp
src/osx/dataview_osx.cpp src/osx/dataview_osx.cpp

View File

@@ -803,7 +803,6 @@
F0B3F484C38C3BA0B9927CD9 /* docmdi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECC9F5C21ACB31A0B24AEE35 /* docmdi.cpp */; }; F0B3F484C38C3BA0B9927CD9 /* docmdi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECC9F5C21ACB31A0B24AEE35 /* docmdi.cpp */; };
F0D892C2618130FEAD46BB86 /* panel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00969CBE3B8F32C78C195619 /* panel.cpp */; }; F0D892C2618130FEAD46BB86 /* panel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00969CBE3B8F32C78C195619 /* panel.cpp */; };
F1E4D7CA634E33808AE3B522 /* fontenumcmn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 373242CD08F330208A7CF438 /* fontenumcmn.cpp */; }; F1E4D7CA634E33808AE3B522 /* fontenumcmn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 373242CD08F330208A7CF438 /* fontenumcmn.cpp */; };
F1F484DD591337399FCD0463 /* display.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5617D10CB7136EC9A4194EF /* display.cpp */; };
F22C401903993639AE05A295 /* xh_stbox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 147800BBCB80346798B35D75 /* xh_stbox.cpp */; }; F22C401903993639AE05A295 /* xh_stbox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 147800BBCB80346798B35D75 /* xh_stbox.cpp */; };
F24F637D59F637CA9A7E23C9 /* xh_filectrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 60EE4448A28D38F5ADE17B5A /* xh_filectrl.cpp */; }; F24F637D59F637CA9A7E23C9 /* xh_filectrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 60EE4448A28D38F5ADE17B5A /* xh_filectrl.cpp */; };
F2813BF297C73A3ABD02EC98 /* glcanvas_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA59091E3ED83FB781FB9659 /* glcanvas_osx.cpp */; }; F2813BF297C73A3ABD02EC98 /* glcanvas_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA59091E3ED83FB781FB9659 /* glcanvas_osx.cpp */; };
@@ -1402,7 +1401,6 @@
A46D50BEBF523B3F88831086 /* LexAsn1.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexAsn1.cxx; path = ../../src/stc/scintilla/lexers/LexAsn1.cxx; sourceTree = "<group>"; }; A46D50BEBF523B3F88831086 /* LexAsn1.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexAsn1.cxx; path = ../../src/stc/scintilla/lexers/LexAsn1.cxx; sourceTree = "<group>"; };
A4A745D1821A32D591D76650 /* imagiff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = imagiff.cpp; path = ../../src/common/imagiff.cpp; sourceTree = "<group>"; }; A4A745D1821A32D591D76650 /* imagiff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = imagiff.cpp; path = ../../src/common/imagiff.cpp; sourceTree = "<group>"; };
A54B80C17F823CB5900AD2E8 /* framecmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = framecmn.cpp; path = ../../src/common/framecmn.cpp; sourceTree = "<group>"; }; A54B80C17F823CB5900AD2E8 /* framecmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = framecmn.cpp; path = ../../src/common/framecmn.cpp; sourceTree = "<group>"; };
A5617D10CB7136EC9A4194EF /* display.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = display.cpp; path = ../../src/osx/core/display.cpp; sourceTree = "<group>"; };
A5794CD687013AF8A20A691A /* headerctrlcmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = headerctrlcmn.cpp; path = ../../src/common/headerctrlcmn.cpp; sourceTree = "<group>"; }; A5794CD687013AF8A20A691A /* headerctrlcmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = headerctrlcmn.cpp; path = ../../src/common/headerctrlcmn.cpp; sourceTree = "<group>"; };
A57CF60203F53459A03951A9 /* arrstr.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = arrstr.cpp; path = ../../src/common/arrstr.cpp; sourceTree = "<group>"; }; A57CF60203F53459A03951A9 /* arrstr.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = arrstr.cpp; path = ../../src/common/arrstr.cpp; sourceTree = "<group>"; };
A5BBC1E494D33D028CA547FF /* jddctmgr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jddctmgr.c; path = ../../src/jpeg/jddctmgr.c; sourceTree = "<group>"; }; A5BBC1E494D33D028CA547FF /* jddctmgr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jddctmgr.c; path = ../../src/jpeg/jddctmgr.c; sourceTree = "<group>"; };
@@ -1953,7 +1951,6 @@
A1A53EC3A3463EFDB7614E93 /* bitmap.cpp */, A1A53EC3A3463EFDB7614E93 /* bitmap.cpp */,
9D1F14339D1C331087650931 /* colour.cpp */, 9D1F14339D1C331087650931 /* colour.cpp */,
343D4FDD5CC030618EF24729 /* dcmemory.cpp */, 343D4FDD5CC030618EF24729 /* dcmemory.cpp */,
A5617D10CB7136EC9A4194EF /* display.cpp */,
36E1DBA275AD325DB759C180 /* fontenum.cpp */, 36E1DBA275AD325DB759C180 /* fontenum.cpp */,
160EB9744CB63A0B81DC651F /* hid.cpp */, 160EB9744CB63A0B81DC651F /* hid.cpp */,
5CC5C13F8AA1387BADB7E60C /* printmac.cpp */, 5CC5C13F8AA1387BADB7E60C /* printmac.cpp */,
@@ -3008,7 +3005,6 @@
03BF1610E2FC3BD5ACB754F0 /* bitmap.cpp in Sources */, 03BF1610E2FC3BD5ACB754F0 /* bitmap.cpp in Sources */,
FF50EC0EC5F23DF890C6E95F /* colour.cpp in Sources */, FF50EC0EC5F23DF890C6E95F /* colour.cpp in Sources */,
BD2B17EB72E73A6EB6E0B26F /* dcmemory.cpp in Sources */, BD2B17EB72E73A6EB6E0B26F /* dcmemory.cpp in Sources */,
F1F484DD591337399FCD0463 /* display.cpp in Sources */,
371809DA4AD1382F8B532878 /* fontenum.cpp in Sources */, 371809DA4AD1382F8B532878 /* fontenum.cpp in Sources */,
86BE5213D3F131D8A6862679 /* hid.cpp in Sources */, 86BE5213D3F131D8A6862679 /* hid.cpp in Sources */,
AB58406CEBA13BC4A2A83B66 /* printmac.cpp in Sources */, AB58406CEBA13BC4A2A83B66 /* printmac.cpp in Sources */,

View File

@@ -10,6 +10,7 @@
#ifndef _WX_PRIVATE_DISPLAY_H_ #ifndef _WX_PRIVATE_DISPLAY_H_
#define _WX_PRIVATE_DISPLAY_H_ #define _WX_PRIVATE_DISPLAY_H_
#include "wx/display.h"
#include "wx/gdicmn.h" // for wxRect #include "wx/gdicmn.h" // for wxRect
#include "wx/vector.h" #include "wx/vector.h"
@@ -112,18 +113,63 @@ protected:
wxDECLARE_NO_COPY_CLASS(wxDisplayImpl); wxDECLARE_NO_COPY_CLASS(wxDisplayImpl);
}; };
// ----------------------------------------------------------------------------
// wxDisplayImplSingle: the simplest possible impl for the main display only
// ----------------------------------------------------------------------------
// Note that this is still an ABC and GetGeometry() and GetClientArea() methods
// must be implemented in the derived classes.
class WXDLLEXPORT wxDisplayImplSingle : public wxDisplayImpl
{
public:
wxDisplayImplSingle() : wxDisplayImpl(0) { }
virtual wxString GetName() const wxOVERRIDE { return wxString(); }
#if wxUSE_DISPLAY
// no video modes support for us, provide just the stubs
virtual wxArrayVideoModes
GetModes(const wxVideoMode& WXUNUSED(mode)) const wxOVERRIDE
{
return wxArrayVideoModes();
}
virtual wxVideoMode GetCurrentMode() const wxOVERRIDE
{
return wxVideoMode();
}
virtual bool ChangeMode(const wxVideoMode& WXUNUSED(mode)) wxOVERRIDE
{
return false;
}
#endif // wxUSE_DISPLAY
wxDECLARE_NO_COPY_CLASS(wxDisplayImplSingle);
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxDisplayFactorySingle // wxDisplayFactorySingle
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// this is a stub implementation using single/main display only, it is // This is the simplest implementation of wxDisplayFactory using single/main
// available even if wxUSE_DISPLAY == 0 // display only. It is used when wxUSE_DISPLAY == 0 because getting the size of
// the main display is always needed.
//
// Note that this is still an ABC and derived classes must implement
// CreateSingleDisplay().
class WXDLLIMPEXP_CORE wxDisplayFactorySingle : public wxDisplayFactory class WXDLLIMPEXP_CORE wxDisplayFactorySingle : public wxDisplayFactory
{ {
public: public:
virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE;
virtual unsigned GetCount() wxOVERRIDE { return 1; } virtual unsigned GetCount() wxOVERRIDE { return 1; }
virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE;
protected:
virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE;
virtual wxDisplayImpl *CreateSingleDisplay() = 0;
}; };
#endif // _WX_PRIVATE_DISPLAY_H_ #endif // _WX_PRIVATE_DISPLAY_H_

View File

@@ -29,7 +29,6 @@
#include "wx/module.h" #include "wx/module.h"
#endif //WX_PRECOMP #endif //WX_PRECOMP
#include "wx/display.h"
#include "wx/private/display.h" #include "wx/private/display.h"
#if wxUSE_DISPLAY #if wxUSE_DISPLAY
@@ -50,43 +49,6 @@ const wxVideoMode wxDefaultVideoMode;
// created on demand and destroyed by wxDisplayModule // created on demand and destroyed by wxDisplayModule
static wxDisplayFactory *gs_factory = NULL; static wxDisplayFactory *gs_factory = NULL;
// ----------------------------------------------------------------------------
// wxDisplayImplSingle: trivial implementation working for main display only
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxDisplayImplSingle : public wxDisplayImpl
{
public:
wxDisplayImplSingle() : wxDisplayImpl(0) { }
virtual wxRect GetGeometry() const wxOVERRIDE
{
wxRect r;
wxDisplaySize(&r.width, &r.height);
return r;
}
virtual wxRect GetClientArea() const wxOVERRIDE { return wxGetClientDisplayRect(); }
virtual wxString GetName() const wxOVERRIDE { return wxString(); }
#if wxUSE_DISPLAY
// no video modes support for us, provide just the stubs
virtual wxArrayVideoModes GetModes(const wxVideoMode& WXUNUSED(mode)) const wxOVERRIDE
{
return wxArrayVideoModes();
}
virtual wxVideoMode GetCurrentMode() const wxOVERRIDE { return wxVideoMode(); }
virtual bool ChangeMode(const wxVideoMode& WXUNUSED(mode)) wxOVERRIDE { return false; }
#endif // wxUSE_DISPLAY
wxDECLARE_NO_COPY_CLASS(wxDisplayImplSingle);
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxDisplayModule is used to cleanup gs_factory // wxDisplayModule is used to cleanup gs_factory
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -201,16 +163,6 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode)
// static functions implementation // static functions implementation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// if wxUSE_DISPLAY == 1 this is implemented in port-specific code
#if !wxUSE_DISPLAY
/* static */ wxDisplayFactory *wxDisplay::CreateFactory()
{
return new wxDisplayFactorySingle;
}
#endif // !wxUSE_DISPLAY
/* static */ wxDisplayFactory& wxDisplay::Factory() /* static */ wxDisplayFactory& wxDisplay::Factory()
{ {
if ( !gs_factory ) if ( !gs_factory )
@@ -248,20 +200,10 @@ int wxDisplayFactory::GetFromWindow(const wxWindow *window)
wxDisplayImpl *wxDisplayFactorySingle::CreateDisplay(unsigned n) wxDisplayImpl *wxDisplayFactorySingle::CreateDisplay(unsigned n)
{ {
// we recognize the main display only // we recognize the main display only
return n != 0 ? NULL : new wxDisplayImplSingle; return n != 0 ? NULL : CreateSingleDisplay();
} }
int wxDisplayFactorySingle::GetFromPoint(const wxPoint& pt) int wxDisplayFactorySingle::GetFromPoint(const wxPoint& pt)
{ {
if ( pt.x >= 0 && pt.y >= 0 ) return wxDisplay().GetGeometry().Contains(pt) ? 0 : wxNOT_FOUND;
{
int w, h;
wxDisplaySize(&w, &h);
if ( pt.x < w && pt.y < h )
return 0;
}
// the point is outside of the screen
return wxNOT_FOUND;
} }

View File

@@ -16,6 +16,8 @@
#endif #endif
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/display.h"
#include "wx/gdiobj.h" #include "wx/gdiobj.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
@@ -843,18 +845,36 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize,
return font; return font;
} }
void wxDisplaySize(int *width, int *height)
{
const wxSize size = wxGetDisplaySize();
if ( width )
*width = size.x;
if ( height )
*height = size.y;
}
wxSize wxGetDisplaySize() wxSize wxGetDisplaySize()
{ {
int x, y; return wxDisplay().GetGeometry().GetSize();
wxDisplaySize(& x, & y); }
return wxSize(x, y);
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
const wxRect rect = wxGetClientDisplayRect();
if ( x )
*x = rect.x;
if ( y )
*y = rect.y;
if ( width )
*width = rect.width;
if ( height )
*height = rect.height;
} }
wxRect wxGetClientDisplayRect() wxRect wxGetClientDisplayRect()
{ {
int x, y, width, height; return wxDisplay().GetClientArea();
wxClientDisplayRect(&x, &y, &width, &height); // call plat-specific version
return wxRect(x, y, width, height);
} }
wxSize wxGetDisplaySizeMM() wxSize wxGetDisplaySizeMM()

View File

@@ -17,6 +17,7 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/evtloop.h" #include "wx/evtloop.h"
#include "wx/apptrait.h" #include "wx/apptrait.h"
#include "wx/private/display.h"
#include "wx/unix/private/timer.h" #include "wx/unix/private/timer.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
@@ -56,6 +57,33 @@ wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
// display characteristics // display characteristics
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// TODO: move into a separate src/dfb/display.cpp
class wxDisplayImplSingleDFB : public wxDisplayImplSingle
{
public:
virtual wxRect GetGeometry() const wxOVERRIDE
{
const wxVideoMode mode(wxTheApp->GetDisplayMode());
return wxRect(0, 0, mode.w, mode.h);
}
};
class wxDisplayFactorySingleDFB : public wxDisplayFactorySingle
{
protected:
virtual wxDisplayImpl *CreateSingleDisplay()
{
return new wxDisplayImplSingleDFB;
}
};
wxDisplayFactory* wxDisplay::CreateFactory()
{
return new wxDisplayFactorySingleDFB;
}
bool wxColourDisplay() bool wxColourDisplay()
{ {
#warning "FIXME: wxColourDisplay" #warning "FIXME: wxColourDisplay"
@@ -67,13 +95,6 @@ int wxDisplayDepth()
return wxTheApp->GetDisplayMode().bpp; return wxTheApp->GetDisplayMode().bpp;
} }
void wxDisplaySize(int *width, int *height)
{
wxVideoMode mode(wxTheApp->GetDisplayMode());
if ( width ) *width = mode.w;
if ( height ) *height = mode.h;
}
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
@@ -89,15 +110,6 @@ void wxDisplaySizeMM(int *width, int *height)
#undef PX_TO_MM #undef PX_TO_MM
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
// return desktop dimensions minus any panels, menus, trays:
if (x) *x = 0;
if (y) *y = 0;
wxDisplaySize(width, height);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// mouse // mouse
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -8,11 +8,7 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#if wxUSE_DISPLAY #include "wx/private/display.h"
#include "wx/display.h"
#include "wx/private/display.h"
#endif
#include "wx/utils.h" // wxClientDisplayRect
#include "wx/gtk/private/wrapgtk.h" #include "wx/gtk/private/wrapgtk.h"
#ifdef GDK_WINDOWING_X11 #ifdef GDK_WINDOWING_X11
@@ -75,61 +71,6 @@ wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle*
#endif // !__WXGTK4__ #endif // !__WXGTK4__
void wxClientDisplayRect(int* x, int* y, int* width, int* height)
{
GdkRectangle rect;
GdkWindow* window = wxGetTopLevelGDK();
#ifdef __WXGTK4__
GdkMonitor* monitor =
gdk_display_get_monitor_at_window(gdk_window_get_display(window), window);
gdk_monitor_get_workarea(monitor, &rect);
#else
GdkScreen* screen = gdk_window_get_screen(window);
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
int monitor = gdk_screen_get_monitor_at_window(screen, window);
gdk_screen_get_monitor_workarea(screen, monitor, &rect);
wxGCC_WARNING_RESTORE()
#endif
if (x)
*x = rect.x;
if (y)
*y = rect.y;
if (width)
*width = rect.width;
if (height)
*height = rect.height;
}
//-----------------------------------------------------------------------------
#if wxUSE_DISPLAY
class wxDisplayFactoryGTK: public wxDisplayFactory
{
public:
virtual wxDisplayImpl* CreateDisplay(unsigned n) wxOVERRIDE;
virtual unsigned GetCount() wxOVERRIDE;
virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE;
};
class wxDisplayImplGTK: public wxDisplayImpl
{
typedef wxDisplayImpl base_type;
public:
wxDisplayImplGTK(unsigned i);
virtual wxRect GetGeometry() const wxOVERRIDE;
virtual wxRect GetClientArea() const wxOVERRIDE;
virtual wxString GetName() const wxOVERRIDE;
virtual bool IsPrimary() const wxOVERRIDE;
virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE;
virtual wxVideoMode GetCurrentMode() const wxOVERRIDE;
virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE;
#ifdef __WXGTK4__
GdkMonitor* const m_monitor;
#else
GdkScreen* const m_screen;
#endif
};
//-----------------------------------------------------------------------------
#ifdef __WXGTK4__ #ifdef __WXGTK4__
static inline GdkDisplay* GetDisplay() static inline GdkDisplay* GetDisplay()
{ {
@@ -142,6 +83,45 @@ static inline GdkScreen* GetScreen()
} }
#endif #endif
//-----------------------------------------------------------------------------
// This class is always defined as it's used for the main display even when
// wxUSE_DISPLAY == 0.
class wxDisplayImplGTK : public wxDisplayImpl
{
typedef wxDisplayImpl base_type;
public:
wxDisplayImplGTK(unsigned i);
virtual wxRect GetGeometry() const wxOVERRIDE;
virtual wxRect GetClientArea() const wxOVERRIDE;
#if wxUSE_DISPLAY
virtual wxString GetName() const wxOVERRIDE;
virtual bool IsPrimary() const wxOVERRIDE;
virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE;
virtual wxVideoMode GetCurrentMode() const wxOVERRIDE;
virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE;
#endif // wxUSE_DISPLAY
#ifdef __WXGTK4__
GdkMonitor* const m_monitor;
#else
GdkScreen* const m_screen;
#endif
};
//-----------------------------------------------------------------------------
// This class is only defined when we're built with full display support.
#if wxUSE_DISPLAY
class wxDisplayFactoryGTK: public wxDisplayFactory
{
public:
virtual wxDisplayImpl* CreateDisplay(unsigned n) wxOVERRIDE;
virtual unsigned GetCount() wxOVERRIDE;
virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE;
};
wxDisplayImpl* wxDisplayFactoryGTK::CreateDisplay(unsigned n) wxDisplayImpl* wxDisplayFactoryGTK::CreateDisplay(unsigned n)
{ {
return new wxDisplayImplGTK(n); return new wxDisplayImplGTK(n);
@@ -185,6 +165,8 @@ int wxDisplayFactoryGTK::GetFromPoint(const wxPoint& pt)
return monitor; return monitor;
#endif #endif
} }
#endif // wxUSE_DISPLAY
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxDisplayImplGTK::wxDisplayImplGTK(unsigned i) wxDisplayImplGTK::wxDisplayImplGTK(unsigned i)
@@ -223,6 +205,7 @@ wxRect wxDisplayImplGTK::GetClientArea() const
return wxRect(rect.x, rect.y, rect.width, rect.height); return wxRect(rect.x, rect.y, rect.width, rect.height);
} }
#if wxUSE_DISPLAY
wxString wxDisplayImplGTK::GetName() const wxString wxDisplayImplGTK::GetName() const
{ {
return wxString(); return wxString();
@@ -307,6 +290,23 @@ wxDisplayFactory* wxDisplay::CreateFactory()
{ {
return new wxDisplayFactoryGTK; return new wxDisplayFactoryGTK;
} }
#endif // wxUSE_DISPLAY
#else // !wxUSE_DISPLAY
class wxDisplayFactorySingleGTK : public wxDisplayFactorySingle
{
protected:
virtual wxDisplayImpl *CreateSingleDisplay()
{
return new wxDisplayImplGTK(0);
}
};
wxDisplayFactory* wxDisplay::CreateFactory()
{
return wxDisplayFactorySingleGTK;
}
#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY
#endif // !defined(GDK_WINDOWING_WIN32) #endif // !defined(GDK_WINDOWING_WIN32)

View File

@@ -76,22 +76,6 @@ void *wxGetDisplay()
} }
#endif #endif
void wxDisplaySize( int *width, int *height )
{
#ifdef __WXGTK4__
GdkMonitor* monitor = gdk_display_get_primary_monitor(gdk_display_get_default());
GdkRectangle rect;
gdk_monitor_get_geometry(monitor, &rect);
if (width) *width = rect.width;
if (height) *height = rect.height;
#else
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
if (width) *width = gdk_screen_width();
if (height) *height = gdk_screen_height();
wxGCC_WARNING_RESTORE()
#endif
}
void wxDisplaySizeMM( int *width, int *height ) void wxDisplaySizeMM( int *width, int *height )
{ {
#ifdef __WXGTK4__ #ifdef __WXGTK4__

View File

@@ -239,17 +239,6 @@ int wxDisplayDepth()
return DefaultDepth (dpy, DefaultScreen (dpy)); return DefaultDepth (dpy, DefaultScreen (dpy));
} }
// Get size of display
void wxDisplaySize(int *width, int *height)
{
Display *dpy = wxGlobalDisplay();
if ( width )
*width = DisplayWidth (dpy, DefaultScreen (dpy));
if ( height )
*height = DisplayHeight (dpy, DefaultScreen (dpy));
}
void wxDisplaySizeMM(int *width, int *height) void wxDisplaySizeMM(int *width, int *height)
{ {
Display *dpy = wxGlobalDisplay(); Display *dpy = wxGlobalDisplay();

View File

@@ -24,11 +24,46 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/private/display.h"
#include "wx/msw/private.h"
#include "wx/msw/wrapwin.h" #include "wx/msw/wrapwin.h"
#if wxUSE_DISPLAY // This implementation is always available, whether wxUSE_DISPLAY is 1 or not,
// as we fall back to it in case of error.
class wxDisplayImplSingleMSW : public wxDisplayImplSingle
{
public:
virtual wxRect GetGeometry() const wxOVERRIDE
{
ScreenHDC dc;
#include "wx/display.h" return wxRect(0, 0,
::GetDeviceCaps(dc, HORZRES),
::GetDeviceCaps(dc, VERTRES));
}
virtual wxRect GetClientArea() const wxOVERRIDE
{
RECT rc;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0);
wxRect rectClient;
wxCopyRECTToRect(rc, rectClient);
return rectClient;
}
};
class wxDisplayFactorySingleMSW : public wxDisplayFactorySingle
{
protected:
virtual wxDisplayImpl *CreateSingleDisplay() wxOVERRIDE
{
return new wxDisplayImplSingleMSW;
}
};
#if wxUSE_DISPLAY
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/dynarray.h" #include "wx/dynarray.h"
@@ -39,9 +74,7 @@
#include "wx/dynlib.h" #include "wx/dynlib.h"
#include "wx/sysopt.h" #include "wx/sysopt.h"
#include "wx/private/display.h"
#include "wx/msw/missing.h" #include "wx/msw/missing.h"
#include "wx/msw/private.h"
#include "wx/msw/private/hiddenwin.h" #include "wx/msw/private/hiddenwin.h"
static const wxChar displayDllName[] = wxT("user32.dll"); static const wxChar displayDllName[] = wxT("user32.dll");
@@ -170,7 +203,7 @@ wxDisplayFactoryMSW* wxDisplayFactoryMSW::ms_factory = NULL;
delete factoryMM; delete factoryMM;
// fall back to a stub implementation if no multimon support (Win95?) // fall back to a stub implementation if no multimon support (Win95?)
return new wxDisplayFactorySingle; return new wxDisplayFactorySingleMSW;
} }
@@ -507,17 +540,12 @@ int wxDisplayFactoryMSW::GetFromWindow(const wxWindow *window)
#endif #endif
} }
#endif // wxUSE_DISPLAY #else // !wxUSE_DISPLAY
void wxClientDisplayRect(int *x, int *y, int *width, int *height) // In this case, wxDisplayFactorySingleMSW is the only implementation.
wxDisplayFactory* wxDisplay::CreateFactory()
{ {
// Determine the desktop dimensions minus the taskbar and any other return new wxDisplayFactorySingleMSW;
// special decorations...
RECT r;
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
if (x) *x = r.left;
if (y) *y = r.top;
if (width) *width = r.right - r.left;
if (height) *height = r.bottom - r.top;
} }
#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY

View File

@@ -145,17 +145,6 @@ int wxDisplayDepth()
return GetDeviceCaps(dc, PLANES) * GetDeviceCaps(dc, BITSPIXEL); return GetDeviceCaps(dc, PLANES) * GetDeviceCaps(dc, BITSPIXEL);
} }
// Get size of display
void wxDisplaySize(int *width, int *height)
{
ScreenHDC dc;
if ( width )
*width = ::GetDeviceCaps(dc, HORZRES);
if ( height )
*height = ::GetDeviceCaps(dc, VERTRES);
}
void wxDisplaySizeMM(int *width, int *height) void wxDisplaySizeMM(int *width, int *height)
{ {
ScreenHDC dc; ScreenHDC dc;

View File

@@ -484,19 +484,11 @@ void wxApp::DoCleanUp()
} }
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height) extern // used from src/osx/core/display.cpp
wxRect wxOSXGetMainDisplayClientArea()
{ {
NSRect displayRect = [wxOSXGetMenuScreen() visibleFrame]; NSRect displayRect = [wxOSXGetMenuScreen() visibleFrame];
wxRect r = wxFromNSRect( NULL, displayRect ); return wxFromNSRect( NULL, displayRect );
if ( x )
*x = r.x;
if ( y )
*y = r.y;
if ( width )
*width = r.GetWidth();
if ( height )
*height = r.GetHeight();
} }
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )

View File

@@ -22,9 +22,7 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_DISPLAY #include "wx/private/display.h"
#include "wx/display.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/dynarray.h" #include "wx/dynarray.h"
@@ -33,11 +31,32 @@
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#endif #endif
#include "wx/private/display.h"
#include "wx/scopedarray.h"
#include "wx/osx/private.h" #include "wx/osx/private.h"
#if wxOSX_USE_COCOA_OR_CARBON // ----------------------------------------------------------------------------
// common helpers compiled even in wxUSE_DISPLAY==0 case
// ----------------------------------------------------------------------------
// This one is defined in Objective C++ code.
extern wxRect wxOSXGetMainDisplayClientArea();
namespace
{
wxRect wxGetDisplayGeometry(CGDirectDisplayID id)
{
CGRect theRect = CGDisplayBounds(id);
return wxRect( (int)theRect.origin.x,
(int)theRect.origin.y,
(int)theRect.size.width,
(int)theRect.size.height ); //floats
}
} // anonymous namespace
#if wxUSE_DISPLAY
#include "wx/scopedarray.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// display classes implementation // display classes implementation
@@ -197,11 +216,7 @@ bool wxDisplayImplMacOSX::IsPrimary() const
wxRect wxDisplayImplMacOSX::GetGeometry() const wxRect wxDisplayImplMacOSX::GetGeometry() const
{ {
CGRect theRect = CGDisplayBounds(m_id); return wxGetDisplayGeometry(m_id);
return wxRect( (int)theRect.origin.x,
(int)theRect.origin.y,
(int)theRect.size.width,
(int)theRect.size.height ); //floats
} }
wxRect wxDisplayImplMacOSX::GetClientArea() const wxRect wxDisplayImplMacOSX::GetClientArea() const
@@ -210,7 +225,7 @@ wxRect wxDisplayImplMacOSX::GetClientArea() const
// wxGetClientDisplayRect() does work correctly for at least the main // wxGetClientDisplayRect() does work correctly for at least the main
// one (TODO: do it correctly for the other displays too) // one (TODO: do it correctly for the other displays too)
if ( IsPrimary() ) if ( IsPrimary() )
return wxGetClientDisplayRect(); return wxOSXGetMainDisplayClientArea();
return wxDisplayImpl::GetClientArea(); return wxDisplayImpl::GetClientArea();
} }
@@ -311,13 +326,34 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode )
return new wxDisplayFactoryMacOSX; return new wxDisplayFactoryMacOSX;
} }
#else #else // !wxUSE_DISPLAY
class wxDisplayImplSingleMacOSX : public wxDisplayImplSingle
{
public:
virtual wxRect GetGeometry() const wxOVERRIDE
{
return wxGetDisplayGeometry(CGMainDisplayID());
}
virtual wxRect GetClientArea() const wxOVERRIDE
{
return wxOSXGetMainDisplayClientArea();
}
};
class wxDisplayFactorySingleMacOSX : public wxDisplayFactorySingle
{
protected:
virtual wxDisplayImpl *CreateSingleDisplay() wxOVERRIDE
{
return new wxDisplayImplSingleMacOSX;
}
};
/* static */ wxDisplayFactory *wxDisplay::CreateFactory() /* static */ wxDisplayFactory *wxDisplay::CreateFactory()
{ {
return new wxDisplayFactorySingle; return new wxDisplayFactorySingleMacOSX;
} }
#endif
#endif // wxUSE_DISPLAY #endif // wxUSE_DISPLAY

View File

@@ -25,6 +25,8 @@
#include "wx/apptrait.h" #include "wx/apptrait.h"
#include "wx/private/display.h"
#include "wx/osx/private.h" #include "wx/osx/private.h"
#if wxUSE_GUI #if wxUSE_GUI
@@ -116,46 +118,6 @@ CFArrayRef CopyAvailableFontFamilyNames()
return (CFArrayRef) [[UIFont familyNames] retain]; return (CFArrayRef) [[UIFont familyNames] retain];
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
#if 0
CGRect r = [[UIScreen mainScreen] applicationFrame];
CGRect bounds = [[UIScreen mainScreen] bounds];
if ( bounds.size.height > r.size.height )
{
// portrait
if ( x )
*x = r.origin.x;
if ( y )
*y = r.origin.y;
if ( width )
*width = r.size.width;
if ( height )
*height = r.size.height;
}
else
{
// landscape
if ( x )
*x = r.origin.y;
if ( y )
*y = r.origin.x;
if ( width )
*width = r.size.height;
if ( height )
*height = r.size.width;
}
#else
// it's easier to treat the status bar as an element of the toplevel window
// instead of the desktop in order to support easy rotation
if ( x )
*x = 0;
if ( y )
*y = 0;
wxDisplaySize(width, height);
#endif
}
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )
{ {
if ( x ) if ( x )
@@ -177,26 +139,44 @@ int wxDisplayDepth()
} }
// Get size of display // Get size of display
void wxDisplaySize(int *width, int *height)
{
CGRect bounds = [[UIScreen mainScreen] bounds];
if ( UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) ) class wxDisplayImplSingleiOS : public wxDisplayImplSingle
{
public:
virtual wxRect GetGeometry() const wxOVERRIDE
{ {
// portrait CGRect bounds = [[UIScreen mainScreen] bounds];
if ( width )
*width = (int)bounds.size.width ; int width, height;
if ( height ) if ( UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) )
*height = (int)bounds.size.height; {
// portrait
width = (int)bounds.size.width ;
height = (int)bounds.size.height;
}
else
{
// landscape
width = (int)bounds.size.height ;
height = (int)bounds.size.width;
}
return wxRect(0, 0, width, height);
} }
else };
class wxDisplayFactorySingleiOS : public wxDisplayFactorySingle
{
protected:
virtual wxDisplayImpl *CreateSingleDisplay() wxOVERRIDE
{ {
// landscape return new wxDisplayImplSingleiOS;
if ( width )
*width = (int)bounds.size.height ;
if ( height )
*height = (int)bounds.size.width;
} }
};
/* static */ wxDisplayFactory *wxDisplay::CreateFactory()
{
return new wxDisplayFactorySingleiOS;
} }
wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)

View File

@@ -87,17 +87,6 @@ int wxDisplayDepth()
return theDepth; return theDepth;
} }
// Get size of display
void wxDisplaySize(int *width, int *height)
{
// TODO adapt for multi-displays
CGRect bounds = CGDisplayBounds(CGMainDisplayID());
if ( width )
*width = (int)bounds.size.width ;
if ( height )
*height = (int)bounds.size.height;
}
#if wxUSE_GUI #if wxUSE_GUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -24,9 +24,11 @@ public:
virtual wxString GetName() const wxOVERRIDE; virtual wxString GetName() const wxOVERRIDE;
#if wxUSE_DISPLAY
virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE;
virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE;
virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE;
#endif // wxUSE_DISPLAY
}; };
wxDisplayImplQt::wxDisplayImplQt( unsigned n ) wxDisplayImplQt::wxDisplayImplQt( unsigned n )
@@ -49,6 +51,7 @@ wxString wxDisplayImplQt::GetName() const
return wxString(); return wxString();
} }
#if wxUSE_DISPLAY
wxArrayVideoModes wxDisplayImplQt::GetModes(const wxVideoMode& WXUNUSED(mode)) const wxArrayVideoModes wxDisplayImplQt::GetModes(const wxVideoMode& WXUNUSED(mode)) const
{ {
return wxArrayVideoModes(); return wxArrayVideoModes();
@@ -67,10 +70,13 @@ bool wxDisplayImplQt::ChangeMode(const wxVideoMode& WXUNUSED(mode))
{ {
return false; return false;
} }
#endif // wxUSE_DISPLAY
//############################################################################## //##############################################################################
#if wxUSE_DISPLAY
class wxDisplayFactoryQt : public wxDisplayFactory class wxDisplayFactoryQt : public wxDisplayFactory
{ {
public: public:
@@ -100,3 +106,21 @@ int wxDisplayFactoryQt::GetFromPoint(const wxPoint& pt)
{ {
return new wxDisplayFactoryQt; return new wxDisplayFactoryQt;
} }
#else // wxUSE_DISPLAY
class wxDisplayFactorySingleQt : public wxDisplayFactorySingleQt
{
protected:
virtual wxDisplayImpl *CreateSingleDisplay() wxOVERRIDE
{
return new wxDisplayImplQt(0);
}
};
/* static */ wxDisplayFactory *wxDisplay::CreateFactory()
{
return new wxDisplayFactorySingleQt;
}
#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY

View File

@@ -115,14 +115,6 @@ int wxDisplayDepth()
return QApplication::desktop()->depth(); return QApplication::desktop()->depth();
} }
void wxDisplaySize(int *width, int *height)
{
if ( width != NULL )
*width = QApplication::desktop()->width();
if ( height != NULL )
*height = QApplication::desktop()->height();
}
void wxDisplaySizeMM(int *width, int *height) void wxDisplaySizeMM(int *width, int *height)
{ {
if ( width != NULL ) if ( width != NULL )
@@ -136,16 +128,6 @@ void wxBell()
QApplication::beep(); QApplication::beep();
} }
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
QRect r = QApplication::desktop()->availableGeometry();
*x = r.x();
*y = r.y();
*width = r.width();
*height = r.height();
}
wxWindow *wxGetActiveWindow() wxWindow *wxGetActiveWindow()
{ {
QWidget *w = QApplication::activeWindow(); QWidget *w = QApplication::activeWindow();

View File

@@ -37,13 +37,45 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#endif #endif
#if wxUSE_DISPLAY
#include "wx/display.h"
#include "wx/private/display.h" #include "wx/private/display.h"
#ifndef __WXGTK20__ #ifndef __WXGTK20__
static wxRect wxGetMainScreenWorkArea();
class wxDisplayImplSingleX11 : public wxDisplayImplSingle
{
public:
virtual wxRect GetGeometry() const wxOVERRIDE
{
Display* const dpy = wxGetX11Display();
return wxRect(0, 0,
DisplayWidth(dpy, DefaultScreen (dpy)),
DisplayHeight(dpy, DefaultScreen (dpy)));
}
virtual wxRect GetClientArea() const wxOVERRIDE
{
return wxGetMainScreenWorkArea();
}
};
class wxDisplayFactorySingleX11 : public wxDisplayFactorySingle
{
protected:
virtual wxDisplayImpl *CreateSingleDisplay()
{
return new wxDisplayImplSingleX11;
}
};
#endif // !__WXGTK20__
#if wxUSE_DISPLAY
#ifndef __WXGTK20__
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
typedef XineramaScreenInfo ScreenInfo; typedef XineramaScreenInfo ScreenInfo;
@@ -97,7 +129,7 @@ public:
// we intentionally don't cache the result here because the client // we intentionally don't cache the result here because the client
// display area may change (e.g. the user resized or hid a panel) and // display area may change (e.g. the user resized or hid a panel) and
// we don't currently react to its changes // we don't currently react to its changes
return IsPrimary() ? wxGetClientDisplayRect() : m_rect; return IsPrimary() ? wxGetMainScreenWorkArea() : m_rect;
} }
virtual wxString GetName() const wxOVERRIDE { return wxString(); } virtual wxString GetName() const wxOVERRIDE { return wxString(); }
@@ -347,13 +379,20 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode))
/* static */ wxDisplayFactory *wxDisplay::CreateFactory() /* static */ wxDisplayFactory *wxDisplay::CreateFactory()
{ {
if ( !XineramaIsActive((Display*)wxGetDisplay()) ) if ( !XineramaIsActive((Display*)wxGetDisplay()) )
return new wxDisplayFactorySingle; return new wxDisplayFactorySingleX11;
return new wxDisplayFactoryX11; return new wxDisplayFactoryX11;
} }
#endif #endif
#endif /* wxUSE_DISPLAY */ #else // !wxUSE_DISPLAY
/* static */ wxDisplayFactory *wxDisplay::CreateFactory()
{
return new wxDisplayFactorySingleX11;
}
#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY
#if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) #if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11)
void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height)
@@ -388,45 +427,33 @@ void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height)
#ifndef __WXGTK20__ #ifndef __WXGTK20__
void wxClientDisplayRect(int *x, int *y, int *width, int *height) wxRect wxGetMainScreenWorkArea()
{ {
wxRect rect;
Display * const dpy = wxGetX11Display(); Display * const dpy = wxGetX11Display();
wxCHECK_RET( dpy, wxT("can't be called before initializing the GUI") ); wxCHECK_MSG( dpy, rect, "can't be called before initializing the GUI" );
wxRect rectClient;
wxGetWorkAreaX11(DefaultScreenOfDisplay(dpy), wxGetWorkAreaX11(DefaultScreenOfDisplay(dpy),
rectClient.x, rectClient.y, rectClient.width, rectClient.height); rect.x, rect.y, rect.width, rect.height);
// Although _NET_WORKAREA is supposed to return the client size of the const wxRect rectFull = wxDisplay().GetGeometry();
// screen, not all implementations are conforming, apparently, see #14419,
// so make sure we return a subset of the primary display.
wxRect rectFull;
#if wxUSE_DISPLAY
ScreensInfo screens;
const ScreenInfo& info = screens[0];
rectFull = wxRect(info.x_org, info.y_org, info.width, info.height);
#else
wxDisplaySize(&rectFull.width, &rectFull.height);
#endif
if ( !rectClient.width || !rectClient.height ) if ( !rect.width || !rect.height )
{ {
// _NET_WORKAREA not available or didn't work, fall back to the total // _NET_WORKAREA not available or didn't work, fall back to the total
// display size. // display size.
rectClient = rectFull; rect = rectFull;
} }
else else
{ {
rectClient = rectClient.Intersect(rectFull); // Although _NET_WORKAREA is supposed to return the client size of the
// screen, not all implementations are conforming, apparently, see
// #14419, so make sure we return a subset of the primary display.
rect = rect.Intersect(rectFull);
} }
if ( x ) return rect;
*x = rectClient.x;
if ( y )
*y = rectClient.y;
if ( width )
*width = rectClient.width;
if ( height )
*height = rectClient.height;
} }
#endif // !__WXGTK20__ #endif // !__WXGTK20__

View File

@@ -162,17 +162,6 @@ int wxDisplayDepth()
return DefaultDepth (dpy, DefaultScreen (dpy)); return DefaultDepth (dpy, DefaultScreen (dpy));
} }
// Get size of display
void wxDisplaySize(int *width, int *height)
{
Display *dpy = (Display*) wxGetDisplay();
if ( width )
*width = DisplayWidth (dpy, DefaultScreen (dpy));
if ( height )
*height = DisplayHeight (dpy, DefaultScreen (dpy));
}
void wxDisplaySizeMM(int *width, int *height) void wxDisplaySizeMM(int *width, int *height)
{ {
Display *dpy = (Display*) wxGetDisplay(); Display *dpy = (Display*) wxGetDisplay();