mirror of
https://github.com/jwinterm/grim.git
synced 2026-11-22 13:43:57 +01:00
build: fix build for desktop
This commit is contained in:
@@ -12,13 +12,37 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::gui::PlatformApp;
|
||||
use crate::gui::{App, PlatformApp};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Desktop;
|
||||
|
||||
impl PlatformCallbacks for Desktop {
|
||||
fn show_keyboard(&self) {}
|
||||
|
||||
fn hide_keyboard(&self) {}
|
||||
|
||||
fn copy_string_to_buffer(&self, data: String) {}
|
||||
|
||||
fn get_string_from_buffer(&self) -> String {
|
||||
"".to_string()
|
||||
}
|
||||
|
||||
fn exit(&self) {}
|
||||
}
|
||||
|
||||
impl PlatformApp<Desktop> {
|
||||
pub fn new(cc: &eframe::CreationContext<'_>) -> Self {
|
||||
Self::default()
|
||||
pub fn new(platform: Desktop) -> Self {
|
||||
Self {
|
||||
app: App::default(),
|
||||
platform,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl eframe::App for PlatformApp<Desktop> {
|
||||
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
||||
self.app.ui(ctx, frame, &self.platform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub use self::platform::*;
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
@@ -18,7 +19,7 @@ pub use self::platform::*;
|
||||
pub mod platform;
|
||||
#[cfg(not(target_os = "android"))]
|
||||
#[path = "desktop/mod.rs"]
|
||||
pub mod app;
|
||||
pub mod platform;
|
||||
|
||||
pub trait PlatformCallbacks {
|
||||
fn show_keyboard(&self);
|
||||
|
||||
Reference in New Issue
Block a user