1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-07 04:10:08 +00:00

Fixes for disappearing win32 drag images, and TextEditor custom cursors.

This commit is contained in:
Julian Storer 2011-03-21 09:54:17 +00:00
parent e1e5018a91
commit ca8ce6d354
7 changed files with 55 additions and 21 deletions

View file

@ -53159,6 +53159,15 @@ void TextEditor::colourChanged()
repaint();
}
void TextEditor::lookAndFeelChanged()
{
if (isCaretVisible())
{
setCaretVisible (false);
setCaretVisible (true);
}
}
void TextEditor::setCaretVisible (const bool shouldCaretBeVisible)
{
if (shouldCaretBeVisible && ! isReadOnly())
@ -53439,7 +53448,7 @@ void TextEditor::updateTextHolderSize()
const int h = topIndent + roundToInt (jmax (i.lineY + i.lineHeight,
currentFont.getHeight()));
textHolder->setSize (w + 2, h + 1);
textHolder->setSize (w + 2, h + 1); // (the +2 allows a bit of space for the cursor to be at the right-hand-edge)
}
}
@ -71132,6 +71141,14 @@ void DragAndDropContainer::startDragging (const String& sourceDescription,
static_cast <DragImageComponent*> (static_cast <Component*> (dragImageComponent))->updateLocation (false, lastMouseDown);
dragImageComponent->setVisible (true);
#if JUCE_WIN32
// Under heavy load, the layered window's paint callback can often be lost by the OS,
// so forcing a repaint at least once makes sure that the window becomes visible..
ComponentPeer* const peer = dragImageComponent->getPeer();
if (peer != 0)
peer->performAnyPendingRepaintsNow();
#endif
}
}
@ -246560,8 +246577,9 @@ public:
void performAnyPendingRepaintsNow()
{
MSG m;
if (component->isVisible() && PeekMessage (&m, hwnd, WM_PAINT, WM_PAINT, PM_REMOVE))
DispatchMessage (&m);
if (component->isVisible()
&& (PeekMessage (&m, hwnd, WM_PAINT, WM_PAINT, PM_REMOVE) || isUsingUpdateLayeredWindow()))
handlePaintMessage();
}
static Win32ComponentPeer* getOwnerOfWindow (HWND h) throw()

View file

@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 56
#define JUCE_BUILDNUMBER 57
/** Current Juce version number.
@ -42206,20 +42206,18 @@ public:
/** Deletes all the text from the editor. */
void clear();
/** Deletes the currently selected region, and puts it on the clipboard.
/** Deletes the currently selected region.
This doesn't copy the deleted section to the clipboard - if you need to do that, call copy() first.
@see copy, paste, SystemClipboard
*/
void cut();
/** Copies any currently selected region to the clipboard.
/** Copies the currently selected region to the clipboard.
@see cut, paste, SystemClipboard
*/
void copy();
/** Pastes the contents of the clipboard into the editor at the cursor position.
@see cut, copy, SystemClipboard
*/
void paste();
@ -42349,6 +42347,8 @@ public:
/** @internal */
void colourChanged();
/** @internal */
void lookAndFeelChanged();
/** @internal */
bool isTextInputActive() const;
/** This adds the items to the popup menu.
@ -42402,8 +42402,7 @@ protected:
/** Used internally to dispatch a text-change message. */
void textChanged();
/** Begins a new transaction in the UndoManager.
*/
/** Begins a new transaction in the UndoManager. */
void newTransaction();
/** Used internally to trigger an undo or redo. */

View file

@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 56
#define JUCE_BUILDNUMBER 57
/** Current Juce version number.

View file

@ -1138,6 +1138,15 @@ void TextEditor::colourChanged()
repaint();
}
void TextEditor::lookAndFeelChanged()
{
if (isCaretVisible())
{
setCaretVisible (false);
setCaretVisible (true);
}
}
void TextEditor::setCaretVisible (const bool shouldCaretBeVisible)
{
if (shouldCaretBeVisible && ! isReadOnly())

View file

@ -385,20 +385,18 @@ public:
/** Deletes all the text from the editor. */
void clear();
/** Deletes the currently selected region, and puts it on the clipboard.
/** Deletes the currently selected region.
This doesn't copy the deleted section to the clipboard - if you need to do that, call copy() first.
@see copy, paste, SystemClipboard
*/
void cut();
/** Copies any currently selected region to the clipboard.
/** Copies the currently selected region to the clipboard.
@see cut, paste, SystemClipboard
*/
void copy();
/** Pastes the contents of the clipboard into the editor at the cursor position.
@see cut, copy, SystemClipboard
*/
void paste();
@ -530,6 +528,8 @@ public:
/** @internal */
void colourChanged();
/** @internal */
void lookAndFeelChanged();
/** @internal */
bool isTextInputActive() const;
//==============================================================================
@ -585,8 +585,7 @@ protected:
/** Used internally to dispatch a text-change message. */
void textChanged();
/** Begins a new transaction in the UndoManager.
*/
/** Begins a new transaction in the UndoManager. */
void newTransaction();
/** Used internally to trigger an undo or redo. */

View file

@ -396,6 +396,14 @@ void DragAndDropContainer::startDragging (const String& sourceDescription,
static_cast <DragImageComponent*> (static_cast <Component*> (dragImageComponent))->updateLocation (false, lastMouseDown);
dragImageComponent->setVisible (true);
#if JUCE_WIN32
// Under heavy load, the layered window's paint callback can often be lost by the OS,
// so forcing a repaint at least once makes sure that the window becomes visible..
ComponentPeer* const peer = dragImageComponent->getPeer();
if (peer != 0)
peer->performAnyPendingRepaintsNow();
#endif
}
}

View file

@ -814,8 +814,9 @@ public:
void performAnyPendingRepaintsNow()
{
MSG m;
if (component->isVisible() && PeekMessage (&m, hwnd, WM_PAINT, WM_PAINT, PM_REMOVE))
DispatchMessage (&m);
if (component->isVisible()
&& (PeekMessage (&m, hwnd, WM_PAINT, WM_PAINT, PM_REMOVE) || isUsingUpdateLayeredWindow()))
handlePaintMessage();
}
//==============================================================================