From ea1c6567cf251bd530c06b91d85359703c938b03 Mon Sep 17 00:00:00 2001 From: Ada Date: Mon, 7 Apr 2025 22:47:35 +1000 Subject: [PATCH] Initial prototype for VR keyboard shortcuts --- interface/resources/config/keyboard.json | 75 ++++++++++++++++++ .../resources/meshes/keyboard/key_copy.png | Bin 0 -> 2395 bytes .../resources/meshes/keyboard/key_paste.png | Bin 0 -> 2360 bytes .../meshes/keyboard/key_select_all.png | Bin 0 -> 2422 bytes interface/src/ui/Keyboard.cpp | 60 ++++++++++++++ interface/src/ui/Keyboard.h | 5 +- 6 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 interface/resources/meshes/keyboard/key_copy.png create mode 100644 interface/resources/meshes/keyboard/key_paste.png create mode 100644 interface/resources/meshes/keyboard/key_select_all.png diff --git a/interface/resources/config/keyboard.json b/interface/resources/config/keyboard.json index e16c6156ab..5ae05d4044 100644 --- a/interface/resources/config/keyboard.json +++ b/interface/resources/config/keyboard.json @@ -811,6 +811,81 @@ "z": 0.707 } }, + { + "key": "Copy", + "type": "copy", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.65333323516845703, + "y": 0.019300000742077827, + "z": -0.07 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_copy.png", + "file10": "meshes/keyboard/key_copy.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Paste", + "type": "paste", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.65333323516845703, + "y": 0.019300000742077827, + "z": -0.12 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_paste.png", + "file10": "meshes/keyboard/key_paste.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, + { + "key": "Select All", + "type": "select_all", + "dimensions": { + "x": 0.04787999764084816, + "z": 0.020519999787211418, + "y": 0.04787999764084816 + }, + "position": { + "x": -0.65333323516845703, + "y": 0.019300000742077827, + "z": -0.02 + }, + "modelURL": "meshes/keyboard/SM_key.fbx", + "texture": { + "file9": "meshes/keyboard/key_select_all.png", + "file10": "meshes/keyboard/key_select_all.png" + }, + "localOrientation": { + "w": 0.000, + "x": 0.000, + "y": 0.707, + "z": 0.707 + } + }, { "key": "numbers", "type": "layer", diff --git a/interface/resources/meshes/keyboard/key_copy.png b/interface/resources/meshes/keyboard/key_copy.png new file mode 100644 index 0000000000000000000000000000000000000000..253adc5a378ee8184cd9384cdf47224da7a60945 GIT binary patch literal 2395 zcmeHIeM}p57=G@0mO@*11ky3O(Q{!=XNXmSAfml8ay(D4);{{z#0KUe==koz+fO`@6q#_9Ll_$k% z(+hfjzx=fB5*t{0t~xtnD9e)F9iOpoY3D?B^|PTHKKwx!^XEZF``!X=7~R^NS6hBj zwX0_AZfqO2|S&>y+GSowS>UOmbcU zi%RC9(o499dCwM}*rG1VOZdDyyz@5Ty=tP44=Oc%#U`ZJX_l{lKpusSp5Yz_}TPY4$t7O4dfkx`7iq%3nSn#aXcEv;x z=q5oTe#Lp=Q>THLJ5}OCZ%g|l!GKABlgiARnh<4tw<86Y@(9_np}qMxY?BB5Xz-lb zboK%*VxVu-K58-MG>&Afr7Zy{f^uHOh|4^IyiL^sLyK1PNj8io` zlbA6IDhg_P*mP@B{wXP&#$=$uGVOl1YwR_4g~t73)6xTIJRT!u3>%HZ4xh+-y8)}Z z>#$r9ib5#xRo2ZE1DO5iBq%z3;wEwl7C00K2^gak67ULsm?RKtAkxY{f6A8xO{o0U z$&#pPGhhjtVZdE>MZDWC>av%$I$mUXtNEz2Xf&a$Wl9L`R_&^(KaEo7XGi3xSLvK2 z2yEjlYwJ&Ju-OxUl~p{mX{@h#U^fuQ23ae^`|iTGOJc1mCAc~R=Z;IZ!>l40aC>O= zxE9d*>+NQM%;tF?0EjaU`TNxUZf2z;4D-LBEo6Bf%kfgey@Y$@`oE<3|ISbs jXJqr7X>PU`CMcur!F^ZW=}k68*a0BvNnKoRtiI$go#v)H literal 0 HcmV?d00001 diff --git a/interface/resources/meshes/keyboard/key_paste.png b/interface/resources/meshes/keyboard/key_paste.png new file mode 100644 index 0000000000000000000000000000000000000000..e3f7e1d52c3157275f26c5a0160cd04e16094015 GIT binary patch literal 2360 zcmds2Yfw~W7=F�~{{v9+VLXbPrMtr6Ez_MqCa>Tt=dep^=Pfx9DPo?G}d2fN~N+ zv%*_5D3oC}k?zvp{josuATyT=WHJSj0Q6`(;L))~NL-qjfZuKL91a{%{c*>_KL{5A*`IkoqLk2@L8vIKd^edMw314FhJeqp{>WR96-a0jQqirtwfd$&9}qCzA+kHCV8 zIiy@9+@ZW9g(J40MlBLPuZMR(2GZXT5qF{AQ;O);D7RX>46{`(%+4*UBQ4&0sq0I& z2Y^Lzw5b@}{;jCIGNzgBrfm(D600|$3<4x=gP#DgcWn?T>~@H<@9JgUR9_|p2^M2LI5Df@o(PT-)d;9=bkPdifJ=ji%&l3oE)*(^qsHzRh8{ax%0n95ba2JwVP6Xisoj-@ zc6haL?X#$!muVW8a$W@kpX!?rc3HN`Jt2KgUCz?SMO@kN_@{mrn>OM|cTlU5!PreO%+ zAyTViYfR(D7#5qt(njU&M`VBeI4V2G(1?(KP*-yCxb=jp#{8uF!35NUcH zFv-bwnlj&Rwkxbndl3wUrnK8$znK&?YRocvo_}!X542kAz|!c{x5d9QT?8EPh}T(* z=9|oitp=<8sA!2?U-q4_zGqt>Q|7exdxq=Q&V7p`N(TE%%dGa6HJ&ZbH!5smi^By| z3K~5DLxmiHaS*1OeY=@)Clx<(m}B(y!-SHT{}@>l9x90$zNnDV<@y;HZ@>`4LK4CW{-%m( zO#=lN|v2sK~H5fP}E5VgNHKUGo5J)sgRLfOQ*$Mc`baGhpi-6&AWT zrDv?S_YIc=baw2QWi2xUPG|fJ55~#(+^I z`$lQJsR|8n04RU~KmbyJH5Gr-)*9iKB35O$z%86si#?quy|!zuD8k~3%|8fORm>vg z8sQe@Eh#K9p&eFmTXoCY$NN_%tFo{5# zK|oxTCX%A5greZAPwn44U#z%5&T$6slv#S~Ffd0U-!o5QDxHO~%F!x_3NSL_*dgTJkwBBC)TmO+Dia zDL&UX*18UfJs6+fxd*3M7t74*#Jjy4%96r?Ky-HQI9}5)kSdtJ>8nXZu z&jEBe1I{(ecf@EYl|33`0-sI)62ks%<8fH|rssTEYEs*)4F(?N*Cf<>{6bR>4getPrimaryWidget(), pressEvent); + QCoreApplication::postEvent(qApp->getPrimaryWidget(), releaseEvent); + } else { + QCoreApplication::postEvent(QCoreApplication::instance(), pressEvent); + QCoreApplication::postEvent(QCoreApplication::instance(), releaseEvent); + } + + _typedCharacters.clear(); + updateTextDisplay(); + return; + } + // TODO, macOS: If macOS support comes back, these should be revisited + case Key::Type::PASTE: { + QKeyEvent* pressEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_V, Qt::ControlModifier); + QKeyEvent* releaseEvent = new QKeyEvent(QEvent::KeyRelease, Qt::Key_V, Qt::ControlModifier); + + if (_inputToHudUI) { + QCoreApplication::postEvent(qApp->getPrimaryWidget(), pressEvent); + QCoreApplication::postEvent(qApp->getPrimaryWidget(), releaseEvent); + } else { + QCoreApplication::postEvent(QCoreApplication::instance(), pressEvent); + QCoreApplication::postEvent(QCoreApplication::instance(), releaseEvent); + } + + _typedCharacters.clear(); + updateTextDisplay(); + return; + } + // TODO, macOS: If macOS support comes back, these should be revisited + case Key::Type::SELECT_ALL: { + QKeyEvent* pressEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::ControlModifier); + QKeyEvent* releaseEvent = new QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::ControlModifier); + + if (_inputToHudUI) { + QCoreApplication::postEvent(qApp->getPrimaryWidget(), pressEvent); + QCoreApplication::postEvent(qApp->getPrimaryWidget(), releaseEvent); + } else { + QCoreApplication::postEvent(QCoreApplication::instance(), pressEvent); + QCoreApplication::postEvent(QCoreApplication::instance(), releaseEvent); + } + + _typedCharacters.clear(); + updateTextDisplay(); + return; + } case Key::Type::CHARACTER: if (keyString != " ") { _typedCharacters.push_back((_password ? "*" : keyString)); diff --git a/interface/src/ui/Keyboard.h b/interface/src/ui/Keyboard.h index 44fddd9e42..88fef2555c 100644 --- a/interface/src/ui/Keyboard.h +++ b/interface/src/ui/Keyboard.h @@ -40,7 +40,10 @@ public: LAYER, BACKSPACE, SPACE, - ENTER + ENTER, + COPY, + PASTE, + SELECT_ALL, }; static Key::Type getKeyTypeFromString(const QString& keyTypeString);