Browse Source

tags/2021-05-28
jules 18 years ago
parent
commit
f360457470
7 changed files with 60 additions and 63 deletions
  1. +3
    -3
      build/linux/platform_specific_code/juce_linux_Windowing.cpp
  2. +3
    -3
      build/macosx/platform_specific_code/juce_mac_Windowing.cpp
  3. +3
    -3
      build/win32/platform_specific_code/juce_win32_Windowing.cpp
  4. +2
    -2
      src/juce_appframework/events/juce_AsyncUpdater.cpp
  5. +2
    -2
      src/juce_appframework/events/juce_AsyncUpdater.h
  6. +25
    -29
      src/juce_appframework/gui/components/juce_Desktop.cpp
  7. +22
    -21
      src/juce_appframework/gui/components/juce_Desktop.h

+ 3
- 3
build/linux/platform_specific_code/juce_linux_Windowing.cpp View File

@@ -2543,18 +2543,18 @@ void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords, const bool c
} }
//============================================================================== //==============================================================================
bool Desktop::canUseSemiTransparentWindows()
bool Desktop::canUseSemiTransparentWindows() throw()
{ {
return false; return false;
} }
void Desktop::getMousePosition (int& x, int& y)
void Desktop::getMousePosition (int& x, int& y) throw()
{ {
int mouseMods; int mouseMods;
getMousePos (x, y, mouseMods); getMousePos (x, y, mouseMods);
} }
void Desktop::setMousePosition (int x, int y)
void Desktop::setMousePosition (int x, int y) throw()
{ {
Window root = RootWindow (display, DefaultScreen (display)); Window root = RootWindow (display, DefaultScreen (display));
XWarpPointer (display, None, root, 0, 0, 0, 0, x, y); XWarpPointer (display, None, root, 0, 0, 0, 0, x, y);


+ 3
- 3
build/macosx/platform_specific_code/juce_mac_Windowing.cpp View File

@@ -2186,14 +2186,14 @@ bool Process::isForegroundProcess() throw()
} }
//============================================================================== //==============================================================================
bool Desktop::canUseSemiTransparentWindows()
bool Desktop::canUseSemiTransparentWindows() throw()
{ {
return true; return true;
} }
//============================================================================== //==============================================================================
void Desktop::getMousePosition (int& x, int& y)
void Desktop::getMousePosition (int& x, int& y) throw()
{ {
CGrafPtr currentPort; CGrafPtr currentPort;
GetPort (&currentPort); GetPort (&currentPort);
@@ -2222,7 +2222,7 @@ void Desktop::getMousePosition (int& x, int& y)
SetPort (currentPort); SetPort (currentPort);
} }
void Desktop::setMousePosition (int x, int y)
void Desktop::setMousePosition (int x, int y) throw()
{ {
CGPoint pos = { x, y }; CGPoint pos = { x, y };
CGWarpMouseCursorPosition (pos); CGWarpMouseCursorPosition (pos);


+ 3
- 3
build/win32/platform_specific_code/juce_win32_Windowing.cpp View File

@@ -117,7 +117,7 @@ static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int ho
typedef BOOL (WINAPI* UpdateLayeredWinFunc) (HWND, HDC, POINT*, SIZE*, HDC, POINT*, COLORREF, BLENDFUNCTION*, DWORD); typedef BOOL (WINAPI* UpdateLayeredWinFunc) (HWND, HDC, POINT*, SIZE*, HDC, POINT*, COLORREF, BLENDFUNCTION*, DWORD);
static UpdateLayeredWinFunc updateLayeredWindow = 0; static UpdateLayeredWinFunc updateLayeredWindow = 0;
bool Desktop::canUseSemiTransparentWindows()
bool Desktop::canUseSemiTransparentWindows() throw()
{ {
if (updateLayeredWindow == 0) if (updateLayeredWindow == 0)
{ {
@@ -2241,7 +2241,7 @@ bool Process::isForegroundProcess() throw()
} }
//============================================================================== //==============================================================================
void Desktop::getMousePosition (int& x, int& y)
void Desktop::getMousePosition (int& x, int& y) throw()
{ {
POINT mousePos; POINT mousePos;
GetCursorPos (&mousePos); GetCursorPos (&mousePos);
@@ -2249,7 +2249,7 @@ void Desktop::getMousePosition (int& x, int& y)
y = mousePos.y; y = mousePos.y;
} }
void Desktop::setMousePosition (int x, int y)
void Desktop::setMousePosition (int x, int y) throw()
{ {
SetCursorPos (x, y); SetCursorPos (x, y);
} }


+ 2
- 2
src/juce_appframework/events/juce_AsyncUpdater.cpp View File

@@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE
//============================================================================== //==============================================================================
AsyncUpdater::AsyncUpdater()
AsyncUpdater::AsyncUpdater() throw()
: asyncMessagePending (false) : asyncMessagePending (false)
{ {
internalAsyncHandler.owner = this; internalAsyncHandler.owner = this;
@@ -47,7 +47,7 @@ AsyncUpdater::~AsyncUpdater()
{ {
} }
void AsyncUpdater::triggerAsyncUpdate()
void AsyncUpdater::triggerAsyncUpdate() throw()
{ {
if (! asyncMessagePending) if (! asyncMessagePending)
{ {


+ 2
- 2
src/juce_appframework/events/juce_AsyncUpdater.h View File

@@ -50,7 +50,7 @@ class JUCE_API AsyncUpdater
public: public:
//============================================================================== //==============================================================================
/** Creates an AsyncUpdater object. */ /** Creates an AsyncUpdater object. */
AsyncUpdater();
AsyncUpdater() throw();
/** Destructor. /** Destructor.
@@ -70,7 +70,7 @@ public:
It's thread-safe to call this method from any number of threads without It's thread-safe to call this method from any number of threads without
needing to worry about locking. needing to worry about locking.
*/ */
void triggerAsyncUpdate();
void triggerAsyncUpdate() throw();
/** This will stop any pending updates from happening. /** This will stop any pending updates from happening.


+ 25
- 29
src/juce_appframework/gui/components/juce_Desktop.cpp View File

@@ -45,7 +45,7 @@ extern void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords,
//============================================================================== //==============================================================================
static Desktop* instance = 0; static Desktop* instance = 0;
Desktop::Desktop()
Desktop::Desktop() throw()
: mouseListeners (2), : mouseListeners (2),
desktopComponents (4), desktopComponents (4),
monitorCoordsClipped (2), monitorCoordsClipped (2),
@@ -56,7 +56,7 @@ Desktop::Desktop()
refreshMonitorSizes(); refreshMonitorSizes();
} }
Desktop::~Desktop()
Desktop::~Desktop() throw()
{ {
jassert (instance == this); jassert (instance == this);
instance = 0; instance = 0;
@@ -66,7 +66,7 @@ Desktop::~Desktop()
jassert (desktopComponents.size() == 0); jassert (desktopComponents.size() == 0);
} }
Desktop& JUCE_CALLTYPE Desktop::getInstance()
Desktop& JUCE_CALLTYPE Desktop::getInstance() throw()
{ {
if (instance == 0) if (instance == 0)
instance = new Desktop(); instance = new Desktop();
@@ -75,7 +75,7 @@ Desktop& JUCE_CALLTYPE Desktop::getInstance()
} }
//============================================================================== //==============================================================================
void Desktop::refreshMonitorSizes()
void Desktop::refreshMonitorSizes() throw()
{ {
monitorCoordsClipped.clear(); monitorCoordsClipped.clear();
monitorCoordsUnclipped.clear(); monitorCoordsUnclipped.clear();
@@ -85,18 +85,18 @@ void Desktop::refreshMonitorSizes()
&& monitorCoordsClipped.size() == monitorCoordsUnclipped.size()); && monitorCoordsClipped.size() == monitorCoordsUnclipped.size());
} }
int Desktop::getNumDisplayMonitors() const
int Desktop::getNumDisplayMonitors() const throw()
{ {
return monitorCoordsClipped.size(); return monitorCoordsClipped.size();
} }
const Rectangle Desktop::getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const
const Rectangle Desktop::getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw()
{ {
return clippedToWorkArea ? monitorCoordsClipped [index] return clippedToWorkArea ? monitorCoordsClipped [index]
: monitorCoordsUnclipped [index]; : monitorCoordsUnclipped [index];
} }
const RectangleList Desktop::getAllMonitorDisplayAreas (const bool clippedToWorkArea) const
const RectangleList Desktop::getAllMonitorDisplayAreas (const bool clippedToWorkArea) const throw()
{ {
RectangleList rl; RectangleList rl;
@@ -106,12 +106,12 @@ const RectangleList Desktop::getAllMonitorDisplayAreas (const bool clippedToWork
return rl; return rl;
} }
const Rectangle Desktop::getMainMonitorArea (const bool clippedToWorkArea) const
const Rectangle Desktop::getMainMonitorArea (const bool clippedToWorkArea) const throw()
{ {
return getDisplayMonitorCoordinates (0, clippedToWorkArea); return getDisplayMonitorCoordinates (0, clippedToWorkArea);
} }
const Rectangle Desktop::getMonitorAreaContaining (int cx, int cy, const bool clippedToWorkArea) const
const Rectangle Desktop::getMonitorAreaContaining (int cx, int cy, const bool clippedToWorkArea) const throw()
{ {
for (int i = getNumDisplayMonitors(); --i > 0;) for (int i = getNumDisplayMonitors(); --i > 0;)
{ {
@@ -125,12 +125,12 @@ const Rectangle Desktop::getMonitorAreaContaining (int cx, int cy, const bool cl
} }
//============================================================================== //==============================================================================
int Desktop::getNumComponents() const
int Desktop::getNumComponents() const throw()
{ {
return desktopComponents.size(); return desktopComponents.size();
} }
Component* Desktop::getComponent (const int index) const
Component* Desktop::getComponent (const int index) const throw()
{ {
return (Component*) desktopComponents [index]; return (Component*) desktopComponents [index];
} }
@@ -138,38 +138,34 @@ Component* Desktop::getComponent (const int index) const
Component* Desktop::findComponentAt (const int screenX, Component* Desktop::findComponentAt (const int screenX,
const int screenY) const const int screenY) const
{ {
for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
for (int i = desktopComponents.size(); --i >= 0;)
{ {
const ComponentPeer* const peer = ComponentPeer::getPeer (i);
Component* const c = (Component*) desktopComponents.getUnchecked(i);
Component* const c = peer->getComponent();
int x = screenX, y = screenY;
c->globalPositionToRelative (x, y);
if (c != 0)
{
const int x = screenX - c->getScreenX();
const int y = screenY - c->getScreenY();
if (c->contains (x, y))
return c->getComponentAt (x, y);
}
if (c->contains (x, y))
return c->getComponentAt (x, y);
} }
return 0; return 0;
} }
//============================================================================== //==============================================================================
void Desktop::addDesktopComponent (Component* const c)
void Desktop::addDesktopComponent (Component* const c) throw()
{ {
jassert (c != 0);
jassert (! desktopComponents.contains (c)); jassert (! desktopComponents.contains (c));
desktopComponents.addIfNotAlreadyThere (c); desktopComponents.addIfNotAlreadyThere (c);
} }
void Desktop::removeDesktopComponent (Component* const c)
void Desktop::removeDesktopComponent (Component* const c) throw()
{ {
desktopComponents.removeValue (c); desktopComponents.removeValue (c);
} }
void Desktop::componentBroughtToFront (Component* const c)
void Desktop::componentBroughtToFront (Component* const c) throw()
{ {
const int index = desktopComponents.indexOf (c); const int index = desktopComponents.indexOf (c);
jassert (index >= 0); jassert (index >= 0);
@@ -184,13 +180,13 @@ extern int juce_recentMouseDownX [4];
extern int juce_recentMouseDownY [4]; extern int juce_recentMouseDownY [4];
extern int juce_MouseClickCounter; extern int juce_MouseClickCounter;
void Desktop::getLastMouseDownPosition (int& x, int& y)
void Desktop::getLastMouseDownPosition (int& x, int& y) throw()
{ {
x = juce_recentMouseDownX [0]; x = juce_recentMouseDownX [0];
y = juce_recentMouseDownY [0]; y = juce_recentMouseDownY [0];
} }
int Desktop::getMouseButtonClickCounter()
int Desktop::getMouseButtonClickCounter() throw()
{ {
return juce_MouseClickCounter; return juce_MouseClickCounter;
} }
@@ -227,7 +223,7 @@ void Desktop::removeFocusChangeListener (FocusChangeListener* const listener) th
focusListeners.removeValue (listener); focusListeners.removeValue (listener);
} }
void Desktop::triggerFocusCallback()
void Desktop::triggerFocusCallback() throw()
{ {
triggerAsyncUpdate(); triggerAsyncUpdate();
} }
@@ -294,7 +290,7 @@ void Desktop::sendMouseMove()
} }
} }
void Desktop::resetTimer()
void Desktop::resetTimer() throw()
{ {
if (mouseListeners.size() == 0) if (mouseListeners.size() == 0)
stopTimer(); stopTimer();


+ 22
- 21
src/juce_appframework/gui/components/juce_Desktop.h View File

@@ -70,7 +70,7 @@ public:
//============================================================================== //==============================================================================
/** There's only one dektop object, and this method will return it. /** There's only one dektop object, and this method will return it.
*/ */
static Desktop& JUCE_CALLTYPE getInstance();
static Desktop& JUCE_CALLTYPE getInstance() throw();
//============================================================================== //==============================================================================
/** Returns a list of the positions of all the monitors available. /** Returns a list of the positions of all the monitors available.
@@ -80,14 +80,14 @@ public:
If clippedToWorkArea is true, it will exclude any areas like the taskbar on Windows, If clippedToWorkArea is true, it will exclude any areas like the taskbar on Windows,
or the menu bar on Mac. If clippedToWorkArea is false, the entire monitor area is returned. or the menu bar on Mac. If clippedToWorkArea is false, the entire monitor area is returned.
*/ */
const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const;
const RectangleList getAllMonitorDisplayAreas (const bool clippedToWorkArea = true) const throw();
/** Returns the position and size of the main monitor. /** Returns the position and size of the main monitor.
If clippedToWorkArea is true, it will exclude any areas like the taskbar on Windows, If clippedToWorkArea is true, it will exclude any areas like the taskbar on Windows,
or the menu bar on Mac. If clippedToWorkArea is false, the entire monitor area is returned. or the menu bar on Mac. If clippedToWorkArea is false, the entire monitor area is returned.
*/ */
const Rectangle getMainMonitorArea (const bool clippedToWorkArea = true) const;
const Rectangle getMainMonitorArea (const bool clippedToWorkArea = true) const throw();
/** Returns the position and size of the monitor which contains this co-ordinate. /** Returns the position and size of the monitor which contains this co-ordinate.
@@ -97,7 +97,7 @@ public:
If clippedToWorkArea is true, it will exclude any areas like the taskbar on Windows, If clippedToWorkArea is true, it will exclude any areas like the taskbar on Windows,
or the menu bar on Mac. If clippedToWorkArea is false, the entire monitor area is returned. or the menu bar on Mac. If clippedToWorkArea is false, the entire monitor area is returned.
*/ */
const Rectangle getMonitorAreaContaining (int x, int y, const bool clippedToWorkArea = true) const;
const Rectangle getMonitorAreaContaining (int x, int y, const bool clippedToWorkArea = true) const throw();
//============================================================================== //==============================================================================
@@ -105,24 +105,24 @@ public:
The co-ordinates are relative to the top-left of the main monitor. The co-ordinates are relative to the top-left of the main monitor.
*/ */
static void getMousePosition (int& x, int& y);
static void getMousePosition (int& x, int& y) throw();
/** Makes the mouse pointer jump to a given location. /** Makes the mouse pointer jump to a given location.
The co-ordinates are relative to the top-left of the main monitor. The co-ordinates are relative to the top-left of the main monitor.
*/ */
static void setMousePosition (int x, int y);
static void setMousePosition (int x, int y) throw();
/** Returns the last position at which a mouse button was pressed. /** Returns the last position at which a mouse button was pressed.
*/ */
static void getLastMouseDownPosition (int& x, int& y);
static void getLastMouseDownPosition (int& x, int& y) throw();
/** Returns the number of times the mouse button has been clicked since the /** Returns the number of times the mouse button has been clicked since the
app started. app started.
Each mouse-down event increments this number by 1. Each mouse-down event increments this number by 1.
*/ */
static int getMouseButtonClickCounter();
static int getMouseButtonClickCounter() throw();
//============================================================================== //==============================================================================
/** Registers a MouseListener that will receive all mouse events that occur on /** Registers a MouseListener that will receive all mouse events that occur on
@@ -154,7 +154,7 @@ public:
@see getComponent, Component::addToDesktop @see getComponent, Component::addToDesktop
*/ */
int getNumComponents() const;
int getNumComponents() const throw();
/** Returns one of the top-level desktop window components. /** Returns one of the top-level desktop window components.
@@ -163,7 +163,7 @@ public:
@see getNumComponents, Component::addToDesktop @see getNumComponents, Component::addToDesktop
*/ */
Component* getComponent (const int index) const;
Component* getComponent (const int index) const throw();
/** Finds the component at a given screen location. /** Finds the component at a given screen location.
@@ -183,10 +183,10 @@ public:
(Called internally by the native code). (Called internally by the native code).
*/ */
void refreshMonitorSizes();
void refreshMonitorSizes() throw();
/** True if the OS supports semitransparent windows */ /** True if the OS supports semitransparent windows */
static bool canUseSemiTransparentWindows();
static bool canUseSemiTransparentWindows() throw();
private: private:
@@ -198,23 +198,24 @@ private:
friend class DeletedAtShutdown; friend class DeletedAtShutdown;
friend class TopLevelWindowManager; friend class TopLevelWindowManager;
Desktop();
~Desktop();
Desktop() throw();
~Desktop() throw();
Array <Rectangle> monitorCoordsClipped, monitorCoordsUnclipped; Array <Rectangle> monitorCoordsClipped, monitorCoordsUnclipped;
int lastMouseX, lastMouseY; int lastMouseX, lastMouseY;
void timerCallback(); void timerCallback();
void sendMouseMove(); void sendMouseMove();
void resetTimer();
int getNumDisplayMonitors() const;
const Rectangle getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const;
void resetTimer() throw();
void addDesktopComponent (Component* const c);
void removeDesktopComponent (Component* const c);
void componentBroughtToFront (Component* const c);
int getNumDisplayMonitors() const throw();
const Rectangle getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw();
void triggerFocusCallback();
void addDesktopComponent (Component* const c) throw();
void removeDesktopComponent (Component* const c) throw();
void componentBroughtToFront (Component* const c) throw();
void triggerFocusCallback() throw();
void handleAsyncUpdate(); void handleAsyncUpdate();
Desktop (const Desktop&); Desktop (const Desktop&);


Loading…
Cancel
Save