Browse Source

Converted some internal ComponentPeer methods to use Point and Rectangle rather than raw ints.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
d8e16ccc06
14 changed files with 459 additions and 592 deletions
  1. +7
    -8
      extras/the jucer/src/ui/jucer_EditingPanelBase.cpp
  2. +210
    -282
      juce_amalgamated.cpp
  3. +11
    -9
      juce_amalgamated.h
  4. +5
    -0
      src/gui/components/juce_Component.cpp
  5. +11
    -0
      src/gui/components/juce_Component.h
  6. +9
    -11
      src/gui/components/special/juce_MagnifierComponent.cpp
  7. +38
    -46
      src/gui/components/windows/juce_ComponentPeer.cpp
  8. +9
    -9
      src/gui/components/windows/juce_ComponentPeer.h
  9. +91
    -98
      src/native/linux/juce_linux_Windowing.cpp
  10. +26
    -51
      src/native/mac/juce_iphone_UIViewComponentPeer.mm
  11. +20
    -45
      src/native/mac/juce_mac_NSViewComponentPeer.mm
  12. +6
    -6
      src/native/windows/juce_win32_ActiveXComponent.cpp
  13. +2
    -3
      src/native/windows/juce_win32_OpenGLComponent.cpp
  14. +14
    -24
      src/native/windows/juce_win32_Windowing.cpp

+ 7
- 8
extras/the jucer/src/ui/jucer_EditingPanelBase.cpp View File

@@ -208,25 +208,24 @@ void EditingPanelBase::setZoom (double newScale)
void EditingPanelBase::setZoom (double newScale, int anchorX, int anchorY)
{
const int oldAnchorX = anchorX;
const int oldAnchorY = anchorY;
viewport->relativePositionToOtherComponent (editor, anchorX, anchorY);
Point<int> anchor (viewport->relativePositionToOtherComponent (editor, Point<int> (anchorX, anchorY)));
magnifier->setScaleFactor (newScale);
resized();
editor->relativePositionToOtherComponent (viewport, anchorX, anchorY);
anchor = editor->relativePositionToOtherComponent (viewport, anchor);
viewport->setViewPosition (jlimit (0, jmax (0, viewport->getViewedComponent()->getWidth() - viewport->getViewWidth()),
viewport->getViewPositionX() + anchorX - oldAnchorX),
viewport->getViewPositionX() + anchor.getX() - anchorX),
jlimit (0, jmax (0, viewport->getViewedComponent()->getHeight() - viewport->getViewHeight()),
viewport->getViewPositionY() + anchorY - oldAnchorY));
viewport->getViewPositionY() + anchor.getY() - anchorY));
}
void EditingPanelBase::xyToTargetXY (int& x, int& y) const
{
relativePositionToOtherComponent (editor, x, y);
Point<int> pos (relativePositionToOtherComponent (editor, Point<int> (x, y)));
x = pos.getX();
y = pos.getY();
}
void EditingPanelBase::dragKeyHeldDown (bool isKeyDown)


+ 210
- 282
juce_amalgamated.cpp
File diff suppressed because it is too large
View File


+ 11
- 9
juce_amalgamated.h View File

@@ -12270,7 +12270,7 @@ public:

virtual void setBounds (int x, int y, int w, int h, const bool isNowFullScreen) = 0;

virtual void getBounds (int& x, int& y, int& w, int& h) const = 0;
virtual const Rectangle<int> getBounds() const = 0;

virtual const Point<int> getScreenPosition() const = 0;

@@ -12336,21 +12336,21 @@ public:

virtual void performAnyPendingRepaintsNow() = 0;

void handleMouseEnter (int x, int y, const int64 time);
void handleMouseMove (int x, int y, const int64 time);
void handleMouseDown (int x, int y, const int64 time);
void handleMouseDrag (int x, int y, const int64 time);
void handleMouseUp (const int oldModifiers, int x, int y, const int64 time);
void handleMouseExit (int x, int y, const int64 time);
void handleMouseEnter (const Point<int>& position, const int64 time);
void handleMouseMove (const Point<int>& position, const int64 time);
void handleMouseDown (const Point<int>& position, const int64 time);
void handleMouseDrag (const Point<int>& position, const int64 time);
void handleMouseUp (const int oldModifiers, const Point<int>& position, const int64 time);
void handleMouseExit (const Point<int>& position, const int64 time);
void handleMouseWheel (const int amountX, const int amountY, const int64 time);

void sendFakeMouseMove() throw();

void handleUserClosingWindow();

void handleFileDragMove (const StringArray& files, int x, int y);
void handleFileDragMove (const StringArray& files, const Point<int>& position);
void handleFileDragExit (const StringArray& files);
void handleFileDragDrop (const StringArray& files, int x, int y);
void handleFileDragDrop (const StringArray& files, const Point<int>& position);

void clearMaskedRegion() throw();

@@ -12585,6 +12585,8 @@ public:

Component* getComponentAt (const int x, const int y);

Component* getComponentAt (const Point<int>& position);

void repaint() throw();

void repaint (const int x, const int y,


+ 5
- 0
src/gui/components/juce_Component.cpp View File

@@ -1106,6 +1106,11 @@ bool Component::reallyContains (int x, int y, const bool returnTrueIfWithinAChil
return (c == this) || (returnTrueIfWithinAChild && isParentOf (c));
}
Component* Component::getComponentAt (const Point<int>& position)
{
return getComponentAt (position.getX(), position.getY());
}
Component* Component::getComponentAt (const int x, const int y)
{
if (flags.visibleFlag


+ 11
- 0
src/gui/components/juce_Component.h View File

@@ -770,6 +770,17 @@ public:
*/
Component* getComponentAt (const int x, const int y);
/** Returns the component at a certain point within this one.
@param position the co-ordinates to test, relative to this component's top-left.
@returns the component that is at this position - which may be 0, this component,
or one of its children. Note that overlapping siblings that might actually
be in the way are not taken into account by this method - to account for these,
instead call getComponentAt on the top-level parent of this component.
@see hitTest, contains, reallyContains
*/
Component* getComponentAt (const Point<int>& position);
//==============================================================================
/** Marks the whole component as needing to be redrawn.


+ 9
- 11
src/gui/components/special/juce_MagnifierComponent.cpp View File

@@ -83,12 +83,10 @@ public:
peer->textInputRequired (position);
}
void getBounds (int& x, int& y, int& w, int& h) const
const Rectangle<int> getBounds() const
{
x = magnifierComp->getScreenX();
y = magnifierComp->getScreenY();
w = component->getWidth();
h = component->getHeight();
return Rectangle<int> (magnifierComp->getScreenX(), magnifierComp->getScreenY(),
component->getWidth(), component->getHeight());
}
const Point<int> getScreenPosition() const
@@ -290,37 +288,37 @@ void MagnifierComponent::childBoundsChanged (Component* c)
void MagnifierComponent::mouseDown (const MouseEvent& e)
{
if (peer != 0)
peer->handleMouseDown (scaleInt (e.x), scaleInt (e.y), e.eventTime.toMilliseconds());
peer->handleMouseDown (Point<int> (scaleInt (e.x), scaleInt (e.y)), e.eventTime.toMilliseconds());
}
void MagnifierComponent::mouseUp (const MouseEvent& e)
{
if (peer != 0)
peer->handleMouseUp (e.mods.getRawFlags(), scaleInt (e.x), scaleInt (e.y), e.eventTime.toMilliseconds());
peer->handleMouseUp (e.mods.getRawFlags(), Point<int> (scaleInt (e.x), scaleInt (e.y)), e.eventTime.toMilliseconds());
}
void MagnifierComponent::mouseDrag (const MouseEvent& e)
{
if (peer != 0)
peer->handleMouseDrag (scaleInt (e.x), scaleInt (e.y), e.eventTime.toMilliseconds());
peer->handleMouseDrag (Point<int> (scaleInt (e.x), scaleInt (e.y)), e.eventTime.toMilliseconds());
}
void MagnifierComponent::mouseMove (const MouseEvent& e)
{
if (peer != 0)
peer->handleMouseMove (scaleInt (e.x), scaleInt (e.y), e.eventTime.toMilliseconds());
peer->handleMouseMove (Point<int> (scaleInt (e.x), scaleInt (e.y)), e.eventTime.toMilliseconds());
}
void MagnifierComponent::mouseEnter (const MouseEvent& e)
{
if (peer != 0)
peer->handleMouseEnter (scaleInt (e.x), scaleInt (e.y), e.eventTime.toMilliseconds());
peer->handleMouseEnter (Point<int> (scaleInt (e.x), scaleInt (e.y)), e.eventTime.toMilliseconds());
}
void MagnifierComponent::mouseExit (const MouseEvent& e)
{
if (peer != 0)
peer->handleMouseExit (scaleInt (e.x), scaleInt (e.y), e.eventTime.toMilliseconds());
peer->handleMouseExit (Point<int> (scaleInt (e.x), scaleInt (e.y)), e.eventTime.toMilliseconds());
}
void MagnifierComponent::mouseWheelMove (const MouseEvent& e, float ix, float iy)


+ 38
- 46
src/gui/components/windows/juce_ComponentPeer.cpp View File

@@ -102,38 +102,38 @@ void ComponentPeer::updateCurrentModifiers() throw()
}
//==============================================================================
void ComponentPeer::handleMouseEnter (int x, int y, const int64 time)
void ComponentPeer::handleMouseEnter (const Point<int>& position, const int64 time)
{
jassert (component->isValidComponent());
updateCurrentModifiers();
Component* c = component->getComponentAt (x, y);
Component* c = component->getComponentAt (position);
const ComponentDeletionWatcher deletionChecker (component);
if (c != Component::componentUnderMouse && Component::componentUnderMouse != 0)
{
jassert (Component::componentUnderMouse->isValidComponent());
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseExit (relPos.getX(), relPos.getY(), time);
Component::componentUnderMouse = 0;
if (deletionChecker.hasBeenDeleted())
return;
c = component->getComponentAt (x, y);
c = component->getComponentAt (position);
}
Component::componentUnderMouse = c;
if (Component::componentUnderMouse != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseEnter (relPos.getX(), relPos.getY(), time);
}
}
void ComponentPeer::handleMouseMove (int x, int y, const int64 time)
void ComponentPeer::handleMouseMove (const Point<int>& position, const int64 time)
{
jassert (component->isValidComponent());
updateCurrentModifiers();
@@ -141,27 +141,27 @@ void ComponentPeer::handleMouseMove (int x, int y, const int64 time)
fakeMouseMessageSent = false;
const ComponentDeletionWatcher deletionChecker (component);
Component* c = component->getComponentAt (x, y);
Component* c = component->getComponentAt (position);
if (c != Component::componentUnderMouse)
{
if (Component::componentUnderMouse != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseExit (relPos.getX(), relPos.getY(), time);
Component::componentUnderMouse = 0;
if (deletionChecker.hasBeenDeleted())
return; // if this window has just been deleted..
c = component->getComponentAt (x, y);
c = component->getComponentAt (position);
}
Component::componentUnderMouse = c;
if (c != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (c, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (c, position));
c->internalMouseEnter (relPos.getX(), relPos.getY(), time);
if (deletionChecker.hasBeenDeleted())
@@ -171,53 +171,53 @@ void ComponentPeer::handleMouseMove (int x, int y, const int64 time)
if (Component::componentUnderMouse != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseMove (relPos.getX(), relPos.getY(), time);
}
}
void ComponentPeer::handleMouseDown (int x, int y, const int64 time)
void ComponentPeer::handleMouseDown (const Point<int>& position, const int64 time)
{
Desktop::getInstance().incrementMouseClickCounter();
updateCurrentModifiers();
if (ModifierKeys::getCurrentModifiers().getNumMouseButtonsDown() == 1)
{
Component::componentUnderMouse = component->getComponentAt (x, y);
Component::componentUnderMouse = component->getComponentAt (position);
if (Component::componentUnderMouse != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseDown (relPos.getX(), relPos.getY(), time);
}
}
}
void ComponentPeer::handleMouseDrag (int x, int y, const int64 time)
void ComponentPeer::handleMouseDrag (const Point<int>& position, const int64 time)
{
updateCurrentModifiers();
if (Component::componentUnderMouse != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseDrag (relPos.getX(), relPos.getY(), time);
}
}
void ComponentPeer::handleMouseUp (const int oldModifiers, int x, int y, const int64 time)
void ComponentPeer::handleMouseUp (const int oldModifiers, const Point<int>& position, const int64 time)
{
updateCurrentModifiers();
if (ModifierKeys (oldModifiers).getNumMouseButtonsDown() == 1)
{
const ComponentDeletionWatcher deletionChecker (component);
Component* c = component->getComponentAt (x, y);
Component* c = component->getComponentAt (position);
if (c != Component::componentUnderMouse)
{
if (Component::componentUnderMouse != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseUp (oldModifiers, relPos.getX(), relPos.getY(), time);
if (Component::componentUnderMouse != 0)
@@ -226,14 +226,14 @@ void ComponentPeer::handleMouseUp (const int oldModifiers, int x, int y, const i
if (deletionChecker.hasBeenDeleted())
return;
c = component->getComponentAt (x, y);
c = component->getComponentAt (position);
}
Component::componentUnderMouse = c;
if (Component::componentUnderMouse != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseEnter (relPos.getX(), relPos.getY(), time);
}
}
@@ -241,21 +241,21 @@ void ComponentPeer::handleMouseUp (const int oldModifiers, int x, int y, const i
{
if (Component::componentUnderMouse != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseUp (oldModifiers, relPos.getX(), relPos.getY(), time);
}
}
}
}
void ComponentPeer::handleMouseExit (int x, int y, const int64 time)
void ComponentPeer::handleMouseExit (const Point<int>& position, const int64 time)
{
jassert (component->isValidComponent());
updateCurrentModifiers();
if (Component::componentUnderMouse != 0)
{
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, Point<int> (x, y)));
const Point<int> relPos (component->relativePositionToOtherComponent (Component::componentUnderMouse, position));
Component::componentUnderMouse->internalMouseExit (relPos.getX(), relPos.getY(), time);
Component::componentUnderMouse = 0;
}
@@ -276,12 +276,7 @@ void ComponentPeer::sendFakeMouseMove() throw()
&& ! ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown())
{
if (! isMinimised())
{
int realX, realY, realW, realH;
getBounds (realX, realY, realW, realH);
component->bounds_.setBounds (realX, realY, realW, realH);
}
component->bounds_ = getBounds();
const Point<int> pos (component->getMouseXYRelative());
@@ -301,8 +296,7 @@ void ComponentPeer::handleMessage (const Message& message)
if (message.intParameter1 == fakeMouseMoveMessage)
{
if (! ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown())
handleMouseMove (message.intParameter2,
message.intParameter3,
handleMouseMove (Point<int> (message.intParameter2, message.intParameter3),
Time::currentTimeMillis());
}
}
@@ -483,15 +477,13 @@ void ComponentPeer::handleMovedOrResized()
{
const ComponentDeletionWatcher deletionChecker (component);
int realX, realY, realW, realH;
getBounds (realX, realY, realW, realH);
const bool wasMoved = (component->getX() != realX || component->getY() != realY);
const bool wasResized = (component->getWidth() != realW || component->getHeight() != realH);
const Rectangle<int> newBounds (getBounds());
const bool wasMoved = (component->getPosition() != newBounds.getPosition());
const bool wasResized = (component->getWidth() != newBounds.getWidth() || component->getHeight() != newBounds.getHeight());
if (wasMoved || wasResized)
{
component->bounds_.setBounds (realX, realY, realW, realH);
component->bounds_ = newBounds;
if (wasResized)
component->repaint();
@@ -593,7 +585,7 @@ static FileDragAndDropTarget* findDragAndDropTarget (Component* c,
return 0;
}
void ComponentPeer::handleFileDragMove (const StringArray& files, int x, int y)
void ComponentPeer::handleFileDragMove (const StringArray& files, const Point<int>& position)
{
updateCurrentModifiers();
@@ -604,7 +596,7 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, int x, int y)
FileDragAndDropTarget* newTarget = 0;
Component* const compUnderMouse = component->getComponentAt (x, y);
Component* const compUnderMouse = component->getComponentAt (position);
if (compUnderMouse != lastDragAndDropCompUnderMouse)
{
@@ -621,7 +613,7 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, int x, int y)
if (newTarget != 0)
{
Component* const targetComp = dynamic_cast <Component*> (newTarget);
const Point<int> pos (component->relativePositionToOtherComponent (targetComp, Point<int> (x, y)));
const Point<int> pos (component->relativePositionToOtherComponent (targetComp, position));
dragAndDropTargetComponent = new ComponentDeletionWatcher (dynamic_cast <Component*> (newTarget));
newTarget->fileDragEnter (files, pos.getX(), pos.getY());
@@ -636,7 +628,7 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, int x, int y)
if (newTarget != 0)
{
Component* const targetComp = dynamic_cast <Component*> (newTarget);
const Point<int> pos (component->relativePositionToOtherComponent (targetComp, Point<int> (x, y)));
const Point<int> pos (component->relativePositionToOtherComponent (targetComp, position));
newTarget->fileDragMove (files, pos.getX(), pos.getY());
}
@@ -644,15 +636,15 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, int x, int y)
void ComponentPeer::handleFileDragExit (const StringArray& files)
{
handleFileDragMove (files, -1, -1);
handleFileDragMove (files, Point<int> (-1, -1));
jassert (dragAndDropTargetComponent == 0);
lastDragAndDropCompUnderMouse = 0;
}
void ComponentPeer::handleFileDragDrop (const StringArray& files, int x, int y)
void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<int>& position)
{
handleFileDragMove (files, x, y);
handleFileDragMove (files, position);
if (dragAndDropTargetComponent != 0 && ! dragAndDropTargetComponent->hasBeenDeleted())
{
@@ -673,7 +665,7 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, int x, int y)
return;
}
const Point<int> pos (component->relativePositionToOtherComponent (targetComp, Point<int> (x, y)));
const Point<int> pos (component->relativePositionToOtherComponent (targetComp, position));
target->filesDropped (files, pos.getX(), pos.getY());
}
}


+ 9
- 9
src/gui/components/windows/juce_ComponentPeer.h View File

@@ -147,7 +147,7 @@ public:
If the native window is contained in another window, then the co-ordinates are
relative to the parent window's origin, not the screen origin.
*/
virtual void getBounds (int& x, int& y, int& w, int& h) const = 0;
virtual const Rectangle<int> getBounds() const = 0;
/** Returns the x-position of this window, relative to the screen's origin. */
virtual const Point<int> getScreenPosition() const = 0;
@@ -290,12 +290,12 @@ public:
virtual void performAnyPendingRepaintsNow() = 0;
//==============================================================================
void handleMouseEnter (int x, int y, const int64 time);
void handleMouseMove (int x, int y, const int64 time);
void handleMouseDown (int x, int y, const int64 time);
void handleMouseDrag (int x, int y, const int64 time);
void handleMouseUp (const int oldModifiers, int x, int y, const int64 time);
void handleMouseExit (int x, int y, const int64 time);
void handleMouseEnter (const Point<int>& position, const int64 time);
void handleMouseMove (const Point<int>& position, const int64 time);
void handleMouseDown (const Point<int>& position, const int64 time);
void handleMouseDrag (const Point<int>& position, const int64 time);
void handleMouseUp (const int oldModifiers, const Point<int>& position, const int64 time);
void handleMouseExit (const Point<int>& position, const int64 time);
void handleMouseWheel (const int amountX, const int amountY, const int64 time);
/** Causes a mouse-move callback to be made asynchronously. */
@@ -303,9 +303,9 @@ public:
void handleUserClosingWindow();
void handleFileDragMove (const StringArray& files, int x, int y);
void handleFileDragMove (const StringArray& files, const Point<int>& position);
void handleFileDragExit (const StringArray& files);
void handleFileDragDrop (const StringArray& files, int x, int y);
void handleFileDragDrop (const StringArray& files, const Point<int>& position);
//==============================================================================
/** Resets the masking region.


+ 91
- 98
src/native/linux/juce_linux_Windowing.cpp View File

@@ -110,9 +110,6 @@ static const int eventMask = NoEventMask | KeyPressMask | KeyReleaseMask | Butto
| ExposureMask | StructureNotifyMask | FocusChangeMask;
//==============================================================================
static int pointerMap[5];
static Point<int> lastMousePos;
enum MouseButtons
{
NoButton = 0,
@@ -123,10 +120,10 @@ enum MouseButtons
WheelDown = 5
};
static void getMousePos (int& x, int& y, int& mouseMods) throw()
static const Point<int> getMousePos (int& mouseMods) throw()
{
Window root, child;
int winx, winy;
int x, y, winx, winy;
unsigned int mask;
mouseMods = 0;
@@ -142,15 +139,12 @@ static void getMousePos (int& x, int& y, int& mouseMods) throw()
}
else
{
if ((mask & Button1Mask) != 0)
mouseMods |= ModifierKeys::leftButtonModifier;
if ((mask & Button2Mask) != 0)
mouseMods |= ModifierKeys::middleButtonModifier;
if ((mask & Button3Mask) != 0)
mouseMods |= ModifierKeys::rightButtonModifier;
if ((mask & Button1Mask) != 0) mouseMods |= ModifierKeys::leftButtonModifier;
if ((mask & Button2Mask) != 0) mouseMods |= ModifierKeys::middleButtonModifier;
if ((mask & Button3Mask) != 0) mouseMods |= ModifierKeys::rightButtonModifier;
}
return Point<int> (x, y);
}
//==============================================================================
@@ -243,8 +237,8 @@ void ModifierKeys::updateCurrentModifiers() throw()
const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() throw()
{
int x, y, mouseMods;
getMousePos (x, y, mouseMods);
int mouseMods;
getMousePos (mouseMods);
currentModifiers &= ~ModifierKeys::allMouseButtonModifiers;
currentModifiers |= mouseMods;
@@ -386,61 +380,6 @@ static bool isShmAvailable() throw()
}
#endif
//==============================================================================
static Pixmap juce_createColourPixmapFromImage (Display* display, const Image& image)
{
ScopedXLock xlock;
const int width = image.getWidth();
const int height = image.getHeight();
HeapBlock <uint32> colour (width * height);
int index = 0;
for (int y = 0; y < height; ++y)
for (int x = 0; x < width; ++x)
colour[index++] = image.getPixelAt (x, y).getARGB();
XImage* ximage = XCreateImage (display, CopyFromParent, 24, ZPixmap,
0, (char*) colour, width, height, 32, 0);
Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display),
width, height, 24);
GC gc = XCreateGC (display, pixmap, 0, 0);
XPutImage (display, pixmap, gc, ximage, 0, 0, 0, 0, width, height);
XFreeGC (display, gc);
return pixmap;
}
static Pixmap juce_createMaskPixmapFromImage (Display* display, const Image& image)
{
ScopedXLock xlock;
const int width = image.getWidth();
const int height = image.getHeight();
const int stride = (width + 7) >> 3;
HeapBlock <uint8> mask;
mask.calloc (stride * height);
const bool msbfirst = (BitmapBitOrder (display) == MSBFirst);
for (int y = 0; y < height; ++y)
{
for (int x = 0; x < width; ++x)
{
const uint8 bit = (uint8) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7)));
const int offset = y * stride + (x >> 3);
if (image.getPixelAt (x, y).getAlpha() >= 128)
mask[offset] |= bit;
}
}
return XCreatePixmapFromBitmapData (display, DefaultRootWindow (display),
(char*) mask, width, height, 1, 0, 1);
}
//==============================================================================
class XBitmapImage : public Image
{
@@ -781,18 +720,8 @@ public:
}
}
void getBounds (int& x, int& y, int& w, int& h) const
{
x = wx;
y = wy;
w = ww;
h = wh;
}
const Point<int> getScreenPosition() const
{
return Point<int> (wx, wy);
}
const Rectangle<int> getBounds() const { return Rectangle<int> (wx, wy, ww, wh); }
const Point<int> getScreenPosition() const { return Point<int> (wx, wy); }
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition)
{
@@ -1104,6 +1033,59 @@ public:
repainter->performAnyPendingRepaintsNow();
}
static Pixmap juce_createColourPixmapFromImage (Display* display, const Image& image)
{
ScopedXLock xlock;
const int width = image.getWidth();
const int height = image.getHeight();
HeapBlock <uint32> colour (width * height);
int index = 0;
for (int y = 0; y < height; ++y)
for (int x = 0; x < width; ++x)
colour[index++] = image.getPixelAt (x, y).getARGB();
XImage* ximage = XCreateImage (display, CopyFromParent, 24, ZPixmap,
0, (char*) colour, width, height, 32, 0);
Pixmap pixmap = XCreatePixmap (display, DefaultRootWindow (display),
width, height, 24);
GC gc = XCreateGC (display, pixmap, 0, 0);
XPutImage (display, pixmap, gc, ximage, 0, 0, 0, 0, width, height);
XFreeGC (display, gc);
return pixmap;
}
static Pixmap juce_createMaskPixmapFromImage (Display* display, const Image& image)
{
ScopedXLock xlock;
const int width = image.getWidth();
const int height = image.getHeight();
const int stride = (width + 7) >> 3;
HeapBlock <uint8> mask;
mask.calloc (stride * height);
const bool msbfirst = (BitmapBitOrder (display) == MSBFirst);
for (int y = 0; y < height; ++y)
{
for (int x = 0; x < width; ++x)
{
const uint8 bit = (uint8) (1 << (msbfirst ? (7 - (x & 7)) : (x & 7)));
const int offset = y * stride + (x >> 3);
if (image.getPixelAt (x, y).getAlpha() >= 128)
mask[offset] |= bit;
}
}
return XCreatePixmapFromBitmapData (display, DefaultRootWindow (display),
(char*) mask, width, height, 1, 0, 1);
}
void setIcon (const Image& newIcon)
{
const int dataSize = newIcon.getWidth() * newIcon.getHeight() + 2;
@@ -1336,7 +1318,7 @@ public:
if (buttonMsg)
{
toFront (true);
handleMouseDown (buttonPressEvent->x, buttonPressEvent->y,
handleMouseDown (Point<int> (buttonPressEvent->x, buttonPressEvent->y),
getEventTime (buttonPressEvent->time));
}
else if (wheelUpMsg || wheelDownMsg)
@@ -1345,7 +1327,7 @@ public:
getEventTime (buttonPressEvent->time));
}
lastMousePos = Point<int> (0x100000, 0x100000);
clearLastMousePos();
break;
}
@@ -1366,10 +1348,10 @@ public:
updateKeyModifiers (buttonRelEvent->state);
handleMouseUp (oldModifiers,
buttonRelEvent->x, buttonRelEvent->y,
Point<int> (buttonRelEvent->x, buttonRelEvent->y),
getEventTime (buttonRelEvent->time));
lastMousePos = Point<int> (0x100000, 0x100000);
clearLastMousePos();
break;
}
@@ -1416,9 +1398,9 @@ public:
}
if ((currentModifiers & ModifierKeys::allMouseButtonModifiers) == 0)
handleMouseMove (mousePos.getX(), mousePos.getY(), getEventTime (movedEvent->time));
handleMouseMove (mousePos, getEventTime (movedEvent->time));
else
handleMouseDrag (mousePos.getX(), mousePos.getY(), getEventTime (movedEvent->time));
handleMouseDrag (mousePos, getEventTime (movedEvent->time));
}
break;
@@ -1426,7 +1408,7 @@ public:
case EnterNotify:
{
lastMousePos = Point<int> (0x100000, 0x100000);
clearLastMousePos();
const XEnterWindowEvent* const enterEvent = (const XEnterWindowEvent*) &event->xcrossing;
if ((currentModifiers & ModifierKeys::allMouseButtonModifiers) == 0
@@ -1434,7 +1416,7 @@ public:
{
updateKeyModifiers (enterEvent->state);
handleMouseEnter (enterEvent->x, enterEvent->y, getEventTime (enterEvent->time));
handleMouseEnter (Point<int> (enterEvent->x, enterEvent->y), getEventTime (enterEvent->time));
entered = true;
}
@@ -1455,7 +1437,7 @@ public:
{
updateKeyModifiers (leaveEvent->state);
handleMouseExit (leaveEvent->x, leaveEvent->y, getEventTime (leaveEvent->time));
handleMouseExit (Point<int> (leaveEvent->x, leaveEvent->y), getEventTime (leaveEvent->time));
entered = false;
}
@@ -2415,7 +2397,7 @@ private:
updateDraggedFileList (clientMsg);
if (dragAndDropFiles.size() > 0)
handleFileDragMove (dragAndDropFiles, dropPos.getX(), dropPos.getY());
handleFileDragMove (dragAndDropFiles, dropPos);
}
}
@@ -2431,7 +2413,7 @@ private:
resetDragAndDrop();
if (files.size() > 0)
handleFileDragDrop (files, lastPos.getX(), lastPos.getY());
handleFileDragDrop (files, lastPos);
}
void handleDragAndDropEnter (const XClientMessageEvent* const clientMsg)
@@ -2571,11 +2553,23 @@ private:
Atom XA_OtherMime, dragAndDropCurrentMimeType;
Window dragAndDropSourceWindow;
unsigned int allowedActions [5];
unsigned int allowedMimeTypeAtoms [3];
unsigned int allowedActions[5];
unsigned int allowedMimeTypeAtoms[3];
Array <Atom> srcMimeTypeAtomList;
static int pointerMap[5];
static Point<int> lastMousePos;
static void clearLastMousePos() throw()
{
lastMousePos = Point<int> (0x100000, 0x100000);
}
};
int LinuxComponentPeer::pointerMap[5];
Point<int> LinuxComponentPeer::lastMousePos;
//==============================================================================
void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars)
{
@@ -2727,9 +2721,8 @@ bool Desktop::canUseSemiTransparentWindows() throw()
const Point<int> Desktop::getMousePosition()
{
int x, y, mouseMods;
getMousePos (x, y, mouseMods);
return Point<int> (x, y);
int mouseMods;
return getMousePos (mouseMods);
}
void Desktop::setMousePosition (const Point<int>& newPosition)


+ 26
- 51
src/native/mac/juce_iphone_UIViewComponentPeer.mm View File

@@ -91,8 +91,9 @@ public:
void setPosition (int x, int y);
void setSize (int w, int h);
void setBounds (int x, int y, int w, int h, const bool isNowFullScreen);
void getBounds (int& x, int& y, int& w, int& h, const bool global) const;
void getBounds (int& x, int& y, int& w, int& h) const;
const Rectangle<int> getBounds() const;
const Rectangle<int> getBounds (const bool global) const;
const Point<int> getScreenPosition() const;
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition);
const Point<int> globalPositionToRelative (const Point<int>& screenPosition);
@@ -191,7 +192,7 @@ static int64 getMouseTime (UIEvent* e)
+ (int64) ([e timestamp] * 1000.0);
}
int juce_lastMouseX = 0, juce_lastMouseY = 0;
JUCE_NAMESPACE::Point<int> juce_lastMousePos;
//==============================================================================
- (void) touchesBegan: (NSSet*) touches withEvent: (UIEvent*) event
@@ -206,17 +207,14 @@ int juce_lastMouseX = 0, juce_lastMouseY = 0;
case 1: // One finger..
{
CGPoint p = [[t objectAtIndex: 0] locationInView: self];
const JUCE_NAMESPACE::Point<int> pos ((int) p.x, (int) p.y);
currentModifiers |= getModifierForButtonNumber (0);
juce_lastMousePos = pos + owner->getScreenPosition();
int x, y, w, h;
owner->getBounds (x, y, w, h, true);
juce_lastMouseX = x + (int) p.x;
juce_lastMouseY = y + (int) p.y;
owner->handleMouseMove ((int) p.x, (int) p.y, getMouseTime (event));
owner->handleMouseMove (pos, getMouseTime (event));
if (owner != 0)
owner->handleMouseDown ((int) p.x, (int) p.y, getMouseTime (event));
owner->handleMouseDown (pos, getMouseTime (event));
}
default:
@@ -237,13 +235,10 @@ int juce_lastMouseX = 0, juce_lastMouseY = 0;
case 1: // One finger..
{
CGPoint p = [[t objectAtIndex: 0] locationInView: self];
const JUCE_NAMESPACE::Point<int> pos ((int) p.x, (int) p.y);
juce_lastMousePos = pos + owner->getScreenPosition();
int x, y, w, h;
owner->getBounds (x, y, w, h, true);
juce_lastMouseX = x + (int) p.x;
juce_lastMouseY = y + (int) p.y;
owner->handleMouseDrag ((int) p.x, (int) p.y, getMouseTime (event));
owner->handleMouseDrag (pos, getMouseTime (event));
}
default:
@@ -264,15 +259,12 @@ int juce_lastMouseX = 0, juce_lastMouseY = 0;
case 1: // One finger..
{
CGPoint p = [[t objectAtIndex: 0] locationInView: self];
int x, y, w, h;
owner->getBounds (x, y, w, h, true);
juce_lastMouseX = x + (int) p.x;
juce_lastMouseY = y + (int) p.y;
const JUCE_NAMESPACE::Point<int> pos ((int) p.x, (int) p.y);
juce_lastMousePos = pos + owner->getScreenPosition();
const int oldMods = currentModifiers;
currentModifiers &= ~getModifierForButtonNumber (0);
owner->handleMouseUp (oldMods, (int) p.x, (int) p.y, getMouseTime (event));
owner->handleMouseUp (oldMods, pos, getMouseTime (event));
}
default:
@@ -465,7 +457,7 @@ void UIViewComponentPeer::setBounds (int x, int y, int w, int h, const bool isNo
}
}
void UIViewComponentPeer::getBounds (int& x, int& y, int& w, int& h, const bool global) const
const Rectangle<int> UIViewComponentPeer::getBounds (const bool global) const
{
CGRect r = [view frame];
@@ -477,45 +469,28 @@ void UIViewComponentPeer::getBounds (int& x, int& y, int& w, int& h, const bool
r.origin.y += wr.origin.y;
}
x = (int) r.origin.x;
y = (int) r.origin.y;
w = (int) r.size.width;
h = (int) r.size.height;
}
void UIViewComponentPeer::getBounds (int& x, int& y, int& w, int& h) const
{
getBounds (x, y, w, h, ! isSharedWindow);
return Rectangle<int> ((int) r.origin.x, (int) r.origin.y,
(int) r.size.width, (int) r.size.height);
}
int UIViewComponentPeer::getScreenX() const
const Rectangle<int> UIViewComponentPeer::getBounds() const
{
int x, y, w, h;
getBounds (x, y, w, h, true);
return x;
return getBounds (! isSharedWindow);
}
int UIViewComponentPeer::getScreenY() const
const Point<int> UIViewComponentPeer::getScreenPosition() const
{
int x, y, w, h;
getBounds (x, y, w, h, true);
return y;
return getBounds (true).getPosition();
}
void UIViewComponentPeer::relativePositionToGlobal (int& x, int& y)
const Point<int> UIViewComponentPeer::relativePositionToGlobal (const Point<int>& relativePosition)
{
int wx, wy, ww, wh;
getBounds (wx, wy, ww, wh, true);
x += wx;
y += wy;
return relativePosition + getScreenPosition();
}
void UIViewComponentPeer::globalPositionToRelative (int& x, int& y)
const Point<int> UIViewComponentPeer::globalPositionToRelative (const Point<int>& screenPosition)
{
int wx, wy, ww, wh;
getBounds (wx, wy, ww, wh, true);
x -= wx;
y -= wy;
return screenPosition + getScreenPosition();
}
CGRect UIViewComponentPeer::constrainRect (CGRect r)
@@ -818,7 +793,7 @@ bool Desktop::canUseSemiTransparentWindows() throw()
const Point<int> Desktop::getMousePosition()
{
return Point<int> (juce_lastMouseX, juce_lastMouseY);
return juce_lastMousePos;
}
void Desktop::setMousePosition (const Point<int>&)


+ 20
- 45
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -133,8 +133,8 @@ public:
void setPosition (int x, int y);
void setSize (int w, int h);
void setBounds (int x, int y, int w, int h, const bool isNowFullScreen);
void getBounds (int& x, int& y, int& w, int& h, const bool global) const;
void getBounds (int& x, int& y, int& w, int& h) const;
const Rectangle<int> getBounds (const bool global) const;
const Rectangle<int> getBounds() const;
const Point<int> getScreenPosition() const;
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition);
const Point<int> globalPositionToRelative (const Point<int>& screenPosition);
@@ -642,11 +642,10 @@ static int64 getMouseTime (NSEvent* e)
+ (int64) ([e timestamp] * 1000.0);
}
static void getMousePos (NSEvent* e, NSView* view, int& x, int& y)
static const Point<int> getMousePos (NSEvent* e, NSView* view)
{
NSPoint p = [view convertPoint: [e locationInWindow] fromView: nil];
x = roundToInt (p.x);
y = roundToInt ([view frame].size.height - p.y);
return Point<int> (roundToInt (p.x), roundToInt ([view frame].size.height - p.y));
}
static int getModifierForButtonNumber (const NSInteger num)
@@ -829,7 +828,7 @@ void NSViewComponentPeer::setBounds (int x, int y, int w, int h, const bool isNo
}
}
void NSViewComponentPeer::getBounds (int& x, int& y, int& w, int& h, const bool global) const
const Rectangle<int> NSViewComponentPeer::getBounds (const bool global) const
{
NSRect r = [view frame];
@@ -839,29 +838,24 @@ void NSViewComponentPeer::getBounds (int& x, int& y, int& w, int& h, const bool
NSRect wr = [[view window] frame];
r.origin.x += wr.origin.x;
r.origin.y += wr.origin.y;
y = (int) ([[[NSScreen screens] objectAtIndex:0] frame].size.height - r.origin.y - r.size.height);
r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - r.origin.y - r.size.height;
}
else
{
y = (int) ([[view superview] frame].size.height - r.origin.y - r.size.height);
r.origin.y = [[view superview] frame].size.height - r.origin.y - r.size.height;
}
x = (int) r.origin.x;
w = (int) r.size.width;
h = (int) r.size.height;
return Rectangle<int> ((int) r.origin.x, (int) r.size.width, (int) r.size.width, (int) r.size.height);
}
void NSViewComponentPeer::getBounds (int& x, int& y, int& w, int& h) const
const Rectangle<int> NSViewComponentPeer::getBounds() const
{
getBounds (x, y, w, h, ! isSharedWindow);
return getBounds (! isSharedWindow);
}
const Point<int> NSViewComponentPeer::getScreenPosition() const
{
int x, y, w, h;
getBounds (x, y, w, h, true);
return Point<int> (x, y);
return getBounds (true).getPosition();
}
const Point<int> NSViewComponentPeer::relativePositionToGlobal (const Point<int>& relativePosition)
@@ -1207,10 +1201,7 @@ void NSViewComponentPeer::redirectMouseDown (NSEvent* ev)
{
updateModifiers (ev);
currentModifiers |= getModifierForButtonNumber ([ev buttonNumber]);
int x, y;
getMousePos (ev, view, x, y);
handleMouseDown (x, y, getMouseTime (ev));
handleMouseDown (getMousePos (ev, view), getMouseTime (ev));
}
void NSViewComponentPeer::redirectMouseUp (NSEvent* ev)
@@ -1218,10 +1209,7 @@ void NSViewComponentPeer::redirectMouseUp (NSEvent* ev)
const int oldMods = currentModifiers;
updateModifiers (ev);
currentModifiers &= ~getModifierForButtonNumber ([ev buttonNumber]);
int x, y;
getMousePos (ev, view, x, y);
handleMouseUp (oldMods, x, y, getMouseTime (ev));
handleMouseUp (oldMods, getMousePos (ev, view), getMouseTime (ev));
showArrowCursorIfNeeded();
}
@@ -1229,38 +1217,26 @@ void NSViewComponentPeer::redirectMouseDrag (NSEvent* ev)
{
updateModifiers (ev);
currentModifiers |= getModifierForButtonNumber ([ev buttonNumber]);
int x, y;
getMousePos (ev, view, x, y);
handleMouseDrag (x, y, getMouseTime (ev));
handleMouseDrag (getMousePos (ev, view), getMouseTime (ev));
}
void NSViewComponentPeer::redirectMouseMove (NSEvent* ev)
{
updateModifiers (ev);
int x, y;
getMousePos (ev, view, x, y);
handleMouseMove (x, y, getMouseTime (ev));
handleMouseMove (getMousePos (ev, view), getMouseTime (ev));
showArrowCursorIfNeeded();
}
void NSViewComponentPeer::redirectMouseEnter (NSEvent* ev)
{
updateModifiers (ev);
int x, y;
getMousePos (ev, view, x, y);
handleMouseEnter (x, y, getMouseTime (ev));
handleMouseEnter (getMousePos (ev, view), getMouseTime (ev));
}
void NSViewComponentPeer::redirectMouseExit (NSEvent* ev)
{
updateModifiers (ev);
int x, y;
getMousePos (ev, view, x, y);
handleMouseExit (x, y, getMouseTime (ev));
handleMouseExit (getMousePos (ev, view), getMouseTime (ev));
}
void NSViewComponentPeer::redirectMouseWheel (NSEvent* ev)
@@ -1291,8 +1267,7 @@ BOOL NSViewComponentPeer::sendDragCallback (int type, id <NSDraggingInfo> sender
return false;
NSPoint p = [view convertPoint: [sender draggingLocation] fromView: nil];
int x = (int) p.x;
int y = (int) ([view frame].size.height - p.y);
const Point<int> pos ((int) p.x, (int) ([view frame].size.height - p.y));
StringArray files;
@@ -1312,11 +1287,11 @@ BOOL NSViewComponentPeer::sendDragCallback (int type, id <NSDraggingInfo> sender
return false;
if (type == 0)
handleFileDragMove (files, x, y);
handleFileDragMove (files, pos);
else if (type == 1)
handleFileDragExit (files);
else if (type == 2)
handleFileDragDrop (files, x, y);
handleFileDragDrop (files, pos);
return true;
}


+ 6
- 6
src/native/windows/juce_win32_ActiveXComponent.cpp View File

@@ -342,8 +342,8 @@ static void offerActiveXMouseEventToPeer (ComponentPeer* const peer, HWND hwnd,
GetWindowRect (hwnd, &activeXRect);
GetWindowRect ((HWND) peer->getNativeHandle(), &peerRect);
const int mx = GET_X_LPARAM (lParam) + activeXRect.left - peerRect.left;
const int my = GET_Y_LPARAM (lParam) + activeXRect.top - peerRect.top;
const Point<int> mousePos (GET_X_LPARAM (lParam) + activeXRect.left - peerRect.left,
GET_Y_LPARAM (lParam) + activeXRect.top - peerRect.top);
const int64 mouseEventTime = getMouseEventTime();
const int oldModifiers = currentModifiers;
@@ -353,21 +353,21 @@ static void offerActiveXMouseEventToPeer (ComponentPeer* const peer, HWND hwnd,
{
case WM_MOUSEMOVE:
if (ModifierKeys (currentModifiers).isAnyMouseButtonDown())
peer->handleMouseDrag (mx, my, mouseEventTime);
peer->handleMouseDrag (mousePos, mouseEventTime);
else
peer->handleMouseMove (mx, my, mouseEventTime);
peer->handleMouseMove (mousePos, mouseEventTime);
break;
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
peer->handleMouseDown (mx, my, mouseEventTime);
peer->handleMouseDown (mousePos, mouseEventTime);
break;
case WM_LBUTTONUP:
case WM_MBUTTONUP:
case WM_RBUTTONUP:
peer->handleMouseUp (oldModifiers, mx, my, mouseEventTime);
peer->handleMouseUp (oldModifiers, mousePos, mouseEventTime);
break;
default:


+ 2
- 3
src/native/windows/juce_win32_OpenGLComponent.cpp View File

@@ -288,9 +288,8 @@ public:
void repaint()
{
int x, y, w, h;
nativeWindow->getBounds (x, y, w, h);
nativeWindow->repaint (0, 0, w, h);
const Rectangle<int> bounds (nativeWindow->getBounds());
nativeWindow->repaint (0, 0, bounds.getWidth(), bounds.getHeight());
}
void swapBuffers()


+ 14
- 24
src/native/windows/juce_win32_Windowing.cpp View File

@@ -566,28 +566,21 @@ public:
repaintNowIfTransparent();
}
void getBounds (int& x, int& y, int& w, int& h) const
const Rectangle<int> getBounds() const
{
RECT r;
GetWindowRect (hwnd, &r);
x = r.left;
y = r.top;
w = r.right - x;
h = r.bottom - y;
Rectangle<int> bounds (r.left, r.top, r.right - r.left, r.bottom - r.top);
HWND parentH = GetParent (hwnd);
if (parentH != 0)
{
GetWindowRect (parentH, &r);
x -= r.left;
y -= r.top;
bounds.translate (-r.left, -r.top);
}
x += windowBorder.getLeft();
y += windowBorder.getTop();
w -= windowBorder.getLeftAndRight();
h -= windowBorder.getTopAndBottom();
return windowBorder.subtractedFrom (bounds);
}
const Point<int> getScreenPosition() const
@@ -1290,7 +1283,7 @@ private:
}
updateKeyModifiers();
handleMouseEnter (x, y, mouseEventTime);
handleMouseEnter (Point<int> (x, y), mouseEventTime);
}
else if (! isDragging)
{
@@ -1311,7 +1304,7 @@ private:
if (now > lastMouseTime + 1000 / maxMouseMovesPerSecond)
{
lastMouseTime = now;
handleMouseMove (x, y, mouseEventTime);
handleMouseMove (Point<int> (x, y), mouseEventTime);
}
}
}
@@ -1323,7 +1316,7 @@ private:
if (now > lastMouseTime + 1000 / maxMouseMovesPerSecond)
{
lastMouseTime = now;
handleMouseDrag (x, y, mouseEventTime);
handleMouseDrag (Point<int> (x, y), mouseEventTime);
}
}
}
@@ -1349,7 +1342,7 @@ private:
updateKeyModifiers();
isDragging = true;
handleMouseDown (x, y, getMouseEventTime());
handleMouseDown (Point<int> (x, y), getMouseEventTime());
}
void doMouseUp (const int x, const int y, const WPARAM wParam)
@@ -1387,7 +1380,7 @@ private:
if (numButtons == 0 && hwnd == GetCapture())
ReleaseCapture();
handleMouseUp (oldModifiers, x, y, getMouseEventTime());
handleMouseUp (oldModifiers, Point<int> (x, y), getMouseEventTime());
}
void doCaptureChanged()
@@ -1415,8 +1408,8 @@ private:
const DWORD mp = GetMessagePos();
handleMouseExit (GET_X_LPARAM (mp) - wr.left - windowBorder.getLeft(),
GET_Y_LPARAM (mp) - wr.top - windowBorder.getTop(),
handleMouseExit (Point<int> (GET_X_LPARAM (mp) - wr.left - windowBorder.getLeft(),
GET_Y_LPARAM (mp) - wr.top - windowBorder.getTop()),
getMouseEventTime());
}
}
@@ -1677,8 +1670,7 @@ private:
HRESULT __stdcall DragEnter (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{
updateFileList (pDataObject);
const Point<int> pos (owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
owner->handleFileDragMove (files, pos.getX(), pos.getY());
owner->handleFileDragMove (files, owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY;
return S_OK;
}
@@ -1691,8 +1683,7 @@ private:
HRESULT __stdcall DragOver (DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{
const Point<int> pos (owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
owner->handleFileDragMove (files, pos.getX(), pos.getY());
owner->handleFileDragMove (files, owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY;
return S_OK;
}
@@ -1700,8 +1691,7 @@ private:
HRESULT __stdcall Drop (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{
updateFileList (pDataObject);
const Point<int> pos (owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
owner->handleFileDragDrop (files, pos.getX(), pos.getY());
owner->handleFileDragDrop (files, owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY;
return S_OK;
}


Loading…
Cancel
Save