diff --git a/Makefile.in b/Makefile.in index 342a4d4a29..66087484d8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3783,7 +3783,6 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/dialup.h \ wx/dirctrl.h \ wx/display.h \ - wx/display_impl.h \ wx/dnd.h \ wx/docmdi.h \ wx/docview.h \ @@ -5606,7 +5605,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS = \ monodll_timectrl_osx.o \ monodll_taskbarcmn.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_IPHONE___GUI_SRC_OBJECTS = \ $(__OSX_COMMON_SRC_OBJECTS) \ @@ -7571,7 +7571,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1 = \ monolib_timectrl_osx.o \ monolib_taskbarcmn.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_IPHONE___GUI_SRC_OBJECTS_1 = \ $(__OSX_COMMON_SRC_OBJECTS_0) \ @@ -9683,7 +9684,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2 = \ coredll_timectrl_osx.o \ coredll_taskbarcmn.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_IPHONE___GUI_SRC_OBJECTS_2 = \ $(__OSX_COMMON_SRC_OBJECTS_8) \ @@ -11390,7 +11392,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3 = \ corelib_timectrl_osx.o \ corelib_taskbarcmn.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_IPHONE___GUI_SRC_OBJECTS_3 = \ $(__OSX_COMMON_SRC_OBJECTS_9) \ @@ -13193,7 +13196,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS = \ monodll_core_bitmap.o \ monodll_core_colour.o \ monodll_core_dcmemory.o \ - monodll_core_display.o \ monodll_core_fontenum.o \ monodll_hid.o \ monodll_printmac.o \ @@ -13337,7 +13339,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_17 = \ monolib_core_bitmap.o \ monolib_core_colour.o \ monolib_core_dcmemory.o \ - monolib_core_display.o \ monolib_core_fontenum.o \ monolib_hid.o \ monolib_printmac.o \ @@ -13481,7 +13482,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_1 = \ coredll_core_bitmap.o \ coredll_core_colour.o \ coredll_core_dcmemory.o \ - coredll_core_display.o \ coredll_core_fontenum.o \ coredll_hid.o \ coredll_printmac.o \ @@ -13622,7 +13622,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4 = \ corelib_core_bitmap.o \ corelib_core_colour.o \ corelib_core_dcmemory.o \ - corelib_core_display.o \ corelib_core_fontenum.o \ corelib_hid.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) $(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) $(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@ $(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@ $(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) $(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) $(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@ $(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@ $(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) $(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) $(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@ $(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@ $(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) $(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) $(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@ $(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@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 80b3217f79..1ed7be89a5 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2381,7 +2381,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/osx/core/bitmap.cpp src/osx/core/colour.cpp src/osx/core/dcmemory.cpp - src/osx/core/display.cpp src/osx/core/fontenum.cpp src/osx/core/hid.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/osx/cocoa/activityindicator.mm src/osx/cocoa/statbmp.mm + src/osx/core/display.cpp wx/osx/cocoa/chkconf.h diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 5af3d5ac77..5b80c492bd 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -2258,7 +2258,6 @@ set(OSX_LOWLEVEL_SRC src/osx/core/bitmap.cpp src/osx/core/colour.cpp src/osx/core/dcmemory.cpp - src/osx/core/display.cpp src/osx/core/fontenum.cpp src/osx/core/hid.cpp src/osx/core/printmac.cpp @@ -2500,6 +2499,7 @@ set(OSX_COCOA_SRC src/osx/datectrl_osx.cpp src/osx/core/sound.cpp src/osx/cocoa/statbmp.mm + src/osx/core/display.cpp ) set(OSX_COCOA_HDR diff --git a/build/files b/build/files index abe00f1361..1150ec1f6e 100644 --- a/build/files +++ b/build/files @@ -2246,7 +2246,6 @@ OSX_LOWLEVEL_SRC = src/osx/core/bitmap.cpp src/osx/core/colour.cpp src/osx/core/dcmemory.cpp - src/osx/core/display.cpp src/osx/core/fontenum.cpp src/osx/core/hid.cpp src/osx/core/printmac.cpp @@ -2477,6 +2476,7 @@ OSX_COCOA_SRC = src/osx/cocoa/toolbar.mm src/osx/cocoa/tooltip.mm src/osx/cocoa/window.mm + src/osx/core/display.cpp src/osx/core/hidjoystick.cpp src/osx/core/sound.cpp src/osx/dataview_osx.cpp diff --git a/build/osx/wxiphone.xcodeproj/project.pbxproj b/build/osx/wxiphone.xcodeproj/project.pbxproj index 422f721df1..0b90d8c331 100644 --- a/build/osx/wxiphone.xcodeproj/project.pbxproj +++ b/build/osx/wxiphone.xcodeproj/project.pbxproj @@ -803,7 +803,6 @@ F0B3F484C38C3BA0B9927CD9 /* docmdi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECC9F5C21ACB31A0B24AEE35 /* docmdi.cpp */; }; F0D892C2618130FEAD46BB86 /* panel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00969CBE3B8F32C78C195619 /* panel.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 */; }; 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 */; }; @@ -1402,7 +1401,6 @@ A46D50BEBF523B3F88831086 /* LexAsn1.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexAsn1.cxx; path = ../../src/stc/scintilla/lexers/LexAsn1.cxx; sourceTree = ""; }; A4A745D1821A32D591D76650 /* imagiff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = imagiff.cpp; path = ../../src/common/imagiff.cpp; sourceTree = ""; }; A54B80C17F823CB5900AD2E8 /* framecmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = framecmn.cpp; path = ../../src/common/framecmn.cpp; sourceTree = ""; }; - A5617D10CB7136EC9A4194EF /* display.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = display.cpp; path = ../../src/osx/core/display.cpp; sourceTree = ""; }; A5794CD687013AF8A20A691A /* headerctrlcmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = headerctrlcmn.cpp; path = ../../src/common/headerctrlcmn.cpp; sourceTree = ""; }; A57CF60203F53459A03951A9 /* arrstr.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = arrstr.cpp; path = ../../src/common/arrstr.cpp; sourceTree = ""; }; A5BBC1E494D33D028CA547FF /* jddctmgr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jddctmgr.c; path = ../../src/jpeg/jddctmgr.c; sourceTree = ""; }; @@ -1953,7 +1951,6 @@ A1A53EC3A3463EFDB7614E93 /* bitmap.cpp */, 9D1F14339D1C331087650931 /* colour.cpp */, 343D4FDD5CC030618EF24729 /* dcmemory.cpp */, - A5617D10CB7136EC9A4194EF /* display.cpp */, 36E1DBA275AD325DB759C180 /* fontenum.cpp */, 160EB9744CB63A0B81DC651F /* hid.cpp */, 5CC5C13F8AA1387BADB7E60C /* printmac.cpp */, @@ -3008,7 +3005,6 @@ 03BF1610E2FC3BD5ACB754F0 /* bitmap.cpp in Sources */, FF50EC0EC5F23DF890C6E95F /* colour.cpp in Sources */, BD2B17EB72E73A6EB6E0B26F /* dcmemory.cpp in Sources */, - F1F484DD591337399FCD0463 /* display.cpp in Sources */, 371809DA4AD1382F8B532878 /* fontenum.cpp in Sources */, 86BE5213D3F131D8A6862679 /* hid.cpp in Sources */, AB58406CEBA13BC4A2A83B66 /* printmac.cpp in Sources */, diff --git a/include/wx/private/display.h b/include/wx/private/display.h index 9e0f399c28..2635758fe8 100644 --- a/include/wx/private/display.h +++ b/include/wx/private/display.h @@ -10,6 +10,7 @@ #ifndef _WX_PRIVATE_DISPLAY_H_ #define _WX_PRIVATE_DISPLAY_H_ +#include "wx/display.h" #include "wx/gdicmn.h" // for wxRect #include "wx/vector.h" @@ -112,18 +113,63 @@ protected: 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 // ---------------------------------------------------------------------------- -// this is a stub implementation using single/main display only, it is -// available even if wxUSE_DISPLAY == 0 +// This is the simplest implementation of wxDisplayFactory using single/main +// 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 { public: - virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE; virtual unsigned GetCount() wxOVERRIDE { return 1; } virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; + +protected: + virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE; + + virtual wxDisplayImpl *CreateSingleDisplay() = 0; }; #endif // _WX_PRIVATE_DISPLAY_H_ diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index 9e59f0aeba..cd49ae60ec 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -29,7 +29,6 @@ #include "wx/module.h" #endif //WX_PRECOMP -#include "wx/display.h" #include "wx/private/display.h" #if wxUSE_DISPLAY @@ -50,43 +49,6 @@ const wxVideoMode wxDefaultVideoMode; // created on demand and destroyed by wxDisplayModule 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 // ---------------------------------------------------------------------------- @@ -201,16 +163,6 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode) // 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() { if ( !gs_factory ) @@ -248,20 +200,10 @@ int wxDisplayFactory::GetFromWindow(const wxWindow *window) wxDisplayImpl *wxDisplayFactorySingle::CreateDisplay(unsigned n) { // we recognize the main display only - return n != 0 ? NULL : new wxDisplayImplSingle; + return n != 0 ? NULL : CreateSingleDisplay(); } int wxDisplayFactorySingle::GetFromPoint(const wxPoint& pt) { - if ( pt.x >= 0 && pt.y >= 0 ) - { - 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; + return wxDisplay().GetGeometry().Contains(pt) ? 0 : wxNOT_FOUND; } diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 6d16a12d60..771db4ac72 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -16,6 +16,8 @@ #endif #include "wx/gdicmn.h" + +#include "wx/display.h" #include "wx/gdiobj.h" #ifndef WX_PRECOMP @@ -843,18 +845,36 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize, return font; } +void wxDisplaySize(int *width, int *height) +{ + const wxSize size = wxGetDisplaySize(); + if ( width ) + *width = size.x; + if ( height ) + *height = size.y; +} + wxSize wxGetDisplaySize() { - int x, y; - wxDisplaySize(& x, & y); - return wxSize(x, y); + return wxDisplay().GetGeometry().GetSize(); +} + +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() { - int x, y, width, height; - wxClientDisplayRect(&x, &y, &width, &height); // call plat-specific version - return wxRect(x, y, width, height); + return wxDisplay().GetClientArea(); } wxSize wxGetDisplaySizeMM() diff --git a/src/dfb/utils.cpp b/src/dfb/utils.cpp index 57e9a3d1a1..76c84a5c50 100644 --- a/src/dfb/utils.cpp +++ b/src/dfb/utils.cpp @@ -17,6 +17,7 @@ #include "wx/utils.h" #include "wx/evtloop.h" #include "wx/apptrait.h" +#include "wx/private/display.h" #include "wx/unix/private/timer.h" #ifndef WX_PRECOMP @@ -56,6 +57,33 @@ wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) // 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() { #warning "FIXME: wxColourDisplay" @@ -67,13 +95,6 @@ int wxDisplayDepth() 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) { // 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 } -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 //----------------------------------------------------------------------------- diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index cc00c499dd..eb68667724 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -8,11 +8,7 @@ #include "wx/wxprec.h" -#if wxUSE_DISPLAY - #include "wx/display.h" - #include "wx/private/display.h" -#endif -#include "wx/utils.h" // wxClientDisplayRect +#include "wx/private/display.h" #include "wx/gtk/private/wrapgtk.h" #ifdef GDK_WINDOWING_X11 @@ -75,61 +71,6 @@ wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* #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__ static inline GdkDisplay* GetDisplay() { @@ -142,6 +83,45 @@ static inline GdkScreen* GetScreen() } #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) { return new wxDisplayImplGTK(n); @@ -185,6 +165,8 @@ int wxDisplayFactoryGTK::GetFromPoint(const wxPoint& pt) return monitor; #endif } +#endif // wxUSE_DISPLAY + //----------------------------------------------------------------------------- wxDisplayImplGTK::wxDisplayImplGTK(unsigned i) @@ -223,6 +205,7 @@ wxRect wxDisplayImplGTK::GetClientArea() const return wxRect(rect.x, rect.y, rect.width, rect.height); } +#if wxUSE_DISPLAY wxString wxDisplayImplGTK::GetName() const { return wxString(); @@ -307,6 +290,23 @@ wxDisplayFactory* wxDisplay::CreateFactory() { 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) diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 7cdbd871c8..31a1d9a9ea 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -76,22 +76,6 @@ void *wxGetDisplay() } #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 ) { #ifdef __WXGTK4__ diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index d440bb0887..16c52e86a8 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -239,17 +239,6 @@ int wxDisplayDepth() 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) { Display *dpy = wxGlobalDisplay(); diff --git a/src/msw/display.cpp b/src/msw/display.cpp index b096d1895d..771cb32132 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -24,11 +24,46 @@ #pragma hdrstop #endif +#include "wx/private/display.h" + +#include "wx/msw/private.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 #include "wx/dynarray.h" @@ -39,9 +74,7 @@ #include "wx/dynlib.h" #include "wx/sysopt.h" -#include "wx/private/display.h" #include "wx/msw/missing.h" -#include "wx/msw/private.h" #include "wx/msw/private/hiddenwin.h" static const wxChar displayDllName[] = wxT("user32.dll"); @@ -170,7 +203,7 @@ wxDisplayFactoryMSW* wxDisplayFactoryMSW::ms_factory = NULL; delete factoryMM; // 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 // 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 - // 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; + return new wxDisplayFactorySingleMSW; } + +#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index 98e985d6e1..1ebbd36259 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -145,17 +145,6 @@ int wxDisplayDepth() 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) { ScreenHDC dc; diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 4e83ce9036..d41809fd1a 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -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]; - wxRect r = wxFromNSRect( NULL, displayRect ); - if ( x ) - *x = r.x; - if ( y ) - *y = r.y; - if ( width ) - *width = r.GetWidth(); - if ( height ) - *height = r.GetHeight(); - + return wxFromNSRect( NULL, displayRect ); } void wxGetMousePosition( int* x, int* y ) diff --git a/src/osx/core/display.cpp b/src/osx/core/display.cpp index 679312274b..fedbfb7d10 100644 --- a/src/osx/core/display.cpp +++ b/src/osx/core/display.cpp @@ -22,9 +22,7 @@ #pragma hdrstop #endif -#if wxUSE_DISPLAY - -#include "wx/display.h" +#include "wx/private/display.h" #ifndef WX_PRECOMP #include "wx/dynarray.h" @@ -33,11 +31,32 @@ #include "wx/gdicmn.h" #endif -#include "wx/private/display.h" -#include "wx/scopedarray.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 @@ -197,11 +216,7 @@ bool wxDisplayImplMacOSX::IsPrimary() const wxRect wxDisplayImplMacOSX::GetGeometry() const { - CGRect theRect = CGDisplayBounds(m_id); - return wxRect( (int)theRect.origin.x, - (int)theRect.origin.y, - (int)theRect.size.width, - (int)theRect.size.height ); //floats + return wxGetDisplayGeometry(m_id); } wxRect wxDisplayImplMacOSX::GetClientArea() const @@ -210,7 +225,7 @@ wxRect wxDisplayImplMacOSX::GetClientArea() const // wxGetClientDisplayRect() does work correctly for at least the main // one (TODO: do it correctly for the other displays too) if ( IsPrimary() ) - return wxGetClientDisplayRect(); + return wxOSXGetMainDisplayClientArea(); return wxDisplayImpl::GetClientArea(); } @@ -311,13 +326,34 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode ) 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() { - return new wxDisplayFactorySingle; + return new wxDisplayFactorySingleMacOSX; } -#endif - #endif // wxUSE_DISPLAY diff --git a/src/osx/iphone/utils.mm b/src/osx/iphone/utils.mm index 92b2540149..f4cdcf47fc 100644 --- a/src/osx/iphone/utils.mm +++ b/src/osx/iphone/utils.mm @@ -25,6 +25,8 @@ #include "wx/apptrait.h" +#include "wx/private/display.h" + #include "wx/osx/private.h" #if wxUSE_GUI @@ -116,46 +118,6 @@ CFArrayRef CopyAvailableFontFamilyNames() 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 ) { if ( x ) @@ -177,26 +139,44 @@ int wxDisplayDepth() } // 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 - if ( width ) - *width = (int)bounds.size.width ; - if ( height ) - *height = (int)bounds.size.height; + CGRect bounds = [[UIScreen mainScreen] bounds]; + + int width, height; + if ( UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) ) + { + // 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 - if ( width ) - *width = (int)bounds.size.height ; - if ( height ) - *height = (int)bounds.size.width; + return new wxDisplayImplSingleiOS; } +}; + +/* static */ wxDisplayFactory *wxDisplay::CreateFactory() +{ + return new wxDisplayFactorySingleiOS; } wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index bccc71b132..6860b5e088 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -87,17 +87,6 @@ int wxDisplayDepth() 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 // ---------------------------------------------------------------------------- diff --git a/src/qt/display.cpp b/src/qt/display.cpp index 9a39545451..abf339321c 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -24,9 +24,11 @@ public: virtual wxString GetName() const wxOVERRIDE; +#if wxUSE_DISPLAY virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; +#endif // wxUSE_DISPLAY }; wxDisplayImplQt::wxDisplayImplQt( unsigned n ) @@ -49,6 +51,7 @@ wxString wxDisplayImplQt::GetName() const return wxString(); } +#if wxUSE_DISPLAY wxArrayVideoModes wxDisplayImplQt::GetModes(const wxVideoMode& WXUNUSED(mode)) const { return wxArrayVideoModes(); @@ -67,10 +70,13 @@ bool wxDisplayImplQt::ChangeMode(const wxVideoMode& WXUNUSED(mode)) { return false; } +#endif // wxUSE_DISPLAY //############################################################################## +#if wxUSE_DISPLAY + class wxDisplayFactoryQt : public wxDisplayFactory { public: @@ -100,3 +106,21 @@ int wxDisplayFactoryQt::GetFromPoint(const wxPoint& pt) { 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 diff --git a/src/qt/utils.cpp b/src/qt/utils.cpp index f1e9db341b..92957b8683 100644 --- a/src/qt/utils.cpp +++ b/src/qt/utils.cpp @@ -115,14 +115,6 @@ int wxDisplayDepth() 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) { if ( width != NULL ) @@ -136,16 +128,6 @@ void wxBell() 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() { QWidget *w = QApplication::activeWindow(); diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 5c740ef4b0..93113a4886 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -37,13 +37,45 @@ #include #endif -#if wxUSE_DISPLAY - -#include "wx/display.h" #include "wx/private/display.h" #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 typedef XineramaScreenInfo ScreenInfo; @@ -97,7 +129,7 @@ public: // 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 // 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(); } @@ -347,13 +379,20 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode)) /* static */ wxDisplayFactory *wxDisplay::CreateFactory() { if ( !XineramaIsActive((Display*)wxGetDisplay()) ) - return new wxDisplayFactorySingle; + return new wxDisplayFactorySingleX11; return new wxDisplayFactoryX11; } #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) 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__ -void wxClientDisplayRect(int *x, int *y, int *width, int *height) +wxRect wxGetMainScreenWorkArea() { + wxRect rect; + 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), - 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 - // 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 + const wxRect rectFull = wxDisplay().GetGeometry(); - if ( !rectClient.width || !rectClient.height ) + if ( !rect.width || !rect.height ) { // _NET_WORKAREA not available or didn't work, fall back to the total // display size. - rectClient = rectFull; + rect = rectFull; } 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 ) - *x = rectClient.x; - if ( y ) - *y = rectClient.y; - if ( width ) - *width = rectClient.width; - if ( height ) - *height = rectClient.height; + return rect; } + #endif // !__WXGTK20__ diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index bd80ba5769..4312a3da8e 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -162,17 +162,6 @@ int wxDisplayDepth() 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) { Display *dpy = (Display*) wxGetDisplay();