mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Add special case to preserve the current X selection when editing of a
NSTextField is started with a mouse click. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31160 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c9cb35beba
commit
d94f50de97
2 changed files with 23 additions and 0 deletions
|
@ -1,5 +1,9 @@
|
|||
2010-08-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSTextField.m (-selectText:): Add special case to
|
||||
preserve the current X selection when editing is started with a
|
||||
mouse click.
|
||||
|
||||
* Source/NSSpellChecker.m (-awakeFromNib): Make the spell panel a
|
||||
utility window like the font and color panels.
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "AppKit/NSApplication.h"
|
||||
#include "AppKit/NSCursor.h"
|
||||
#include "AppKit/NSEvent.h"
|
||||
#include "AppKit/NSGraphics.h"
|
||||
#include "AppKit/NSTextField.h"
|
||||
#include "AppKit/NSTextFieldCell.h"
|
||||
|
@ -179,6 +180,24 @@ static Class textFieldCellClass;
|
|||
so we need to call it before setting up the _text_object */
|
||||
length = [[self stringValue] length];
|
||||
_text_object = [_cell setUpFieldEditorAttributes: text];
|
||||
if (sender == self)
|
||||
{
|
||||
/* Special case: If -selectText: is called in response to making
|
||||
the receiver first responder with a mouse click, don't select
|
||||
the whole text. First of all, this is redundant since the field
|
||||
editor will receive the mouse click and immediately collapse the
|
||||
selection by placing the insertion point at the mouse location.
|
||||
Furthermore, we thus preserve the current selection on X and
|
||||
therefore the user can easily paste it into the text field with
|
||||
a middle mouse click. */
|
||||
NSEvent *event = [_window currentEvent];
|
||||
if ([event type] == NSLeftMouseDown &&
|
||||
NSPointInRect([event locationInWindow],
|
||||
[self convertRect:[self bounds] toView:nil]))
|
||||
{
|
||||
length = 0;
|
||||
}
|
||||
}
|
||||
[_cell selectWithFrame: _bounds
|
||||
inView: self
|
||||
editor: _text_object
|
||||
|
|
Loading…
Reference in a new issue