mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-29 00:23:48 +00:00
Add support to right-click with Ctrl+left click on OS X (fix #438)
This is only for Tabs and Entry widgets at the moment.
This commit is contained in:
parent
262bc0f16e
commit
f5c43267fc
@ -62,6 +62,8 @@ Tabs::Tabs(TabsDelegate* delegate)
|
||||
, m_dropNewTab(nullptr)
|
||||
, m_dropNewIndex(-1)
|
||||
{
|
||||
enableFlags(CTRL_RIGHT_CLICK);
|
||||
|
||||
setDoubleBuffered(true);
|
||||
initTheme();
|
||||
|
||||
@ -1003,7 +1005,11 @@ void Tabs::updateDragCopyCursor(ui::Message* msg)
|
||||
TabPtr tab = (m_isDragging ? m_dragTab: m_hot);
|
||||
|
||||
bool oldDragCopy = m_dragCopy;
|
||||
m_dragCopy = ((msg->ctrlPressed() || msg->altPressed()) &&
|
||||
m_dragCopy = ((
|
||||
#if !defined __APPLE__
|
||||
msg->ctrlPressed() ||
|
||||
#endif
|
||||
msg->altPressed()) &&
|
||||
(tab && m_delegate && m_delegate->canCloneTab(this, tab->view)));
|
||||
|
||||
if (oldDragCopy != m_dragCopy) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -47,6 +47,7 @@ namespace ui {
|
||||
INITIALIZED = 0x00000400, // The widget was already initialized by a theme.
|
||||
DIRTY = 0x00000800, // The widget (or one child) is dirty (update_region != empty).
|
||||
HAS_TEXT = 0x00001000, // The widget has text (at least setText() was called one time).
|
||||
CTRL_RIGHT_CLICK = 0x00002000, // The widget should transform Ctrl+click to right-click on OS X.
|
||||
PROPERTIES_MASK = 0x0000ffff,
|
||||
|
||||
HORIZONTAL = 0x00010000,
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
Entry::Entry(std::size_t maxsize, const char *format, ...)
|
||||
Entry::Entry(std::size_t maxsize, const char* format, ...)
|
||||
: Widget(kEntryWidget)
|
||||
, m_timer(500, this)
|
||||
, m_maxsize(maxsize)
|
||||
@ -42,9 +42,10 @@ Entry::Entry(std::size_t maxsize, const char *format, ...)
|
||||
, m_recent_focused(false)
|
||||
, m_lock_selection(false)
|
||||
{
|
||||
char buf[4096];
|
||||
enableFlags(CTRL_RIGHT_CLICK);
|
||||
|
||||
// formatted string
|
||||
char buf[4096];
|
||||
if (format) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
|
@ -1458,11 +1458,24 @@ Message* Manager::newMouseMessage(
|
||||
const gfx::Point& wheelDelta,
|
||||
bool preciseWheel)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
// Convert Ctrl+left click -> right-click
|
||||
if (widget &&
|
||||
widget->isVisible() &&
|
||||
widget->isEnabled() &&
|
||||
widget->hasFlags(CTRL_RIGHT_CLICK) &&
|
||||
(modifiers & kKeyCtrlModifier) &&
|
||||
(buttons == kButtonLeft)) {
|
||||
modifiers = KeyModifiers(int(modifiers) & ~int(kKeyCtrlModifier));
|
||||
buttons = kButtonRight;
|
||||
}
|
||||
#endif
|
||||
|
||||
Message* msg = new MouseMessage(
|
||||
type, pointerType, buttons, modifiers, mousePos,
|
||||
wheelDelta, preciseWheel);
|
||||
|
||||
if (widget != NULL)
|
||||
if (widget)
|
||||
msg->addRecipient(widget);
|
||||
|
||||
return msg;
|
||||
|
Loading…
Reference in New Issue
Block a user