mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
use cmd+v for paste on OSX
This commit is contained in:
parent
7f0d895a91
commit
b90d3400dd
@ -51,6 +51,13 @@ extern const char* Key_Names[KEY_COUNT];
|
||||
#define Key_IsControlPressed() (Key_Pressed[KEY_LCTRL] || Key_Pressed[KEY_RCTRL])
|
||||
#define Key_IsShiftPressed() (Key_Pressed[KEY_LSHIFT] || Key_Pressed[KEY_RSHIFT])
|
||||
|
||||
#ifdef CC_BUILD_OSX
|
||||
/* osx uses CMD instead of CTRL for clipboard and stuff */
|
||||
#define Key_IsActionPressed() Key_IsWinPressed()
|
||||
#else
|
||||
#define Key_IsActionPressed() Key_IsControlPressed()
|
||||
#endif
|
||||
|
||||
/* Pressed state of each keyboard button. Use Key_SetPressed to change. */
|
||||
extern bool Key_Pressed[KEY_COUNT];
|
||||
/* Sets the pressed state of a keyboard button. */
|
||||
|
@ -398,9 +398,9 @@ static void LInput_KeyDown(void* widget, Key key, bool was) {
|
||||
LWidget_Redraw(w);
|
||||
} else if (key == KEY_DELETE && LInput_Delete(w)) {
|
||||
LWidget_Redraw(w);
|
||||
} else if (key == 'C' && Key_IsControlPressed()) {
|
||||
} else if (key == 'C' && Key_IsActionPressed()) {
|
||||
if (w->Text.length) Window_SetClipboardText(&w->Text);
|
||||
} else if (key == 'V' && Key_IsControlPressed()) {
|
||||
} else if (key == 'V' && Key_IsActionPressed()) {
|
||||
if (LInput_CopyFromClipboard(w)) LWidget_Redraw(w);
|
||||
} else if (key == KEY_ESCAPE) {
|
||||
if (LInput_Clear(w)) LWidget_Redraw(w);
|
||||
|
@ -870,14 +870,6 @@ void TableWidget_OnInventoryChanged(struct TableWidget* w) {
|
||||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------InputWidget-------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static bool InputWidget_ControlDown(void) {
|
||||
#ifdef CC_BUILD_OSX
|
||||
return Key_IsWinPressed();
|
||||
#else
|
||||
return Key_IsControlPressed();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void InputWidget_FormatLine(struct InputWidget* w, int i, String* line) {
|
||||
String src = w->Lines[i];
|
||||
if (!w->ConvertPercents) { String_AppendString(line, &src); return; }
|
||||
@ -1068,7 +1060,7 @@ static bool InputWidget_CheckCol(struct InputWidget* w, int index) {
|
||||
static void InputWidget_BackspaceKey(struct InputWidget* w) {
|
||||
int i, len;
|
||||
|
||||
if (InputWidget_ControlDown()) {
|
||||
if (Key_IsActionPressed()) {
|
||||
if (w->CaretPos == -1) { w->CaretPos = w->Text.length - 1; }
|
||||
len = WordWrap_GetBackLength(&w->Text, w->CaretPos);
|
||||
if (!len) return;
|
||||
@ -1110,7 +1102,7 @@ static void InputWidget_DeleteKey(struct InputWidget* w) {
|
||||
}
|
||||
|
||||
static void InputWidget_LeftKey(struct InputWidget* w) {
|
||||
if (InputWidget_ControlDown()) {
|
||||
if (Key_IsActionPressed()) {
|
||||
if (w->CaretPos == -1) { w->CaretPos = w->Text.length - 1; }
|
||||
w->CaretPos -= WordWrap_GetBackLength(&w->Text, w->CaretPos);
|
||||
InputWidget_UpdateCaret(w);
|
||||
@ -1126,7 +1118,7 @@ static void InputWidget_LeftKey(struct InputWidget* w) {
|
||||
}
|
||||
|
||||
static void InputWidget_RightKey(struct InputWidget* w) {
|
||||
if (InputWidget_ControlDown()) {
|
||||
if (Key_IsActionPressed()) {
|
||||
w->CaretPos += WordWrap_GetForwardLength(&w->Text, w->CaretPos);
|
||||
if (w->CaretPos >= w->Text.length) { w->CaretPos = -1; }
|
||||
InputWidget_UpdateCaret(w);
|
||||
@ -1156,7 +1148,7 @@ static bool InputWidget_OtherKey(struct InputWidget* w, Key key) {
|
||||
int maxChars;
|
||||
|
||||
maxChars = w->GetMaxLines() * INPUTWIDGET_LEN;
|
||||
if (!InputWidget_ControlDown()) return false;
|
||||
if (!Key_IsActionPressed()) return false;
|
||||
|
||||
if (key == 'V' && w->Text.length < maxChars) {
|
||||
String_InitArray(text, textBuffer);
|
||||
@ -1663,7 +1655,7 @@ static void ChatInputWidget_UpKey(struct InputWidget* w) {
|
||||
String prevInput;
|
||||
int pos;
|
||||
|
||||
if (InputWidget_ControlDown()) {
|
||||
if (Key_IsActionPressed()) {
|
||||
pos = w->CaretPos == -1 ? w->Text.length : w->CaretPos;
|
||||
if (pos < INPUTWIDGET_LEN) return;
|
||||
|
||||
@ -1693,7 +1685,7 @@ static void ChatInputWidget_DownKey(struct InputWidget* w) {
|
||||
String prevInput;
|
||||
int lines;
|
||||
|
||||
if (InputWidget_ControlDown()) {
|
||||
if (Key_IsActionPressed()) {
|
||||
lines = w->GetMaxLines();
|
||||
if (w->CaretPos == -1) return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user