move add_display::View -> add_window::View & display_options::View -> window_options::VIew, remove displays logic and replace it with window ones
[skip ci]
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -1479,7 +1479,7 @@ dependencies = [
|
|||||||
"rust-embed",
|
"rust-embed",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"wayvr_ipc",
|
"wayvr-ipc",
|
||||||
"wgui",
|
"wgui",
|
||||||
"wlx-common",
|
"wlx-common",
|
||||||
]
|
]
|
||||||
@@ -6990,7 +6990,7 @@ dependencies = [
|
|||||||
"idmap",
|
"idmap",
|
||||||
"idmap-derive",
|
"idmap-derive",
|
||||||
"serde",
|
"serde",
|
||||||
"wayvr_ipc",
|
"wayvr-ipc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -39,4 +39,3 @@ vulkano = { version = "0.35.2", default-features = false, features = [
|
|||||||
] }
|
] }
|
||||||
vulkano-shaders = "0.35.0"
|
vulkano-shaders = "0.35.0"
|
||||||
wayland-client = { version = "0.31.11" }
|
wayland-client = { version = "0.31.11" }
|
||||||
wayvr_ipc = { git = "https://github.com/olekolek1000/wayvr-ipc.git", rev = "6d253ef9e36db0f181566030a4990454ecb60395", default-features = false }
|
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ gtk = "0.18.2"
|
|||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
wlx-common = { path = "../wlx-common" }
|
wlx-common = { path = "../wlx-common" }
|
||||||
wayvr_ipc = { workspace = true }
|
wayvr-ipc = { path = "../wayvr-ipc", default-features = false }
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<include src="t_tab_title.xml" />
|
<include src="t_tab_title.xml" />
|
||||||
|
|
||||||
<elements>
|
<elements>
|
||||||
<TabTitle translation="LIST_OF_DISPLAYS" icon="dashboard/window.svg" />
|
<TabTitle translation="LIST_OF_WINDOWS" icon="dashboard/window.svg" />
|
||||||
<div id="display_list_parent" />
|
<div id="window_list_parent" />
|
||||||
<TabTitle translation="LIST_OF_PROCESSES" icon="dashboard/cpu.svg" />
|
<TabTitle translation="LIST_OF_PROCESSES" icon="dashboard/cpu.svg" />
|
||||||
<div id="process_list_parent" />
|
<div id="process_list_parent" />
|
||||||
</elements>
|
</elements>
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
<layout>
|
|
||||||
<include src="../t_group_box.xml" />
|
|
||||||
|
|
||||||
<elements>
|
|
||||||
<div gap="16" flex_direction="column" width="100%" justify_self="center" align_items="center" justify_content="center">
|
|
||||||
<rectangle macro="group_box" align_items="center">
|
|
||||||
<label translation="POPUP_ADD_DISPLAY.RESOLUTION" weight="bold" size="20" />
|
|
||||||
<div gap="8" align_items="center">
|
|
||||||
<div flex_direction="column" gap="8" align_items="end">
|
|
||||||
<label translation="WIDTH" />
|
|
||||||
<label translation="HEIGHT" />
|
|
||||||
</div>
|
|
||||||
<div flex_direction="column" gap="8">
|
|
||||||
<Slider show_value="0" id="slider_width" value="2" min_value="0" max_value="6" width="250" height="24" />
|
|
||||||
<Slider show_value="0" id="slider_height" value="2" min_value="0" max_value="6" width="250" height="24" />
|
|
||||||
</div>
|
|
||||||
<div flex_direction="column" gap="8">
|
|
||||||
<label id="label_width" weight="bold" text="px" />
|
|
||||||
<label id="label_height" weight="bold" text="px" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<CheckBox id="cb_portrait" translation="DISPLAY_PORTRAIT_MODE" height="24" />
|
|
||||||
<rectangle min_width="64" min_height="32" macro="group_box" id="rect_display" align_items="center" justify_content="center" padding="0" overflow="hidden">
|
|
||||||
<label id="label_display" align="center" />
|
|
||||||
</rectangle>
|
|
||||||
</rectangle>
|
|
||||||
<Button id="btn_confirm" color="#44ce22FF" padding_top="4" padding_bottom="4" round="8" padding_left="12" padding_right="12" min_height="32">
|
|
||||||
<sprite src_builtin="dashboard/display.svg" width="32" height="32" />
|
|
||||||
<label translation="ADD_DISPLAY" weight="bold" size="17" shadow="#00000099" />
|
|
||||||
</Button>
|
|
||||||
<label id="label_display_name" weight="bold" size="20" />
|
|
||||||
</div>
|
|
||||||
</elements>
|
|
||||||
</layout>
|
|
||||||
@@ -26,13 +26,10 @@
|
|||||||
<CheckBox id="cb_cage_mode" text="Run in X11 mode (cage)" />
|
<CheckBox id="cb_cage_mode" text="Run in X11 mode (cage)" />
|
||||||
<CheckBox id="cb_wayland_mode" text="Run in Wayland mode" checked="1" />
|
<CheckBox id="cb_wayland_mode" text="Run in Wayland mode" checked="1" />
|
||||||
<Separator />
|
<Separator />
|
||||||
<Button align_self="baseline" color="#44ce22FF" padding_top="4" padding_bottom="4" round="8" padding_right="12" min_height="40">
|
<Button id="btn_launch" align_self="baseline" color="#44ce22FF" padding_top="4" padding_bottom="4" round="8" padding_right="12" min_height="40">
|
||||||
<sprite src_builtin="dashboard/play.svg" width="32" height="32" />
|
<sprite src_builtin="dashboard/play.svg" width="32" height="32" />
|
||||||
<label text="Launch embedded (todo)" weight="bold" size="17" shadow="#00000099" />
|
<label text="Launch" weight="bold" size="17" shadow="#00000099" />
|
||||||
</Button>
|
</Button>
|
||||||
<Separator />
|
|
||||||
<label size="16" weight="bold" text="Or launch it detached" />
|
|
||||||
<div id="display_list_parent" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</elements>
|
</elements>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
<elements>
|
<elements>
|
||||||
<rectangle macro="group_box" flex_direction="row" align_items="center">
|
<rectangle macro="group_box" flex_direction="row" align_items="center">
|
||||||
<div id="list_parent" gap="8" flex_direction="row" flex_wrap="wrap" flex_grow="1" />
|
<div id="list_parent" gap="8" flex_direction="row" flex_wrap="wrap" flex_grow="1" />
|
||||||
<Button id="btn_add" sprite_src_builtin="dashboard/add.svg" tooltip="ADD_DISPLAY" height="100%" min_width="32" />
|
|
||||||
</rectangle>
|
</rectangle>
|
||||||
</elements>
|
</elements>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -4,10 +4,11 @@
|
|||||||
<elements>
|
<elements>
|
||||||
<div gap="16" flex_direction="column" width="100%" justify_self="center" align_items="center" justify_content="center">
|
<div gap="16" flex_direction="column" width="100%" justify_self="center" align_items="center" justify_content="center">
|
||||||
<rectangle macro="group_box" align_items="center">
|
<rectangle macro="group_box" align_items="center">
|
||||||
<div id="display_parent" />
|
<div id="window_parent" />
|
||||||
<div gap="8">
|
<div gap="8">
|
||||||
<Button id="btn_remove" translation="REMOVE" sprite_src_builtin="dashboard/remove_circle.svg" />
|
|
||||||
<Button id="btn_show_hide" text="showhide" sprite_src_builtin="dashboard/eye.svg" />
|
<Button id="btn_show_hide" text="showhide" sprite_src_builtin="dashboard/eye.svg" />
|
||||||
|
<Button id="btn_close" translation="CLOSE_WINDOW" sprite_src_builtin="dashboard/remove_circle.svg" />
|
||||||
|
<Button id="btn_kill" translation="TERMINATE_PROCESS" sprite_src_builtin="dashboard/remove_circle.svg" />
|
||||||
</div>
|
</div>
|
||||||
</rectangle>
|
</rectangle>
|
||||||
</div>
|
</div>
|
||||||
@@ -46,25 +46,23 @@
|
|||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
"RECENTER_PLAYSPACE": "Playspace neu zentrieren"
|
"RECENTER_PLAYSPACE": "Playspace neu zentrieren"
|
||||||
},
|
},
|
||||||
"LIST_OF_DISPLAYS": "Anzeigeliste",
|
|
||||||
"LIST_OF_PROCESSES": "Prozessliste",
|
"LIST_OF_PROCESSES": "Prozessliste",
|
||||||
"NO_DISPLAYS_FOUND": "Keine Displays gefunden",
|
|
||||||
"ADD_DISPLAY": "Bildschirm hinzufügen",
|
|
||||||
"POPUP_ADD_DISPLAY": {
|
"POPUP_ADD_DISPLAY": {
|
||||||
"RESOLUTION": "Auflösung"
|
"RESOLUTION": "Auflösung"
|
||||||
},
|
},
|
||||||
"WIDTH": "Breite",
|
"WIDTH": "Breite",
|
||||||
"HEIGHT": "Höhe",
|
"HEIGHT": "Höhe",
|
||||||
"DISPLAY_PORTRAIT_MODE": "Porträtmodus",
|
|
||||||
"HIDE": "Verbergen",
|
"HIDE": "Verbergen",
|
||||||
"REMOVE": "Entfernen",
|
"REMOVE": "Entfernen",
|
||||||
"SHOW": "Anzeigen",
|
"SHOW": "Anzeigen",
|
||||||
"DISPLAY_OPTIONS": "Anzeigeeinstellungen",
|
|
||||||
"PROCESS_LIST": {
|
"PROCESS_LIST": {
|
||||||
"NO_PROCESSES_FOUND": "Keine Prozesse gefunden",
|
"NO_PROCESSES_FOUND": "Keine Prozesse gefunden",
|
||||||
"LOCATED_ON": "auf",
|
"LOCATED_ON": "auf",
|
||||||
"TERMINATE_PROCESS_NAMED_X": "Prozess \"{PROCESS_NAME}\" beenden"
|
"TERMINATE_PROCESS_NAMED_X": "Prozess \"{PROCESS_NAME}\" beenden"
|
||||||
},
|
},
|
||||||
"FAILED_TO_LAUNCH_APPLICATION": "Fehler beim Starten der Anwendung:",
|
"FAILED_TO_LAUNCH_APPLICATION": "Fehler beim Starten der Anwendung:",
|
||||||
"APPLICATION_LAUNCHED_ON": "Anwendung wurde auf {DISPLAY_NAME} gestartet."
|
"NO_WINDOWS_FOUND": "Keine Fenster gefunden",
|
||||||
|
"WINDOW_OPTIONS": "Fensteroptionen",
|
||||||
|
"APPLICATION_STARTED": "Anwendung gestartet",
|
||||||
|
"LIST_OF_WINDOWS": "Fensterliste"
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
"RECENTER_PLAYSPACE": "Re-center playspace"
|
"RECENTER_PLAYSPACE": "Re-center playspace"
|
||||||
},
|
},
|
||||||
"ADD_DISPLAY": "Add display",
|
|
||||||
"APP_SETTINGS": {
|
"APP_SETTINGS": {
|
||||||
"BRIGHTNESS": "Brightness",
|
"BRIGHTNESS": "Brightness",
|
||||||
"HEADSET_SETTINGS": "Headset settings",
|
"HEADSET_SETTINGS": "Headset settings",
|
||||||
@@ -22,8 +21,8 @@
|
|||||||
},
|
},
|
||||||
"WLX_OVERLAY_S_SETTINGS": "WlxOverlay-S settings"
|
"WLX_OVERLAY_S_SETTINGS": "WlxOverlay-S settings"
|
||||||
},
|
},
|
||||||
"APPLICATION_LAUNCHED_ON": "Application launched on {DISPLAY_NAME}.",
|
|
||||||
"APPLICATION_LAUNCHER": "Application launcher",
|
"APPLICATION_LAUNCHER": "Application launcher",
|
||||||
|
"APPLICATION_STARTED": "Application started",
|
||||||
"APPLICATIONS": "Applications",
|
"APPLICATIONS": "Applications",
|
||||||
"AUDIO": {
|
"AUDIO": {
|
||||||
"AUTO_SWITCH_TO_VR_AUDIO": "Auto-switch to VR audio",
|
"AUTO_SWITCH_TO_VR_AUDIO": "Auto-switch to VR audio",
|
||||||
@@ -40,8 +39,7 @@
|
|||||||
"SPEAKERS_SET_SUCCESSFULLY": "Speakers set successfully",
|
"SPEAKERS_SET_SUCCESSFULLY": "Speakers set successfully",
|
||||||
"VOLUME": "Volume"
|
"VOLUME": "Volume"
|
||||||
},
|
},
|
||||||
"DISPLAY_OPTIONS": "Display options",
|
"CLOSE_WINDOW": "Close window",
|
||||||
"DISPLAY_PORTRAIT_MODE": "Portrait mode",
|
|
||||||
"FAILED_TO_LAUNCH_APPLICATION": "Failed to launcha application:",
|
"FAILED_TO_LAUNCH_APPLICATION": "Failed to launcha application:",
|
||||||
"GAMES": "Games",
|
"GAMES": "Games",
|
||||||
"GENERAL_SETTINGS": "General settings",
|
"GENERAL_SETTINGS": "General settings",
|
||||||
@@ -50,10 +48,10 @@
|
|||||||
"HELLO_USER": "Hello, {USER}!",
|
"HELLO_USER": "Hello, {USER}!",
|
||||||
"HIDE": "Hide",
|
"HIDE": "Hide",
|
||||||
"HOME_SCREEN": "Home",
|
"HOME_SCREEN": "Home",
|
||||||
"LIST_OF_DISPLAYS": "Display list",
|
|
||||||
"LIST_OF_PROCESSES": "Process list",
|
"LIST_OF_PROCESSES": "Process list",
|
||||||
|
"LIST_OF_WINDOWS": "Window list",
|
||||||
"MONADO_RUNTIME": "„Monado” runtime",
|
"MONADO_RUNTIME": "„Monado” runtime",
|
||||||
"NO_DISPLAYS_FOUND": "No displays found",
|
"NO_WINDOWS_FOUND": "No windows found",
|
||||||
"POPUP_ADD_DISPLAY": {
|
"POPUP_ADD_DISPLAY": {
|
||||||
"RESOLUTION": "Resolution"
|
"RESOLUTION": "Resolution"
|
||||||
},
|
},
|
||||||
@@ -66,5 +64,7 @@
|
|||||||
"REMOVE": "Remove",
|
"REMOVE": "Remove",
|
||||||
"SETTINGS": "Settings",
|
"SETTINGS": "Settings",
|
||||||
"SHOW": "Show",
|
"SHOW": "Show",
|
||||||
"WIDTH": "Width"
|
"TERMINATE_PROCESS": "Terminate process",
|
||||||
|
"WIDTH": "Width",
|
||||||
|
"WINDOW_OPTIONS": "Window options"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,25 +46,23 @@
|
|||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
"RECENTER_PLAYSPACE": "Re-centrar espacio de juego"
|
"RECENTER_PLAYSPACE": "Re-centrar espacio de juego"
|
||||||
},
|
},
|
||||||
"LIST_OF_DISPLAYS": "Lista de pantallas",
|
|
||||||
"LIST_OF_PROCESSES": "Lista de procesos",
|
"LIST_OF_PROCESSES": "Lista de procesos",
|
||||||
"NO_DISPLAYS_FOUND": "No se encontraron pantallas",
|
|
||||||
"ADD_DISPLAY": "Agregar pantalla",
|
|
||||||
"POPUP_ADD_DISPLAY": {
|
"POPUP_ADD_DISPLAY": {
|
||||||
"RESOLUTION": "Resolución"
|
"RESOLUTION": "Resolución"
|
||||||
},
|
},
|
||||||
"WIDTH": "Ancho",
|
"WIDTH": "Ancho",
|
||||||
"HEIGHT": "Altura",
|
"HEIGHT": "Altura",
|
||||||
"DISPLAY_PORTRAIT_MODE": "Modo retrato",
|
|
||||||
"HIDE": "Ocultar",
|
"HIDE": "Ocultar",
|
||||||
"REMOVE": "Eliminar",
|
"REMOVE": "Eliminar",
|
||||||
"SHOW": "Mostrar",
|
"SHOW": "Mostrar",
|
||||||
"DISPLAY_OPTIONS": "Opciones de pantalla",
|
|
||||||
"PROCESS_LIST": {
|
"PROCESS_LIST": {
|
||||||
"NO_PROCESSES_FOUND": "No se encontraron procesos",
|
"NO_PROCESSES_FOUND": "No se encontraron procesos",
|
||||||
"LOCATED_ON": "en",
|
"LOCATED_ON": "en",
|
||||||
"TERMINATE_PROCESS_NAMED_X": "Terminar proceso \"{PROCESS_NAME}\""
|
"TERMINATE_PROCESS_NAMED_X": "Terminar proceso \"{PROCESS_NAME}\""
|
||||||
},
|
},
|
||||||
"FAILED_TO_LAUNCH_APPLICATION": "No se pudo iniciar la aplicación:",
|
"FAILED_TO_LAUNCH_APPLICATION": "No se pudo iniciar la aplicación:",
|
||||||
"APPLICATION_LAUNCHED_ON": "Aplicación iniciada en {DISPLAY_NAME}."
|
"NO_WINDOWS_FOUND": "No se encontraron ventanas",
|
||||||
|
"WINDOW_OPTIONS": "Opciones de ventana",
|
||||||
|
"APPLICATION_STARTED": "Aplicación iniciada",
|
||||||
|
"LIST_OF_WINDOWS": "Lista de ventanas"
|
||||||
}
|
}
|
||||||
@@ -1,70 +1,68 @@
|
|||||||
{
|
{
|
||||||
"HOME_SCREEN": "ホーム",
|
"HOME_SCREEN": "ホーム",
|
||||||
"MONADO_RUNTIME": "「Monado」ランタイム",
|
"MONADO_RUNTIME": "「Monado」ランタイム",
|
||||||
"APPLICATIONS": "アプリケーション",
|
"APPLICATIONS": "アプリケーション",
|
||||||
"GAMES": "ゲーム",
|
"GAMES": "ゲーム",
|
||||||
"SETTINGS": "設定",
|
"SETTINGS": "設定",
|
||||||
"PROCESSES": "プロセス",
|
"PROCESSES": "プロセス",
|
||||||
"HELLO_USER": "こんにちは、{USER}!",
|
"HELLO_USER": "こんにちは、{USER}!",
|
||||||
"GENERAL_SETTINGS": "全般設定",
|
"GENERAL_SETTINGS": "全般設定",
|
||||||
"APPLICATION_LAUNCHER": "アプリケーションランチャー",
|
"APPLICATION_LAUNCHER": "アプリケーションランチャー",
|
||||||
"APP_SETTINGS": {
|
"APP_SETTINGS": {
|
||||||
"HIDE_USERNAME": "ユーザー名を表示しない",
|
"HIDE_USERNAME": "ユーザー名を表示しない",
|
||||||
"OPAQUE_BACKGROUND": "不透明な背景",
|
"OPAQUE_BACKGROUND": "不透明な背景",
|
||||||
"RUN_IN_XWAYLAND_MODE_BY_DEFAULT": "XWaylandモードでデフォルトで実行する",
|
"RUN_IN_XWAYLAND_MODE_BY_DEFAULT": "XWaylandモードでデフォルトで実行する",
|
||||||
"WLX_OVERLAY_S_SETTINGS": "WlxOverlay-Sの設定",
|
"WLX_OVERLAY_S_SETTINGS": "WlxOverlay-Sの設定",
|
||||||
"HEADSET_SETTINGS": "ヘッドセット設定",
|
"HEADSET_SETTINGS": "ヘッドセット設定",
|
||||||
"BRIGHTNESS": "明るさ",
|
"BRIGHTNESS": "明るさ",
|
||||||
"WLX": {
|
"WLX": {
|
||||||
"NOTIFICATIONS_ENABLED": "通知",
|
"NOTIFICATIONS_ENABLED": "通知",
|
||||||
"NOTIFICATIONS_SOUND_ENABLED": "通知音",
|
"NOTIFICATIONS_SOUND_ENABLED": "通知音",
|
||||||
"KEYBOARD_SOUND_ENABLED": "キーボード音",
|
"KEYBOARD_SOUND_ENABLED": "キーボード音",
|
||||||
"BLOCK_GAME_INPUT": "ゲーム入力をブロック",
|
"BLOCK_GAME_INPUT": "ゲーム入力をブロック",
|
||||||
"SPACE_DRAG_MULTIPLIER": "スペースドラッグ乗数",
|
"SPACE_DRAG_MULTIPLIER": "スペースドラッグ乗数",
|
||||||
"SPACE_DRAG_ROTATION_ENABLED": "スペースドラッグでの回転",
|
"SPACE_DRAG_ROTATION_ENABLED": "スペースドラッグでの回転",
|
||||||
"SHOW_SKYBOX": "スカイボックス",
|
"SHOW_SKYBOX": "スカイボックス",
|
||||||
"ENABLE_PASSTHROUGH": "パススルー"
|
"ENABLE_PASSTHROUGH": "パススルー"
|
||||||
},
|
},
|
||||||
"RESTART_SOFTWARE": "ソフトウェアを再起動"
|
"RESTART_SOFTWARE": "ソフトウェアを再起動"
|
||||||
},
|
},
|
||||||
"HELLO": "こんにちは!",
|
"HELLO": "こんにちは!",
|
||||||
"AUDIO": {
|
"AUDIO": {
|
||||||
"VOLUME": "音量",
|
"VOLUME": "音量",
|
||||||
"SETTINGS": "オーディオ設定",
|
"SETTINGS": "オーディオ設定",
|
||||||
"AUTO_SWITCH_TO_VR_AUDIO": "VRオーディオに自動切り替え",
|
"AUTO_SWITCH_TO_VR_AUDIO": "VRオーディオに自動切り替え",
|
||||||
"SPEAKERS": "スピーカー",
|
"SPEAKERS": "スピーカー",
|
||||||
"MICROPHONES": "マイク",
|
"MICROPHONES": "マイク",
|
||||||
"CARDS": "カード",
|
"CARDS": "カード",
|
||||||
"SELECT_AUDIO_CARD_PROFILE": "オーディオカードプロファイルを選択",
|
"SELECT_AUDIO_CARD_PROFILE": "オーディオカードプロファイルを選択",
|
||||||
"NO_VR_SPEAKERS_FOUND_SWITCH_MANUALLY": "VRスピーカーが見つかりませんでした。手動で切り替えてください。",
|
"NO_VR_SPEAKERS_FOUND_SWITCH_MANUALLY": "VRスピーカーが見つかりませんでした。手動で切り替えてください。",
|
||||||
"NO_VR_MICROPHONE_SWITCH_MANUALLY": "VRマイクが見つかりませんでした。手動で切り替えてください。",
|
"NO_VR_MICROPHONE_SWITCH_MANUALLY": "VRマイクが見つかりませんでした。手動で切り替えてください。",
|
||||||
"FAILED_TO_SWITCH_MICROPHONE": "マイクの切り替えに失敗しました",
|
"FAILED_TO_SWITCH_MICROPHONE": "マイクの切り替えに失敗しました",
|
||||||
"MICROPHONE_SET_SUCCESSFULLY": "マイクの設定が完了しました",
|
"MICROPHONE_SET_SUCCESSFULLY": "マイクの設定が完了しました",
|
||||||
"SPEAKERS_SET_SUCCESSFULLY": "スピーカーを設定しました",
|
"SPEAKERS_SET_SUCCESSFULLY": "スピーカーを設定しました",
|
||||||
"DEVICE_FOUND_AND_INITIALIZED_BUT_NOT_SWITCHED": "デバイスが見つかり、初期化されましたが、切り替えられていません"
|
"DEVICE_FOUND_AND_INITIALIZED_BUT_NOT_SWITCHED": "デバイスが見つかり、初期化されましたが、切り替えられていません"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
"RECENTER_PLAYSPACE": "プレイスペースを再中央"
|
"RECENTER_PLAYSPACE": "プレイスペースを再中央"
|
||||||
},
|
},
|
||||||
"LIST_OF_DISPLAYS": "ディスプレイリスト",
|
"LIST_OF_PROCESSES": "プロセスのリスト",
|
||||||
"LIST_OF_PROCESSES": "プロセスのリスト",
|
"POPUP_ADD_DISPLAY": {
|
||||||
"NO_DISPLAYS_FOUND": "ディスプレイが見つかりません",
|
"RESOLUTION": "解像度"
|
||||||
"ADD_DISPLAY": "ディスプレイを追加",
|
},
|
||||||
"POPUP_ADD_DISPLAY": {
|
"WIDTH": "幅",
|
||||||
"RESOLUTION": "解像度"
|
"HEIGHT": "高さ",
|
||||||
},
|
"HIDE": "隠す",
|
||||||
"WIDTH": "幅",
|
"REMOVE": "削除",
|
||||||
"HEIGHT": "高さ",
|
"SHOW": "表示",
|
||||||
"DISPLAY_PORTRAIT_MODE": "縦向きモード",
|
"PROCESS_LIST": {
|
||||||
"HIDE": "隠す",
|
"NO_PROCESSES_FOUND": "プロセスが見つかりませんでした",
|
||||||
"REMOVE": "削除",
|
"LOCATED_ON": "に",
|
||||||
"SHOW": "表示",
|
"TERMINATE_PROCESS_NAMED_X": "プロセス \"{PROCESS_NAME}\" を終了します"
|
||||||
"DISPLAY_OPTIONS": "表示オプション",
|
},
|
||||||
"PROCESS_LIST": {
|
"FAILED_TO_LAUNCH_APPLICATION": "アプリケーションの起動に失敗しました:",
|
||||||
"NO_PROCESSES_FOUND": "プロセスが見つかりませんでした",
|
"NO_WINDOWS_FOUND": "ウィンドウが見つかりませんでした",
|
||||||
"LOCATED_ON": "に",
|
"WINDOW_OPTIONS": "ウィンドウオプション",
|
||||||
"TERMINATE_PROCESS_NAMED_X": "プロセス \"{PROCESS_NAME}\" を終了します"
|
"APPLICATION_STARTED": "アプリケーションが起動しました",
|
||||||
},
|
"LIST_OF_WINDOWS": "ウィンドウ一覧"
|
||||||
"FAILED_TO_LAUNCH_APPLICATION": "アプリケーションの起動に失敗しました:",
|
|
||||||
"APPLICATION_LAUNCHED_ON": "{DISPLAY_NAME}でアプリケーションが起動しました。"
|
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
"RECENTER_PLAYSPACE": "Wycentruj przestrzeń"
|
"RECENTER_PLAYSPACE": "Wycentruj przestrzeń"
|
||||||
},
|
},
|
||||||
"ADD_DISPLAY": "Dodaj monitor",
|
|
||||||
"APP_SETTINGS": {
|
"APP_SETTINGS": {
|
||||||
"BRIGHTNESS": "Jasność",
|
"BRIGHTNESS": "Jasność",
|
||||||
"HEADSET_SETTINGS": "Ustawienia HMD",
|
"HEADSET_SETTINGS": "Ustawienia HMD",
|
||||||
@@ -39,8 +38,6 @@
|
|||||||
"SPEAKERS_SET_SUCCESSFULLY": "Głośniki ustawiono pomyślnie",
|
"SPEAKERS_SET_SUCCESSFULLY": "Głośniki ustawiono pomyślnie",
|
||||||
"VOLUME": "Głośność"
|
"VOLUME": "Głośność"
|
||||||
},
|
},
|
||||||
"DISPLAY_OPTIONS": "Opcje monitora",
|
|
||||||
"DISPLAY_PORTRAIT_MODE": "Tryb pionowy",
|
|
||||||
"GAMES": "Gry",
|
"GAMES": "Gry",
|
||||||
"GENERAL_SETTINGS": "Ustawienia ogólne",
|
"GENERAL_SETTINGS": "Ustawienia ogólne",
|
||||||
"HEIGHT": "Wysokość",
|
"HEIGHT": "Wysokość",
|
||||||
@@ -48,10 +45,8 @@
|
|||||||
"HELLO_USER": "Witaj, {USER}!",
|
"HELLO_USER": "Witaj, {USER}!",
|
||||||
"HIDE": "Ukryj",
|
"HIDE": "Ukryj",
|
||||||
"HOME_SCREEN": "Ekran główny",
|
"HOME_SCREEN": "Ekran główny",
|
||||||
"LIST_OF_DISPLAYS": "Lista monitorów",
|
|
||||||
"LIST_OF_PROCESSES": "Lista procesów",
|
"LIST_OF_PROCESSES": "Lista procesów",
|
||||||
"MONADO_RUNTIME": "Środowisko Monado",
|
"MONADO_RUNTIME": "Środowisko Monado",
|
||||||
"NO_DISPLAYS_FOUND": "Brak monitorów",
|
|
||||||
"POPUP_ADD_DISPLAY": {
|
"POPUP_ADD_DISPLAY": {
|
||||||
"RESOLUTION": "Rozdzielczość"
|
"RESOLUTION": "Rozdzielczość"
|
||||||
},
|
},
|
||||||
@@ -66,5 +61,8 @@
|
|||||||
"TERMINATE_PROCESS_NAMED_X": "Zakończ proces \"{PROCESS_NAME}\""
|
"TERMINATE_PROCESS_NAMED_X": "Zakończ proces \"{PROCESS_NAME}\""
|
||||||
},
|
},
|
||||||
"FAILED_TO_LAUNCH_APPLICATION": "Nie udało się uruchomić aplikacji:",
|
"FAILED_TO_LAUNCH_APPLICATION": "Nie udało się uruchomić aplikacji:",
|
||||||
"APPLICATION_LAUNCHED_ON": "Aplikacja uruchomiona na {DISPLAY_NAME}."
|
"NO_WINDOWS_FOUND": "Nie znaleziono okien",
|
||||||
|
"WINDOW_OPTIONS": "Opcje okna",
|
||||||
|
"APPLICATION_STARTED": "Aplikacja uruchomiona",
|
||||||
|
"LIST_OF_WINDOWS": "Lista okien"
|
||||||
}
|
}
|
||||||
@@ -236,6 +236,7 @@ impl Frontend {
|
|||||||
self.globals.clone(),
|
self.globals.clone(),
|
||||||
self.settings.as_ref(),
|
self.settings.as_ref(),
|
||||||
&mut layout,
|
&mut layout,
|
||||||
|
&mut self.interface,
|
||||||
self.tasks.clone(),
|
self.tasks.clone(),
|
||||||
params,
|
params,
|
||||||
)?;
|
)?;
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ use wgui::{
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
tab::{Tab, TabParams, TabType, TabUpdateParams},
|
tab::{Tab, TabParams, TabType, TabUpdateParams},
|
||||||
views::{display_list, process_list},
|
views::{process_list, window_list},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct TabProcesses {
|
pub struct TabProcesses {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub state: ParserState,
|
pub state: ParserState,
|
||||||
|
|
||||||
view_display_list: display_list::View,
|
view_window_list: window_list::View,
|
||||||
view_process_list: process_list::View,
|
view_process_list: process_list::View,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ impl Tab for TabProcesses {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, params: TabUpdateParams) -> anyhow::Result<()> {
|
fn update(&mut self, params: TabUpdateParams) -> anyhow::Result<()> {
|
||||||
self.view_display_list.update(params.layout, params.interface)?;
|
self.view_window_list.update(params.layout, params.interface)?;
|
||||||
self.view_process_list.update(params.layout, params.interface)?;
|
self.view_process_list.update(params.layout, params.interface)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -41,9 +41,9 @@ impl TabProcesses {
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
view_display_list: display_list::View::new(display_list::Params {
|
view_window_list: window_list::View::new(window_list::Params {
|
||||||
layout: params.layout,
|
layout: params.layout,
|
||||||
parent_id: state.get_widget_id("display_list_parent")?,
|
parent_id: state.get_widget_id("window_list_parent")?,
|
||||||
globals: params.globals,
|
globals: params.globals,
|
||||||
frontend_tasks: params.frontend_tasks.clone(),
|
frontend_tasks: params.frontend_tasks.clone(),
|
||||||
on_click: None,
|
on_click: None,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use wgui::{
|
|||||||
taffy::Display,
|
taffy::Display,
|
||||||
widget::label::WidgetLabel,
|
widget::label::WidgetLabel,
|
||||||
};
|
};
|
||||||
|
use wlx_common::dash_interface::BoxDashInterface;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
frontend::{FrontendTask, FrontendTasks},
|
frontend::{FrontendTask, FrontendTasks},
|
||||||
@@ -60,6 +61,7 @@ pub struct PopupContentFuncData<'a> {
|
|||||||
pub layout: &'a mut Layout,
|
pub layout: &'a mut Layout,
|
||||||
pub settings: &'a dyn SettingsIO,
|
pub settings: &'a dyn SettingsIO,
|
||||||
pub handle: PopupHandle,
|
pub handle: PopupHandle,
|
||||||
|
pub interface: &'a mut BoxDashInterface,
|
||||||
pub id_content: WidgetID,
|
pub id_content: WidgetID,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +127,7 @@ impl PopupManager {
|
|||||||
globals: WguiGlobals,
|
globals: WguiGlobals,
|
||||||
settings: &dyn SettingsIO,
|
settings: &dyn SettingsIO,
|
||||||
layout: &mut Layout,
|
layout: &mut Layout,
|
||||||
|
interface: &mut BoxDashInterface,
|
||||||
frontend_tasks: FrontendTasks,
|
frontend_tasks: FrontendTasks,
|
||||||
params: MountPopupParams,
|
params: MountPopupParams,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
@@ -181,6 +184,7 @@ impl PopupManager {
|
|||||||
handle: popup_handle.clone(),
|
handle: popup_handle.clone(),
|
||||||
id_content,
|
id_content,
|
||||||
settings,
|
settings,
|
||||||
|
interface,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
use std::{path::PathBuf, str::FromStr};
|
use std::{path::PathBuf, str::FromStr};
|
||||||
|
|
||||||
use wayvr_ipc::packet_server;
|
|
||||||
use wgui::{
|
use wgui::{
|
||||||
assets::{AssetPath, AssetPathOwned},
|
assets::{AssetPath, AssetPathOwned},
|
||||||
globals::WguiGlobals,
|
globals::WguiGlobals,
|
||||||
@@ -13,7 +11,6 @@ use wgui::{
|
|||||||
sprite::{WidgetSprite, WidgetSpriteParams},
|
sprite::{WidgetSprite, WidgetSpriteParams},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use wlx_common::dash_interface::BoxDashInterface;
|
|
||||||
|
|
||||||
use crate::util::desktop_finder;
|
use crate::util::desktop_finder;
|
||||||
|
|
||||||
@@ -33,22 +30,6 @@ pub fn get_desktop_file_icon_path(desktop_file: &desktop_finder::DesktopFile) ->
|
|||||||
AssetPathOwned::BuiltIn(PathBuf::from_str("dashboard/terminal.svg").unwrap())
|
AssetPathOwned::BuiltIn(PathBuf::from_str("dashboard/terminal.svg").unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_all_windows(interface: &mut BoxDashInterface) -> anyhow::Result<Vec<packet_server::WvrWindow>> {
|
|
||||||
let mut windows = Vec::<packet_server::WvrWindow>::new();
|
|
||||||
|
|
||||||
for display in interface.display_list()? {
|
|
||||||
let Ok(window_list) = interface.display_window_list(display.handle) else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
|
|
||||||
for window in window_list {
|
|
||||||
windows.push(window)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(windows)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn mount_simple_label(
|
pub fn mount_simple_label(
|
||||||
globals: &WguiGlobals,
|
globals: &WguiGlobals,
|
||||||
layout: &mut Layout,
|
layout: &mut Layout,
|
||||||
|
|||||||
@@ -1,247 +0,0 @@
|
|||||||
use std::rc::Rc;
|
|
||||||
|
|
||||||
use anyhow::Context;
|
|
||||||
use wgui::{
|
|
||||||
assets::AssetPath,
|
|
||||||
components::{button::ComponentButton, checkbox::ComponentCheckbox, slider::ComponentSlider},
|
|
||||||
event::StyleSetRequest,
|
|
||||||
globals::WguiGlobals,
|
|
||||||
i18n::Translation,
|
|
||||||
layout::{Layout, WidgetID},
|
|
||||||
parser::{Fetchable, ParseDocumentParams, ParserState},
|
|
||||||
taffy::prelude::length,
|
|
||||||
widget::label::WidgetLabel,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::task::Tasks;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
enum Task {
|
|
||||||
Confirm,
|
|
||||||
SetWidth(u16),
|
|
||||||
SetHeight(u16),
|
|
||||||
SetPortrait(bool),
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct View {
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub state: ParserState,
|
|
||||||
tasks: Tasks<Task>,
|
|
||||||
on_submit: Rc<dyn Fn(Result)>,
|
|
||||||
|
|
||||||
cur_raw_width: u16,
|
|
||||||
cur_raw_height: u16,
|
|
||||||
cur_display_name: String,
|
|
||||||
cur_portrait: bool,
|
|
||||||
|
|
||||||
id_label_width: WidgetID,
|
|
||||||
id_label_height: WidgetID,
|
|
||||||
id_label_display_name: WidgetID,
|
|
||||||
id_rect_display: WidgetID,
|
|
||||||
id_label_display: WidgetID,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct Result {
|
|
||||||
pub width: u16,
|
|
||||||
pub height: u16,
|
|
||||||
pub display_name: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Params<'a> {
|
|
||||||
pub globals: WguiGlobals,
|
|
||||||
pub layout: &'a mut Layout,
|
|
||||||
pub parent_id: WidgetID,
|
|
||||||
pub on_submit: Rc<dyn Fn(Result)>,
|
|
||||||
}
|
|
||||||
|
|
||||||
const RES_COUNT: usize = 7;
|
|
||||||
const RES_WIDTHS: [u16; RES_COUNT] = [512, 854, 1280, 1600, 1920, 2560, 3840];
|
|
||||||
const RES_HEIGHTS: [u16; 7] = [256, 480, 720, 900, 1080, 1440, 2160];
|
|
||||||
|
|
||||||
impl View {
|
|
||||||
pub fn new(params: Params) -> anyhow::Result<Self> {
|
|
||||||
let doc_params = &ParseDocumentParams {
|
|
||||||
globals: params.globals.clone(),
|
|
||||||
path: AssetPath::BuiltIn("gui/view/add_display.xml"),
|
|
||||||
extra: Default::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let state = wgui::parser::parse_from_assets(doc_params, params.layout, params.parent_id)?;
|
|
||||||
|
|
||||||
let tasks = Tasks::new();
|
|
||||||
|
|
||||||
let slider_width = state.fetch_component_as::<ComponentSlider>("slider_width")?;
|
|
||||||
let slider_height = state.fetch_component_as::<ComponentSlider>("slider_height")?;
|
|
||||||
let id_label_width = state.get_widget_id("label_width")?;
|
|
||||||
let id_label_height = state.get_widget_id("label_height")?;
|
|
||||||
let id_label_display_name = state.get_widget_id("label_display_name")?;
|
|
||||||
let id_rect_display = state.get_widget_id("rect_display")?;
|
|
||||||
let id_label_display = state.get_widget_id("label_display")?;
|
|
||||||
let btn_confirm = state.fetch_component_as::<ComponentButton>("btn_confirm")?;
|
|
||||||
let cb_portrait = state.fetch_component_as::<ComponentCheckbox>("cb_portrait")?;
|
|
||||||
|
|
||||||
tasks.handle_button(btn_confirm, Task::Confirm);
|
|
||||||
|
|
||||||
// width
|
|
||||||
slider_width.on_value_changed({
|
|
||||||
let tasks = tasks.clone();
|
|
||||||
Box::new(move |_c, e| {
|
|
||||||
tasks.push(Task::SetWidth(RES_WIDTHS[e.value as usize]));
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
// height
|
|
||||||
slider_height.on_value_changed({
|
|
||||||
let tasks = tasks.clone();
|
|
||||||
Box::new(move |_c, e| {
|
|
||||||
tasks.push(Task::SetHeight(RES_HEIGHTS[e.value as usize]));
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
cb_portrait.on_toggle({
|
|
||||||
let tasks = tasks.clone();
|
|
||||||
Box::new(move |_c, e| {
|
|
||||||
tasks.push(Task::SetPortrait(e.checked));
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
let mut res = Self {
|
|
||||||
state,
|
|
||||||
tasks,
|
|
||||||
on_submit: params.on_submit,
|
|
||||||
cur_raw_width: RES_WIDTHS[2],
|
|
||||||
cur_raw_height: RES_HEIGHTS[2],
|
|
||||||
cur_display_name: String::new(),
|
|
||||||
cur_portrait: false,
|
|
||||||
id_label_width,
|
|
||||||
id_label_height,
|
|
||||||
id_label_display_name,
|
|
||||||
id_rect_display,
|
|
||||||
id_label_display,
|
|
||||||
};
|
|
||||||
|
|
||||||
res.update_ui(params.layout);
|
|
||||||
|
|
||||||
Ok(res)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn update(&mut self, layout: &mut Layout) -> anyhow::Result<()> {
|
|
||||||
for task in self.tasks.drain() {
|
|
||||||
match task {
|
|
||||||
Task::Confirm => self.confirm(),
|
|
||||||
Task::SetWidth(w) => {
|
|
||||||
self.cur_raw_width = w;
|
|
||||||
self.update_ui_res(layout)?;
|
|
||||||
}
|
|
||||||
Task::SetHeight(h) => {
|
|
||||||
self.cur_raw_height = h;
|
|
||||||
self.update_ui_res(layout)?;
|
|
||||||
}
|
|
||||||
Task::SetPortrait(p) => {
|
|
||||||
self.cur_portrait = p;
|
|
||||||
self.update_ui_res(layout)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// greatest common divisor
|
|
||||||
fn gcd(a: u16, b: u16) -> u16 {
|
|
||||||
let (mut a, mut b) = (a, b);
|
|
||||||
while b != 0 {
|
|
||||||
let temp = b;
|
|
||||||
b = a % b;
|
|
||||||
a = temp;
|
|
||||||
}
|
|
||||||
a
|
|
||||||
}
|
|
||||||
|
|
||||||
// aspect ratio calculation
|
|
||||||
// e.g. returns (16, 9) for input values [1280, 720]
|
|
||||||
fn aspect_ratio(width: u16, height: u16) -> (u16, u16) {
|
|
||||||
let gcd = gcd(width, height);
|
|
||||||
(width / gcd, height / gcd)
|
|
||||||
}
|
|
||||||
|
|
||||||
impl View {
|
|
||||||
fn confirm(&mut self) {
|
|
||||||
let (width, height) = self.get_wh();
|
|
||||||
(*self.on_submit)(Result {
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
display_name: self.cur_display_name.clone(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_ui(&mut self, layout: &mut Layout) -> Option<()> {
|
|
||||||
let mut c = layout.start_common();
|
|
||||||
|
|
||||||
let (cur_width, cur_height) = self.get_wh();
|
|
||||||
|
|
||||||
{
|
|
||||||
let mut common = c.common();
|
|
||||||
|
|
||||||
let mut label_width = common.state.widgets.get_as::<WidgetLabel>(self.id_label_width)?;
|
|
||||||
let mut label_height = common.state.widgets.get_as::<WidgetLabel>(self.id_label_height)?;
|
|
||||||
let mut label_display_name = common.state.widgets.get_as::<WidgetLabel>(self.id_label_display_name)?;
|
|
||||||
let mut label_display = common.state.widgets.get_as::<WidgetLabel>(self.id_label_display)?;
|
|
||||||
|
|
||||||
// todo?
|
|
||||||
self.cur_display_name = format!("wvr-{}x{}", cur_width, cur_height);
|
|
||||||
|
|
||||||
label_width.set_text(
|
|
||||||
&mut common,
|
|
||||||
Translation::from_raw_text_string(format!("{}px", self.cur_raw_width)),
|
|
||||||
);
|
|
||||||
|
|
||||||
label_height.set_text(
|
|
||||||
&mut common,
|
|
||||||
Translation::from_raw_text_string(format!("{}px", self.cur_raw_height)),
|
|
||||||
);
|
|
||||||
|
|
||||||
let aspect = aspect_ratio(cur_width, cur_height);
|
|
||||||
|
|
||||||
label_display.set_text(
|
|
||||||
&mut common,
|
|
||||||
Translation::from_raw_text_string(format!("{}x{}\n{}:{}", cur_width, cur_height, aspect.0, aspect.1)),
|
|
||||||
);
|
|
||||||
|
|
||||||
label_display_name.set_text(&mut common, Translation::from_raw_text(&self.cur_display_name));
|
|
||||||
|
|
||||||
let mult = 0.1;
|
|
||||||
|
|
||||||
common.alterables.set_style(
|
|
||||||
self.id_rect_display,
|
|
||||||
StyleSetRequest::Width(length(cur_width as f32 * mult)),
|
|
||||||
);
|
|
||||||
|
|
||||||
common.alterables.set_style(
|
|
||||||
self.id_rect_display,
|
|
||||||
StyleSetRequest::Height(length(cur_height as f32 * mult)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
c.finish().ok()?;
|
|
||||||
|
|
||||||
Some(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_ui_res(&mut self, layout: &mut Layout) -> anyhow::Result<()> {
|
|
||||||
self.update_ui(layout).context("failed to update ui")?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_wh(&self) -> (u16, u16) {
|
|
||||||
if self.cur_portrait {
|
|
||||||
(self.cur_raw_height, self.cur_raw_width)
|
|
||||||
} else {
|
|
||||||
(self.cur_raw_width, self.cur_raw_height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
use std::{collections::HashMap, rc::Rc};
|
use std::{collections::HashMap, rc::Rc};
|
||||||
|
|
||||||
use anyhow::Context;
|
|
||||||
use wayvr_ipc::{packet_client::WvrProcessLaunchParams, packet_server::WvrDisplayHandle};
|
use wayvr_ipc::{packet_client::WvrProcessLaunchParams, packet_server::WvrDisplayHandle};
|
||||||
use wgui::{
|
use wgui::{
|
||||||
assets::AssetPath,
|
assets::AssetPath,
|
||||||
components::checkbox::ComponentCheckbox,
|
components::{button::ComponentButton, checkbox::ComponentCheckbox},
|
||||||
globals::WguiGlobals,
|
globals::WguiGlobals,
|
||||||
i18n::Translation,
|
i18n::Translation,
|
||||||
layout::{Layout, WidgetID},
|
layout::{Layout, WidgetID},
|
||||||
@@ -18,7 +17,6 @@ use crate::{
|
|||||||
settings::SettingsIO,
|
settings::SettingsIO,
|
||||||
task::Tasks,
|
task::Tasks,
|
||||||
util::desktop_finder::DesktopEntry,
|
util::desktop_finder::DesktopEntry,
|
||||||
views::display_list,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
@@ -27,13 +25,13 @@ enum RunMode {
|
|||||||
Wayland,
|
Wayland,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
enum Task {
|
enum Task {
|
||||||
SetRunMode(RunMode),
|
SetRunMode(RunMode),
|
||||||
DisplayClick(WvrDisplayHandle),
|
Launch,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LaunchParams<'a> {
|
struct LaunchParams<'a> {
|
||||||
display_handle: WvrDisplayHandle,
|
|
||||||
application: &'a DesktopEntry,
|
application: &'a DesktopEntry,
|
||||||
run_mode: RunMode,
|
run_mode: RunMode,
|
||||||
globals: &'a WguiGlobals,
|
globals: &'a WguiGlobals,
|
||||||
@@ -46,7 +44,6 @@ pub struct View {
|
|||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
state: ParserState,
|
state: ParserState,
|
||||||
entry: DesktopEntry,
|
entry: DesktopEntry,
|
||||||
view_display_list: display_list::View,
|
|
||||||
tasks: Tasks<Task>,
|
tasks: Tasks<Task>,
|
||||||
frontend_tasks: FrontendTasks,
|
frontend_tasks: FrontendTasks,
|
||||||
globals: WguiGlobals,
|
globals: WguiGlobals,
|
||||||
@@ -80,6 +77,7 @@ impl View {
|
|||||||
|
|
||||||
let cb_cage_mode = state.fetch_component_as::<ComponentCheckbox>("cb_cage_mode")?;
|
let cb_cage_mode = state.fetch_component_as::<ComponentCheckbox>("cb_cage_mode")?;
|
||||||
let cb_wayland_mode = state.fetch_component_as::<ComponentCheckbox>("cb_wayland_mode")?;
|
let cb_wayland_mode = state.fetch_component_as::<ComponentCheckbox>("cb_wayland_mode")?;
|
||||||
|
let btn_launch = state.fetch_component_as::<ComponentButton>("btn_launch")?;
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut label_exec = state.fetch_widget_as::<WidgetLabel>(¶ms.layout.state, "label_exec")?;
|
let mut label_exec = state.fetch_widget_as::<WidgetLabel>(¶ms.layout.state, "label_exec")?;
|
||||||
@@ -96,24 +94,9 @@ impl View {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let display_list_parent = state.fetch_widget(¶ms.layout.state, "display_list_parent")?.id;
|
|
||||||
|
|
||||||
let tasks = Tasks::new();
|
let tasks = Tasks::new();
|
||||||
|
|
||||||
let on_display_click = {
|
tasks.handle_button(btn_launch, Task::Launch);
|
||||||
let tasks = tasks.clone();
|
|
||||||
Box::new(move |disp_handle: WvrDisplayHandle| {
|
|
||||||
tasks.push(Task::DisplayClick(disp_handle));
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
let view_display_list = display_list::View::new(display_list::Params {
|
|
||||||
frontend_tasks: params.frontend_tasks.clone(),
|
|
||||||
globals: params.globals,
|
|
||||||
layout: params.layout,
|
|
||||||
parent_id: display_list_parent,
|
|
||||||
on_click: Some(on_display_click),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let id_icon_parent = state.get_widget_id("icon_parent")?;
|
let id_icon_parent = state.get_widget_id("icon_parent")?;
|
||||||
|
|
||||||
@@ -163,7 +146,6 @@ impl View {
|
|||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
state,
|
state,
|
||||||
view_display_list,
|
|
||||||
tasks,
|
tasks,
|
||||||
cb_cage_mode,
|
cb_cage_mode,
|
||||||
cb_wayland_mode,
|
cb_wayland_mode,
|
||||||
@@ -184,13 +166,11 @@ impl View {
|
|||||||
for task in tasks {
|
for task in tasks {
|
||||||
match task {
|
match task {
|
||||||
Task::SetRunMode(run_mode) => self.action_set_run_mode(layout, run_mode)?,
|
Task::SetRunMode(run_mode) => self.action_set_run_mode(layout, run_mode)?,
|
||||||
Task::DisplayClick(disp_handle) => self.action_display_click(disp_handle, interface),
|
Task::Launch => self.action_launch(interface),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.view_display_list.update(layout, interface)?;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,10 +188,9 @@ impl View {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn action_display_click(&mut self, handle: WvrDisplayHandle, interface: &mut BoxDashInterface) {
|
fn action_launch(&mut self, interface: &mut BoxDashInterface) {
|
||||||
View::try_launch(LaunchParams {
|
View::try_launch(LaunchParams {
|
||||||
application: &self.entry,
|
application: &self.entry,
|
||||||
display_handle: handle,
|
|
||||||
frontend_tasks: &self.frontend_tasks,
|
frontend_tasks: &self.frontend_tasks,
|
||||||
globals: &self.globals,
|
globals: &self.globals,
|
||||||
run_mode: self.run_mode.clone(),
|
run_mode: self.run_mode.clone(),
|
||||||
@@ -253,10 +232,6 @@ impl View {
|
|||||||
|
|
||||||
let exec_args_str = desktop_file.exec_args.join(" ");
|
let exec_args_str = desktop_file.exec_args.join(" ");
|
||||||
|
|
||||||
params
|
|
||||||
.interface
|
|
||||||
.display_set_visible(params.display_handle.clone(), true)?;
|
|
||||||
|
|
||||||
let args = match params.run_mode {
|
let args = match params.run_mode {
|
||||||
RunMode::Cage => format!("-- {} {}", desktop_file.exec_path, exec_args_str),
|
RunMode::Cage => format!("-- {} {}", desktop_file.exec_path, exec_args_str),
|
||||||
RunMode::Wayland => exec_args_str,
|
RunMode::Wayland => exec_args_str,
|
||||||
@@ -267,29 +242,22 @@ impl View {
|
|||||||
RunMode::Wayland => &desktop_file.name,
|
RunMode::Wayland => &desktop_file.name,
|
||||||
};
|
};
|
||||||
|
|
||||||
let display = params
|
|
||||||
.interface
|
|
||||||
.display_get(params.display_handle.clone())
|
|
||||||
.context("Display not found")?;
|
|
||||||
|
|
||||||
params.interface.process_launch(WvrProcessLaunchParams {
|
params.interface.process_launch(WvrProcessLaunchParams {
|
||||||
env,
|
env,
|
||||||
exec: String::from(exec),
|
exec: String::from(exec),
|
||||||
name: desktop_file.name,
|
name: desktop_file.name,
|
||||||
target_display: params.display_handle,
|
target_display: WvrDisplayHandle {
|
||||||
|
generation: 12345, // stub
|
||||||
|
idx: 12345,
|
||||||
|
},
|
||||||
args,
|
args,
|
||||||
userdata,
|
userdata,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let str_launched_on = params
|
|
||||||
.globals
|
|
||||||
.i18n()
|
|
||||||
.translate_and_replace("APPLICATION_LAUNCHED_ON", ("{DISPLAY_NAME}", &display.name));
|
|
||||||
|
|
||||||
params
|
params
|
||||||
.frontend_tasks
|
.frontend_tasks
|
||||||
.push(FrontendTask::PushToast(Translation::from_raw_text_string(
|
.push(FrontendTask::PushToast(Translation::from_translation_key(
|
||||||
str_launched_on,
|
"APPLICATION_STARTED",
|
||||||
)));
|
)));
|
||||||
|
|
||||||
(*params.on_launched)();
|
(*params.on_launched)();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pub mod add_display;
|
|
||||||
pub mod app_launcher;
|
pub mod app_launcher;
|
||||||
pub mod audio_settings;
|
pub mod audio_settings;
|
||||||
pub mod display_list;
|
|
||||||
pub mod display_options;
|
|
||||||
pub mod process_list;
|
pub mod process_list;
|
||||||
|
pub mod window_list;
|
||||||
|
pub mod window_options;
|
||||||
|
|||||||
@@ -91,29 +91,18 @@ impl View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_desktop_file_from_process(
|
fn get_desktop_file_from_process(process: &packet_server::WvrProcess) -> Option<desktop_finder::DesktopFile> {
|
||||||
windows: &Vec<packet_server::WvrWindow>,
|
// TODO: refactor this after we ditch old wayvr-dashboard completely
|
||||||
process: &packet_server::WvrProcess,
|
let Some(dfile_str) = process.userdata.get("desktop_file") else {
|
||||||
) -> Option<desktop_finder::DesktopFile> {
|
return None;
|
||||||
for window in windows {
|
};
|
||||||
if window.process_handle != process.handle {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: refactor this after we ditch old wayvr-dashboard completely
|
let Ok(desktop_file) = serde_json::from_str::<desktop_finder::DesktopFile>(dfile_str) else {
|
||||||
let Some(dfile_str) = process.userdata.get("desktop_file") else {
|
debug_assert!(false); // invalid json???
|
||||||
continue;
|
return None;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(desktop_file) = serde_json::from_str::<desktop_finder::DesktopFile>(dfile_str) else {
|
Some(desktop_file)
|
||||||
debug_assert!(false); // invalid json???
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
|
|
||||||
return Some(desktop_file);
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProcessEntryResult {
|
struct ProcessEntryResult {
|
||||||
@@ -124,8 +113,6 @@ fn construct_process_entry(
|
|||||||
ess: &mut ConstructEssentials,
|
ess: &mut ConstructEssentials,
|
||||||
globals: &WguiGlobals,
|
globals: &WguiGlobals,
|
||||||
process: &packet_server::WvrProcess,
|
process: &packet_server::WvrProcess,
|
||||||
display: Option<&packet_server::WvrDisplay>,
|
|
||||||
all_windows: &Vec<packet_server::WvrWindow>,
|
|
||||||
) -> anyhow::Result<ProcessEntryResult> {
|
) -> anyhow::Result<ProcessEntryResult> {
|
||||||
let (cell, _) = ess.layout.add_child(
|
let (cell, _) = ess.layout.add_child(
|
||||||
ess.parent,
|
ess.parent,
|
||||||
@@ -159,7 +146,7 @@ fn construct_process_entry(
|
|||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
if let Some(desktop_file) = get_desktop_file_from_process(all_windows, process) {
|
if let Some(desktop_file) = get_desktop_file_from_process(process) {
|
||||||
// desktop file icon and process name
|
// desktop file icon and process name
|
||||||
util::various::mount_simple_sprite_square(
|
util::various::mount_simple_sprite_square(
|
||||||
globals,
|
globals,
|
||||||
@@ -185,35 +172,6 @@ fn construct_process_entry(
|
|||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(display) = display {
|
|
||||||
// show display icon if available
|
|
||||||
|
|
||||||
// "on" text
|
|
||||||
util::various::mount_simple_label(
|
|
||||||
globals,
|
|
||||||
ess.layout,
|
|
||||||
cell.id,
|
|
||||||
Translation::from_translation_key("PROCESS_LIST.LOCATED_ON"),
|
|
||||||
)?;
|
|
||||||
|
|
||||||
// "display" icon
|
|
||||||
util::various::mount_simple_sprite_square(
|
|
||||||
globals,
|
|
||||||
ess.layout,
|
|
||||||
cell.id,
|
|
||||||
24.0,
|
|
||||||
AssetPath::BuiltIn("dashboard/display.svg"),
|
|
||||||
)?;
|
|
||||||
|
|
||||||
// display name itself
|
|
||||||
util::various::mount_simple_label(
|
|
||||||
globals,
|
|
||||||
ess.layout,
|
|
||||||
cell.id,
|
|
||||||
Translation::from_raw_text_string(display.name.clone()),
|
|
||||||
)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(ProcessEntryResult { btn_terminate })
|
Ok(ProcessEntryResult { btn_terminate })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,18 +180,9 @@ fn fill_process_list(
|
|||||||
ess: &mut ConstructEssentials,
|
ess: &mut ConstructEssentials,
|
||||||
tasks: &Tasks<Task>,
|
tasks: &Tasks<Task>,
|
||||||
list: &Vec<packet_server::WvrProcess>,
|
list: &Vec<packet_server::WvrProcess>,
|
||||||
displays: &Vec<packet_server::WvrDisplay>,
|
|
||||||
all_windows: &Vec<packet_server::WvrWindow>,
|
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
for process_entry in list {
|
for process_entry in list {
|
||||||
let mut matching_display = None;
|
let entry_res = construct_process_entry(ess, globals, process_entry)?;
|
||||||
for display in displays {
|
|
||||||
if process_entry.display_handle == display.handle {
|
|
||||||
matching_display = Some(display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let entry_res = construct_process_entry(ess, globals, process_entry, matching_display, all_windows)?;
|
|
||||||
|
|
||||||
entry_res.btn_terminate.on_click({
|
entry_res.btn_terminate.on_click({
|
||||||
let tasks = tasks.clone();
|
let tasks = tasks.clone();
|
||||||
@@ -252,9 +201,6 @@ impl View {
|
|||||||
fn refresh(&mut self, layout: &mut Layout, interface: &mut BoxDashInterface) -> anyhow::Result<()> {
|
fn refresh(&mut self, layout: &mut Layout, interface: &mut BoxDashInterface) -> anyhow::Result<()> {
|
||||||
layout.remove_children(self.id_list_parent);
|
layout.remove_children(self.id_list_parent);
|
||||||
|
|
||||||
let displays = interface.display_list()?;
|
|
||||||
let all_windows = util::various::get_all_windows(interface)?;
|
|
||||||
|
|
||||||
let mut text: Option<Translation> = None;
|
let mut text: Option<Translation> = None;
|
||||||
match interface.process_list() {
|
match interface.process_list() {
|
||||||
Ok(list) => {
|
Ok(list) => {
|
||||||
@@ -269,8 +215,6 @@ impl View {
|
|||||||
},
|
},
|
||||||
&self.tasks,
|
&self.tasks,
|
||||||
&list,
|
&list,
|
||||||
&displays,
|
|
||||||
&all_windows,
|
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
use std::{cell::RefCell, rc::Rc};
|
use std::{cell::RefCell, rc::Rc};
|
||||||
|
|
||||||
use wayvr_ipc::{
|
use wayvr_ipc::packet_server::{self, WvrWindowHandle};
|
||||||
packet_client::{self},
|
|
||||||
packet_server::{self, WvrDisplayHandle},
|
|
||||||
};
|
|
||||||
use wgui::{
|
use wgui::{
|
||||||
assets::AssetPath,
|
assets::AssetPath,
|
||||||
components::{self, button::ComponentButton},
|
components::{self, button::ComponentButton},
|
||||||
@@ -24,15 +21,13 @@ use crate::{
|
|||||||
frontend::{FrontendTask, FrontendTasks},
|
frontend::{FrontendTask, FrontendTasks},
|
||||||
task::Tasks,
|
task::Tasks,
|
||||||
util::popup_manager::{MountPopupParams, PopupHandle},
|
util::popup_manager::{MountPopupParams, PopupHandle},
|
||||||
views::{add_display, display_options},
|
views::window_options,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
enum Task {
|
enum Task {
|
||||||
AddDisplay,
|
WindowClicked(packet_server::WvrWindow),
|
||||||
AddDisplayFinish(add_display::Result),
|
WindowOptionsFinish,
|
||||||
DisplayClicked(packet_server::WvrDisplay),
|
|
||||||
DisplayOptionsFinish,
|
|
||||||
Refresh,
|
Refresh,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,12 +36,11 @@ pub struct Params<'a> {
|
|||||||
pub frontend_tasks: FrontendTasks,
|
pub frontend_tasks: FrontendTasks,
|
||||||
pub layout: &'a mut Layout,
|
pub layout: &'a mut Layout,
|
||||||
pub parent_id: WidgetID,
|
pub parent_id: WidgetID,
|
||||||
pub on_click: Option<Box<dyn Fn(WvrDisplayHandle)>>,
|
pub on_click: Option<Box<dyn Fn(WvrWindowHandle)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
view_add_display: Option<(PopupHandle, add_display::View)>,
|
view_window_options: Option<(PopupHandle, window_options::View)>,
|
||||||
view_display_options: Option<(PopupHandle, display_options::View)>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct View {
|
pub struct View {
|
||||||
@@ -57,14 +51,14 @@ pub struct View {
|
|||||||
globals: WguiGlobals,
|
globals: WguiGlobals,
|
||||||
state: Rc<RefCell<State>>,
|
state: Rc<RefCell<State>>,
|
||||||
id_list_parent: WidgetID,
|
id_list_parent: WidgetID,
|
||||||
on_click: Option<Box<dyn Fn(WvrDisplayHandle)>>,
|
on_click: Option<Box<dyn Fn(WvrWindowHandle)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl View {
|
impl View {
|
||||||
pub fn new(params: Params) -> anyhow::Result<Self> {
|
pub fn new(params: Params) -> anyhow::Result<Self> {
|
||||||
let doc_params = &ParseDocumentParams {
|
let doc_params = &ParseDocumentParams {
|
||||||
globals: params.globals.clone(),
|
globals: params.globals.clone(),
|
||||||
path: AssetPath::BuiltIn("gui/view/display_list.xml"),
|
path: AssetPath::BuiltIn("gui/view/window_list.xml"),
|
||||||
extra: Default::default(),
|
extra: Default::default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -73,13 +67,10 @@ impl View {
|
|||||||
|
|
||||||
let tasks = Tasks::new();
|
let tasks = Tasks::new();
|
||||||
|
|
||||||
let btn_add = parser_state.fetch_component_as::<ComponentButton>("btn_add")?;
|
|
||||||
tasks.handle_button(btn_add, Task::AddDisplay);
|
|
||||||
tasks.push(Task::Refresh);
|
tasks.push(Task::Refresh);
|
||||||
|
|
||||||
let state = Rc::new(RefCell::new(State {
|
let state = Rc::new(RefCell::new(State {
|
||||||
view_add_display: None,
|
view_window_options: None,
|
||||||
view_display_options: None,
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
@@ -101,21 +92,15 @@ impl View {
|
|||||||
}
|
}
|
||||||
for task in tasks {
|
for task in tasks {
|
||||||
match task {
|
match task {
|
||||||
Task::AddDisplay => self.action_add_display(),
|
Task::WindowClicked(display) => self.action_window_clicked(display)?,
|
||||||
Task::AddDisplayFinish(result) => self.action_add_display_finish(interface, result)?,
|
Task::WindowOptionsFinish => self.action_window_options_finish(),
|
||||||
Task::DisplayOptionsFinish => self.action_display_options_finish(),
|
|
||||||
Task::Refresh => self.refresh(layout, interface)?,
|
Task::Refresh => self.refresh(layout, interface)?,
|
||||||
Task::DisplayClicked(display) => self.action_display_clicked(display)?,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut state = self.state.borrow_mut();
|
let mut state = self.state.borrow_mut();
|
||||||
if let Some((_, view)) = &mut state.view_add_display {
|
if let Some((_, view)) = &mut state.view_window_options {
|
||||||
view.update(layout)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some((_, view)) = &mut state.view_display_options {
|
|
||||||
view.update(layout, interface)?;
|
view.update(layout, interface)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,12 +108,13 @@ impl View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn construct_display_button(
|
pub fn construct_window_button(
|
||||||
ess: &mut ConstructEssentials,
|
ess: &mut ConstructEssentials,
|
||||||
|
interface: &mut BoxDashInterface,
|
||||||
globals: &WguiGlobals,
|
globals: &WguiGlobals,
|
||||||
display: &packet_server::WvrDisplay,
|
window: &packet_server::WvrWindow,
|
||||||
) -> anyhow::Result<(WidgetPair, Rc<ComponentButton>)> {
|
) -> anyhow::Result<(WidgetPair, Rc<ComponentButton>)> {
|
||||||
let aspect = display.width as f32 / display.height as f32;
|
let aspect = window.size_x as f32 / window.size_y as f32;
|
||||||
let height = 96.0;
|
let height = 96.0;
|
||||||
let width = height * aspect;
|
let width = height * aspect;
|
||||||
let accent_color = globals.defaults().accent_color;
|
let accent_color = globals.defaults().accent_color;
|
||||||
@@ -151,10 +137,15 @@ pub fn construct_display_button(
|
|||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
let process_name = match interface.process_get(window.process_handle.clone()) {
|
||||||
|
Some(process) => process.name.clone(),
|
||||||
|
None => String::from("Unknown"),
|
||||||
|
};
|
||||||
|
|
||||||
let label_name = WidgetLabel::create(
|
let label_name = WidgetLabel::create(
|
||||||
&mut globals.get(),
|
&mut globals.get(),
|
||||||
WidgetLabelParams {
|
WidgetLabelParams {
|
||||||
content: Translation::from_raw_text(&display.name),
|
content: Translation::from_raw_text(&process_name),
|
||||||
style: TextStyle {
|
style: TextStyle {
|
||||||
weight: Some(FontWeight::Bold),
|
weight: Some(FontWeight::Bold),
|
||||||
wrap: true,
|
wrap: true,
|
||||||
@@ -180,19 +171,20 @@ pub fn construct_display_button(
|
|||||||
Ok((widget_button, button))
|
Ok((widget_button, button))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fill_display_list(
|
fn fill_window_list(
|
||||||
globals: &WguiGlobals,
|
globals: &WguiGlobals,
|
||||||
ess: &mut ConstructEssentials,
|
ess: &mut ConstructEssentials,
|
||||||
list: Vec<packet_server::WvrDisplay>,
|
interface: &mut BoxDashInterface,
|
||||||
|
list: Vec<packet_server::WvrWindow>,
|
||||||
tasks: &Tasks<Task>,
|
tasks: &Tasks<Task>,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
for entry in list {
|
for entry in list {
|
||||||
let (_, button) = construct_display_button(ess, globals, &entry)?;
|
let (_, button) = construct_window_button(ess, interface, globals, &entry)?;
|
||||||
|
|
||||||
button.on_click({
|
button.on_click({
|
||||||
let tasks = tasks.clone();
|
let tasks = tasks.clone();
|
||||||
Box::new(move |_, _| {
|
Box::new(move |_, _| {
|
||||||
tasks.push(Task::DisplayClicked(entry.clone()));
|
tasks.push(Task::WindowClicked(entry.clone()));
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -202,55 +194,8 @@ fn fill_display_list(
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl View {
|
impl View {
|
||||||
fn action_add_display(&mut self) {
|
fn action_window_options_finish(&mut self) {
|
||||||
self.frontend_tasks.push(FrontendTask::MountPopup(MountPopupParams {
|
self.state.borrow_mut().view_window_options = None;
|
||||||
title: Translation::from_translation_key("ADD_DISPLAY"),
|
|
||||||
on_content: {
|
|
||||||
let globals = self.globals.clone();
|
|
||||||
let state = self.state.clone();
|
|
||||||
|
|
||||||
let on_submit = {
|
|
||||||
let tasks = self.tasks.clone();
|
|
||||||
Rc::new(move |result| {
|
|
||||||
tasks.push(Task::AddDisplayFinish(result));
|
|
||||||
tasks.push(Task::Refresh);
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
Rc::new(move |data| {
|
|
||||||
state.borrow_mut().view_add_display = Some((
|
|
||||||
data.handle,
|
|
||||||
add_display::View::new(add_display::Params {
|
|
||||||
globals: globals.clone(),
|
|
||||||
layout: data.layout,
|
|
||||||
parent_id: data.id_content,
|
|
||||||
on_submit: on_submit.clone(),
|
|
||||||
})?,
|
|
||||||
));
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn action_add_display_finish(
|
|
||||||
&mut self,
|
|
||||||
interface: &mut BoxDashInterface,
|
|
||||||
result: add_display::Result,
|
|
||||||
) -> anyhow::Result<()> {
|
|
||||||
interface.display_create(packet_client::WvrDisplayCreateParams {
|
|
||||||
width: result.width,
|
|
||||||
height: result.height,
|
|
||||||
name: result.display_name,
|
|
||||||
attach_to: packet_client::AttachTo::None,
|
|
||||||
scale: None,
|
|
||||||
})?;
|
|
||||||
self.state.borrow_mut().view_add_display = None;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn action_display_options_finish(&mut self) {
|
|
||||||
self.state.borrow_mut().view_display_options = None;
|
|
||||||
self.tasks.push(Task::Refresh);
|
self.tasks.push(Task::Refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,17 +203,18 @@ impl View {
|
|||||||
layout.remove_children(self.id_list_parent);
|
layout.remove_children(self.id_list_parent);
|
||||||
|
|
||||||
let mut text: Option<Translation> = None;
|
let mut text: Option<Translation> = None;
|
||||||
match interface.display_list() {
|
match interface.window_list() {
|
||||||
Ok(list) => {
|
Ok(list) => {
|
||||||
if list.is_empty() {
|
if list.is_empty() {
|
||||||
text = Some(Translation::from_translation_key("NO_DISPLAYS_FOUND"))
|
text = Some(Translation::from_translation_key("NO_WINDOWS_FOUND"))
|
||||||
} else {
|
} else {
|
||||||
fill_display_list(
|
fill_window_list(
|
||||||
&self.globals,
|
&self.globals,
|
||||||
&mut ConstructEssentials {
|
&mut ConstructEssentials {
|
||||||
layout,
|
layout,
|
||||||
parent: self.id_list_parent,
|
parent: self.id_list_parent,
|
||||||
},
|
},
|
||||||
|
interface,
|
||||||
list,
|
list,
|
||||||
&self.tasks,
|
&self.tasks,
|
||||||
)?
|
)?
|
||||||
@@ -294,12 +240,12 @@ impl View {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn action_display_clicked(&mut self, display: packet_server::WvrDisplay) -> anyhow::Result<()> {
|
fn action_window_clicked(&mut self, window: packet_server::WvrWindow) -> anyhow::Result<()> {
|
||||||
if let Some(on_click) = &mut self.on_click {
|
if let Some(on_click) = &mut self.on_click {
|
||||||
(*on_click)(display.handle);
|
(*on_click)(window.handle);
|
||||||
} else {
|
} else {
|
||||||
self.frontend_tasks.push(FrontendTask::MountPopup(MountPopupParams {
|
self.frontend_tasks.push(FrontendTask::MountPopup(MountPopupParams {
|
||||||
title: Translation::from_translation_key("DISPLAY_OPTIONS"),
|
title: Translation::from_translation_key("WINDOW_OPTIONS"),
|
||||||
on_content: {
|
on_content: {
|
||||||
let frontend_tasks = self.frontend_tasks.clone();
|
let frontend_tasks = self.frontend_tasks.clone();
|
||||||
let globals = self.globals.clone();
|
let globals = self.globals.clone();
|
||||||
@@ -307,15 +253,16 @@ impl View {
|
|||||||
let tasks = self.tasks.clone();
|
let tasks = self.tasks.clone();
|
||||||
|
|
||||||
Rc::new(move |data| {
|
Rc::new(move |data| {
|
||||||
state.borrow_mut().view_display_options = Some((
|
state.borrow_mut().view_window_options = Some((
|
||||||
data.handle,
|
data.handle,
|
||||||
display_options::View::new(display_options::Params {
|
window_options::View::new(window_options::Params {
|
||||||
globals: globals.clone(),
|
globals: globals.clone(),
|
||||||
layout: data.layout,
|
layout: data.layout,
|
||||||
parent_id: data.id_content,
|
parent_id: data.id_content,
|
||||||
on_submit: tasks.make_callback(Task::DisplayOptionsFinish),
|
on_submit: tasks.make_callback(Task::WindowOptionsFinish),
|
||||||
display: display.clone(),
|
window: window.clone(),
|
||||||
frontend_tasks: frontend_tasks.clone(),
|
frontend_tasks: frontend_tasks.clone(),
|
||||||
|
interface: data.interface,
|
||||||
})?,
|
})?,
|
||||||
));
|
));
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use anyhow::Context;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use wayvr_ipc::packet_server;
|
use wayvr_ipc::packet_server;
|
||||||
use wgui::{
|
use wgui::{
|
||||||
@@ -14,13 +15,14 @@ use wlx_common::dash_interface::BoxDashInterface;
|
|||||||
use crate::{
|
use crate::{
|
||||||
frontend::{FrontendTask, FrontendTasks},
|
frontend::{FrontendTask, FrontendTasks},
|
||||||
task::Tasks,
|
task::Tasks,
|
||||||
views::display_list::construct_display_button,
|
views::window_list::construct_window_button,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
enum Task {
|
enum Task {
|
||||||
SetVisible(bool),
|
SetVisible(bool),
|
||||||
Remove,
|
Kill,
|
||||||
|
Close,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct View {
|
pub struct View {
|
||||||
@@ -28,7 +30,7 @@ pub struct View {
|
|||||||
pub state: ParserState,
|
pub state: ParserState,
|
||||||
tasks: Tasks<Task>,
|
tasks: Tasks<Task>,
|
||||||
frontend_tasks: FrontendTasks,
|
frontend_tasks: FrontendTasks,
|
||||||
display: packet_server::WvrDisplay,
|
window: packet_server::WvrWindow,
|
||||||
on_submit: Rc<dyn Fn()>,
|
on_submit: Rc<dyn Fn()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,14 +40,15 @@ pub struct Params<'a> {
|
|||||||
pub layout: &'a mut Layout,
|
pub layout: &'a mut Layout,
|
||||||
pub parent_id: WidgetID,
|
pub parent_id: WidgetID,
|
||||||
pub on_submit: Rc<dyn Fn()>,
|
pub on_submit: Rc<dyn Fn()>,
|
||||||
pub display: packet_server::WvrDisplay,
|
pub window: packet_server::WvrWindow,
|
||||||
|
pub interface: &'a mut BoxDashInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl View {
|
impl View {
|
||||||
pub fn new(params: Params) -> anyhow::Result<Self> {
|
pub fn new(params: Params) -> anyhow::Result<Self> {
|
||||||
let doc_params = &ParseDocumentParams {
|
let doc_params = &ParseDocumentParams {
|
||||||
globals: params.globals.clone(),
|
globals: params.globals.clone(),
|
||||||
path: AssetPath::BuiltIn("gui/view/display_options.xml"),
|
path: AssetPath::BuiltIn("gui/view/window_options.xml"),
|
||||||
extra: Default::default(),
|
extra: Default::default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,35 +56,38 @@ impl View {
|
|||||||
|
|
||||||
let tasks = Tasks::new();
|
let tasks = Tasks::new();
|
||||||
|
|
||||||
let display_parent = state.get_widget_id("display_parent")?;
|
let window_parent = state.get_widget_id("window_parent")?;
|
||||||
let btn_remove = state.fetch_component_as::<ComponentButton>("btn_remove")?;
|
let btn_close = state.fetch_component_as::<ComponentButton>("btn_close")?;
|
||||||
|
let btn_kill = state.fetch_component_as::<ComponentButton>("btn_kill")?;
|
||||||
let btn_show_hide = state.fetch_component_as::<ComponentButton>("btn_show_hide")?;
|
let btn_show_hide = state.fetch_component_as::<ComponentButton>("btn_show_hide")?;
|
||||||
|
|
||||||
construct_display_button(
|
construct_window_button(
|
||||||
&mut ConstructEssentials {
|
&mut ConstructEssentials {
|
||||||
layout: params.layout,
|
layout: params.layout,
|
||||||
parent: display_parent,
|
parent: window_parent,
|
||||||
},
|
},
|
||||||
|
params.interface,
|
||||||
¶ms.globals,
|
¶ms.globals,
|
||||||
¶ms.display,
|
¶ms.window,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut c = params.layout.start_common();
|
let mut c = params.layout.start_common();
|
||||||
btn_show_hide.set_text(
|
btn_show_hide.set_text(
|
||||||
&mut c.common(),
|
&mut c.common(),
|
||||||
Translation::from_translation_key(if params.display.visible { "HIDE" } else { "SHOW" }),
|
Translation::from_translation_key(if params.window.visible { "HIDE" } else { "SHOW" }),
|
||||||
);
|
);
|
||||||
c.finish()?;
|
c.finish()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.handle_button(btn_remove, Task::Remove);
|
tasks.handle_button(btn_close, Task::Close);
|
||||||
tasks.handle_button(btn_show_hide, Task::SetVisible(!params.display.visible));
|
tasks.handle_button(btn_kill, Task::Kill);
|
||||||
|
tasks.handle_button(btn_show_hide, Task::SetVisible(!params.window.visible));
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
state,
|
state,
|
||||||
tasks,
|
tasks,
|
||||||
display: params.display,
|
window: params.window,
|
||||||
frontend_tasks: params.frontend_tasks,
|
frontend_tasks: params.frontend_tasks,
|
||||||
on_submit: params.on_submit,
|
on_submit: params.on_submit,
|
||||||
})
|
})
|
||||||
@@ -91,7 +97,8 @@ impl View {
|
|||||||
for task in self.tasks.drain() {
|
for task in self.tasks.drain() {
|
||||||
match task {
|
match task {
|
||||||
Task::SetVisible(v) => self.action_set_visible(interface, v),
|
Task::SetVisible(v) => self.action_set_visible(interface, v),
|
||||||
Task::Remove => self.action_remove(interface),
|
Task::Close => self.action_close(interface),
|
||||||
|
Task::Kill => self.action_kill(interface),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -100,11 +107,11 @@ impl View {
|
|||||||
|
|
||||||
impl View {
|
impl View {
|
||||||
fn action_set_visible(&mut self, interface: &mut BoxDashInterface, visible: bool) {
|
fn action_set_visible(&mut self, interface: &mut BoxDashInterface, visible: bool) {
|
||||||
if let Err(e) = interface.display_set_visible(self.display.handle.clone(), visible) {
|
if let Err(e) = interface.window_set_visible(self.window.handle.clone(), visible) {
|
||||||
self
|
self
|
||||||
.frontend_tasks
|
.frontend_tasks
|
||||||
.push(FrontendTask::PushToast(Translation::from_raw_text_string(format!(
|
.push(FrontendTask::PushToast(Translation::from_raw_text_string(format!(
|
||||||
"Failed to remove display: {:?}",
|
"Failed to set window visibility: {:?}",
|
||||||
e
|
e
|
||||||
))));
|
))));
|
||||||
};
|
};
|
||||||
@@ -112,12 +119,33 @@ impl View {
|
|||||||
(*self.on_submit)();
|
(*self.on_submit)();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn action_remove(&mut self, interface: &mut BoxDashInterface) {
|
fn action_close(&mut self, interface: &mut BoxDashInterface) {
|
||||||
if let Err(e) = interface.display_remove(self.display.handle.clone()) {
|
if let Err(e) = interface.window_request_close(self.window.handle.clone()) {
|
||||||
self
|
self
|
||||||
.frontend_tasks
|
.frontend_tasks
|
||||||
.push(FrontendTask::PushToast(Translation::from_raw_text_string(format!(
|
.push(FrontendTask::PushToast(Translation::from_raw_text_string(format!(
|
||||||
"Failed to remove display: {:?}",
|
"Failed to close window: {:?}",
|
||||||
|
e
|
||||||
|
))));
|
||||||
|
};
|
||||||
|
|
||||||
|
(*self.on_submit)();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn action_kill_process(&mut self, interface: &mut BoxDashInterface) -> anyhow::Result<()> {
|
||||||
|
let process = interface
|
||||||
|
.process_get(self.window.process_handle.clone())
|
||||||
|
.context("Process not found")?;
|
||||||
|
interface.process_terminate(process.handle)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn action_kill(&mut self, interface: &mut BoxDashInterface) {
|
||||||
|
if let Err(e) = self.action_kill_process(interface) {
|
||||||
|
self
|
||||||
|
.frontend_tasks
|
||||||
|
.push(FrontendTask::PushToast(Translation::from_raw_text_string(format!(
|
||||||
|
"Failed to kill process: {:?}",
|
||||||
e
|
e
|
||||||
))));
|
))));
|
||||||
};
|
};
|
||||||
@@ -10,5 +10,5 @@ glam = { workspace = true }
|
|||||||
chrono = "0.4.42"
|
chrono = "0.4.42"
|
||||||
idmap = { workspace = true, features = ["serde"] }
|
idmap = { workspace = true, features = ["serde"] }
|
||||||
idmap-derive = { workspace = true }
|
idmap-derive = { workspace = true }
|
||||||
wayvr_ipc = { workspace = true }
|
wayvr-ipc = { path = "../wayvr-ipc", default-features = false }
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
|
|||||||
@@ -1,27 +1,16 @@
|
|||||||
use wayvr_ipc::{
|
use wayvr_ipc::{
|
||||||
packet_client::{WvrDisplayCreateParams, WvrProcessLaunchParams},
|
packet_client::WvrProcessLaunchParams,
|
||||||
packet_server::{
|
packet_server::{WvrProcess, WvrProcessHandle, WvrWindow, WvrWindowHandle},
|
||||||
WvrDisplay, WvrDisplayHandle, WvrDisplayWindowLayout, WvrProcess, WvrProcessHandle, WvrWindow, WvrWindowHandle,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait DashInterface {
|
pub trait DashInterface {
|
||||||
fn display_create(&mut self, params: WvrDisplayCreateParams) -> anyhow::Result<WvrDisplayHandle>;
|
fn window_list(&mut self) -> anyhow::Result<Vec<WvrWindow>>;
|
||||||
fn display_get(&mut self, handle: WvrDisplayHandle) -> Option<WvrDisplay>;
|
fn window_set_visible(&mut self, handle: WvrWindowHandle, visible: bool) -> anyhow::Result<()>;
|
||||||
fn display_list(&mut self) -> anyhow::Result<Vec<WvrDisplay>>;
|
fn window_request_close(&mut self, handle: WvrWindowHandle) -> anyhow::Result<()>;
|
||||||
fn display_remove(&mut self, handle: WvrDisplayHandle) -> anyhow::Result<()>;
|
|
||||||
fn display_set_visible(&mut self, handle: WvrDisplayHandle, visible: bool) -> anyhow::Result<()>;
|
|
||||||
fn display_set_window_layout(
|
|
||||||
&mut self,
|
|
||||||
handle: WvrDisplayHandle,
|
|
||||||
layout: WvrDisplayWindowLayout,
|
|
||||||
) -> anyhow::Result<()>;
|
|
||||||
fn display_window_list(&mut self, handle: WvrDisplayHandle) -> anyhow::Result<Vec<WvrWindow>>;
|
|
||||||
fn process_get(&mut self, handle: WvrProcessHandle) -> Option<WvrProcess>;
|
fn process_get(&mut self, handle: WvrProcessHandle) -> Option<WvrProcess>;
|
||||||
fn process_launch(&mut self, params: WvrProcessLaunchParams) -> anyhow::Result<WvrProcessHandle>;
|
fn process_launch(&mut self, params: WvrProcessLaunchParams) -> anyhow::Result<WvrProcessHandle>;
|
||||||
fn process_list(&mut self) -> anyhow::Result<Vec<WvrProcess>>;
|
fn process_list(&mut self) -> anyhow::Result<Vec<WvrProcess>>;
|
||||||
fn process_terminate(&mut self, handle: WvrProcessHandle) -> anyhow::Result<()>;
|
fn process_terminate(&mut self, handle: WvrProcessHandle) -> anyhow::Result<()>;
|
||||||
fn window_set_visible(&mut self, handle: WvrWindowHandle, visible: bool) -> anyhow::Result<()>;
|
|
||||||
fn recenter_playspace(&mut self) -> anyhow::Result<()>;
|
fn recenter_playspace(&mut self) -> anyhow::Result<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,18 @@
|
|||||||
use wayvr_ipc::{
|
use wayvr_ipc::{
|
||||||
packet_client::{WvrDisplayCreateParams, WvrProcessLaunchParams},
|
packet_client::WvrProcessLaunchParams,
|
||||||
packet_server::{
|
packet_server::{WvrProcess, WvrProcessHandle, WvrWindow, WvrWindowHandle},
|
||||||
WvrDisplay, WvrDisplayHandle, WvrDisplayWindowLayout, WvrProcess, WvrProcessHandle, WvrWindow, WvrWindowHandle,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{dash_interface::DashInterface, gen_id};
|
use crate::{dash_interface::DashInterface, gen_id};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct EmuProcess {
|
pub struct EmuProcess {
|
||||||
display_handle: WvrDisplayHandle,
|
|
||||||
name: String,
|
name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EmuProcess {
|
impl EmuProcess {
|
||||||
fn to(&self, handle: EmuProcessHandle) -> WvrProcess {
|
fn to(&self, handle: EmuProcessHandle) -> WvrProcess {
|
||||||
WvrProcess {
|
WvrProcess {
|
||||||
display_handle: self.display_handle.clone(),
|
|
||||||
handle: WvrProcessHandle {
|
handle: WvrProcessHandle {
|
||||||
generation: handle.generation,
|
generation: handle.generation,
|
||||||
idx: handle.idx,
|
idx: handle.idx,
|
||||||
@@ -28,58 +24,52 @@ impl EmuProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct EmuDisplay {
|
pub struct EmuWindow {
|
||||||
width: u16,
|
|
||||||
height: u16,
|
|
||||||
name: String,
|
|
||||||
visible: bool,
|
visible: bool,
|
||||||
layout: WvrDisplayWindowLayout,
|
process_handle: EmuProcessHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EmuDisplay {
|
impl EmuWindow {
|
||||||
fn to(&self, handle: EmuDisplayHandle) -> WvrDisplay {
|
fn to(&self, handle: EmuWindowHandle) -> WvrWindow {
|
||||||
WvrDisplay {
|
WvrWindow {
|
||||||
width: self.width,
|
size_x: 1280, /* stub */
|
||||||
height: self.height,
|
size_y: 720, /* stub */
|
||||||
name: self.name.clone(),
|
visible: true,
|
||||||
visible: self.visible,
|
handle: WvrWindowHandle {
|
||||||
handle: WvrDisplayHandle {
|
|
||||||
generation: handle.generation,
|
generation: handle.generation,
|
||||||
idx: handle.idx,
|
idx: handle.idx,
|
||||||
},
|
},
|
||||||
|
process_handle: WvrProcessHandle {
|
||||||
|
generation: self.process_handle.generation,
|
||||||
|
idx: self.process_handle.idx,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_id!(EmuDisplayVec, EmuDisplay, EmuDisplayCell, EmuDisplayHandle);
|
gen_id!(EmuWindowVec, EmuWindow, EmuWindowCell, EmuWindowHandle);
|
||||||
|
|
||||||
gen_id!(EmuProcessVec, EmuProcess, EmuProcessCell, EmuProcessHandle);
|
gen_id!(EmuProcessVec, EmuProcess, EmuProcessCell, EmuProcessHandle);
|
||||||
|
|
||||||
pub struct DashInterfaceEmulated {
|
pub struct DashInterfaceEmulated {
|
||||||
displays: EmuDisplayVec,
|
|
||||||
processes: EmuProcessVec,
|
processes: EmuProcessVec,
|
||||||
|
windows: EmuWindowVec,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DashInterfaceEmulated {
|
impl DashInterfaceEmulated {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut displays = EmuDisplayVec::new();
|
let mut processes = EmuProcessVec::new();
|
||||||
let disp_handle = displays.add(EmuDisplay {
|
let process_handle = processes.add(EmuProcess {
|
||||||
width: 1280,
|
name: String::from("My app"),
|
||||||
height: 720,
|
});
|
||||||
layout: WvrDisplayWindowLayout::Tiling,
|
|
||||||
name: String::from("Emulated display"),
|
let mut windows = EmuWindowVec::new();
|
||||||
|
windows.add(EmuWindow {
|
||||||
|
process_handle,
|
||||||
visible: true,
|
visible: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut processes = EmuProcessVec::new();
|
Self { processes, windows }
|
||||||
processes.add(EmuProcess {
|
|
||||||
display_handle: WvrDisplayHandle {
|
|
||||||
idx: disp_handle.idx,
|
|
||||||
generation: disp_handle.generation,
|
|
||||||
},
|
|
||||||
name: String::from("Emulated process"),
|
|
||||||
});
|
|
||||||
|
|
||||||
Self { displays, processes }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,86 +80,31 @@ impl Default for DashInterfaceEmulated {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl DashInterface for DashInterfaceEmulated {
|
impl DashInterface for DashInterfaceEmulated {
|
||||||
fn display_create(&mut self, params: WvrDisplayCreateParams) -> anyhow::Result<WvrDisplayHandle> {
|
fn window_list(&mut self) -> anyhow::Result<Vec<WvrWindow>> {
|
||||||
let res = self.displays.add(EmuDisplay {
|
Ok(self.windows.iter().map(|(handle, w)| w.to(handle)).collect())
|
||||||
width: params.width,
|
}
|
||||||
height: params.height,
|
|
||||||
name: params.name,
|
fn window_request_close(&mut self, handle: WvrWindowHandle) -> anyhow::Result<()> {
|
||||||
visible: true,
|
self.windows.remove(&EmuWindowHandle {
|
||||||
layout: WvrDisplayWindowLayout::Tiling,
|
generation: handle.generation,
|
||||||
|
idx: handle.idx,
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(WvrDisplayHandle {
|
|
||||||
generation: res.generation,
|
|
||||||
idx: res.idx,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn display_get(&mut self, handle: WvrDisplayHandle) -> Option<WvrDisplay> {
|
|
||||||
let emu_handle = EmuDisplayHandle::new(handle.idx, handle.generation);
|
|
||||||
self.displays.get(&emu_handle).map(|disp| disp.to(emu_handle))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn display_list(&mut self) -> anyhow::Result<Vec<WvrDisplay>> {
|
|
||||||
Ok(self.displays.iter().map(|(handle, disp)| disp.to(handle)).collect())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn display_remove(&mut self, wvr_handle: WvrDisplayHandle) -> anyhow::Result<()> {
|
|
||||||
let handle = EmuDisplayHandle::new(wvr_handle.idx, wvr_handle.generation);
|
|
||||||
|
|
||||||
for (_, process) in self.processes.iter() {
|
|
||||||
if process.display_handle == wvr_handle {
|
|
||||||
anyhow::bail!("Cannot remove display: stop {} process first.", process.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.displays.remove(&handle);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_set_visible(&mut self, handle: WvrDisplayHandle, visible: bool) -> anyhow::Result<()> {
|
|
||||||
let Some(disp) = self
|
|
||||||
.displays
|
|
||||||
.get_mut(&EmuDisplayHandle::new(handle.idx, handle.generation))
|
|
||||||
else {
|
|
||||||
anyhow::bail!("Display not found");
|
|
||||||
};
|
|
||||||
|
|
||||||
disp.visible = visible;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn display_set_window_layout(
|
|
||||||
&mut self,
|
|
||||||
handle: WvrDisplayHandle,
|
|
||||||
layout: WvrDisplayWindowLayout,
|
|
||||||
) -> anyhow::Result<()> {
|
|
||||||
let Some(disp) = self
|
|
||||||
.displays
|
|
||||||
.get_mut(&EmuDisplayHandle::new(handle.idx, handle.generation))
|
|
||||||
else {
|
|
||||||
anyhow::bail!("Display not found");
|
|
||||||
};
|
|
||||||
|
|
||||||
disp.layout = layout;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn display_window_list(&mut self, _handle: WvrDisplayHandle) -> anyhow::Result<Vec<WvrWindow>> {
|
|
||||||
// stub!
|
|
||||||
Ok(Vec::new())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn process_get(&mut self, handle: WvrProcessHandle) -> Option<WvrProcess> {
|
fn process_get(&mut self, handle: WvrProcessHandle) -> Option<WvrProcess> {
|
||||||
let emu_handle = EmuProcessHandle::new(handle.idx, handle.generation);
|
let emu_handle = EmuProcessHandle::new(handle.idx, handle.generation);
|
||||||
self.processes.get(&emu_handle).map(|process| process.to(emu_handle))
|
self.processes.get(&emu_handle).map(|process| process.to(emu_handle))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process_launch(&mut self, params: WvrProcessLaunchParams) -> anyhow::Result<WvrProcessHandle> {
|
fn process_launch(&mut self, params: WvrProcessLaunchParams) -> anyhow::Result<WvrProcessHandle> {
|
||||||
let res = self.processes.add(EmuProcess {
|
let res = self.processes.add(EmuProcess { name: params.name });
|
||||||
display_handle: params.target_display,
|
|
||||||
name: params.name,
|
self.windows.add(EmuWindow {
|
||||||
|
process_handle: res,
|
||||||
|
visible: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(WvrProcessHandle {
|
Ok(WvrProcessHandle {
|
||||||
generation: res.generation,
|
generation: res.generation,
|
||||||
idx: res.idx,
|
idx: res.idx,
|
||||||
@@ -187,15 +122,35 @@ impl DashInterface for DashInterfaceEmulated {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn process_terminate(&mut self, handle: WvrProcessHandle) -> anyhow::Result<()> {
|
fn process_terminate(&mut self, handle: WvrProcessHandle) -> anyhow::Result<()> {
|
||||||
|
let mut to_remove = None;
|
||||||
|
|
||||||
|
for (wh, w) in self.windows.iter() {
|
||||||
|
if w.process_handle == EmuProcessHandle::new(handle.idx, handle.generation) {
|
||||||
|
to_remove = Some(wh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(wh) = to_remove {
|
||||||
|
self.windows.remove(&wh);
|
||||||
|
}
|
||||||
|
|
||||||
self
|
self
|
||||||
.processes
|
.processes
|
||||||
.remove(&EmuProcessHandle::new(handle.idx, handle.generation));
|
.remove(&EmuProcessHandle::new(handle.idx, handle.generation));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn window_set_visible(&mut self, _handle: WvrWindowHandle, _visible: bool) -> anyhow::Result<()> {
|
fn window_set_visible(&mut self, handle: WvrWindowHandle, visible: bool) -> anyhow::Result<()> {
|
||||||
// stub!
|
match self.windows.get_mut(&EmuWindowHandle {
|
||||||
Ok(())
|
generation: handle.generation,
|
||||||
|
idx: handle.idx,
|
||||||
|
}) {
|
||||||
|
Some(w) => {
|
||||||
|
w.visible = visible;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
None => anyhow::bail!("Window not found"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn recenter_playspace(&mut self) -> anyhow::Result<()> {
|
fn recenter_playspace(&mut self) -> anyhow::Result<()> {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ tracing = "0.1.43"
|
|||||||
vulkano = { workspace = true }
|
vulkano = { workspace = true }
|
||||||
vulkano-shaders = { workspace = true }
|
vulkano-shaders = { workspace = true }
|
||||||
wgui = { path = "../wgui" }
|
wgui = { path = "../wgui" }
|
||||||
wayvr_ipc = { workspace = true }
|
wayvr-ipc = { path = "../wayvr-ipc", default-features = false }
|
||||||
bytes = { version = "1.11.0" }
|
bytes = { version = "1.11.0" }
|
||||||
|
|
||||||
################################
|
################################
|
||||||
|
|||||||
Reference in New Issue
Block a user