Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
orbclient
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
8
Issues
8
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
redox-os
orbclient
Commits
e0fbf91e
Commit
e0fbf91e
authored
Mar 02, 2021
by
Florian Blasius
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web: refactoring
parent
5e5c6244
Pipeline
#9142
passed with stage
in 1 minute and 15 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
8 deletions
+29
-8
Cargo.toml
Cargo.toml
+2
-0
src/sys/web.rs
src/sys/web.rs
+27
-8
No files found.
Cargo.toml
View file @
e0fbf91e
...
...
@@ -50,6 +50,8 @@ features = [
"FocusEvent"
,
"DragEvent"
,
"DataTransfer"
,
"Navigator"
,
"Clipboard"
,
"DomRect"
]
...
...
src/sys/web.rs
View file @
e0fbf91e
...
...
@@ -197,10 +197,13 @@ impl Window {
// }
pub
fn
clipboard
(
&
self
)
->
String
{
log
(
"clipboard not yet implemented for web"
);
String
::
default
()
}
pub
fn
set_clipboard
(
&
mut
self
,
text
:
&
str
)
{}
pub
fn
set_clipboard
(
&
mut
self
,
_
text
:
&
str
)
{
log
(
"set_clipboard not yet implemented for web"
);
}
/// Pops the content of the last drop event from the window.
pub
fn
pop_drop_content
(
&
self
)
->
Option
<
String
>
{
...
...
@@ -210,16 +213,22 @@ impl Window {
result
}
pub
fn
sync_path
(
&
mut
self
)
{}
pub
fn
sync_path
(
&
mut
self
)
{
self
.x
=
self
.canvas
.offset_left
();
self
.y
=
self
.canvas
.offset_top
();
self
.w
=
self
.canvas
.width
();
self
.h
=
self
.canvas
.height
();
if
let
Ok
(
document
)
=
document
()
{
self
.t
=
document
.title
();
}
}
/// Get x
// TODO: Sync with window movements
pub
fn
x
(
&
self
)
->
i32
{
self
.x
}
/// Get y
// TODO: Sync with window movements
pub
fn
y
(
&
self
)
->
i32
{
self
.y
}
...
...
@@ -250,8 +259,6 @@ impl Window {
/// Set position
pub
fn
set_pos
(
&
mut
self
,
x
:
i32
,
y
:
i32
)
{
self
.x
=
x
;
self
.y
=
y
;
self
.canvas
.style
()
.set_property
(
"left"
,
x
.to_string
()
.as_str
())
...
...
@@ -260,14 +267,16 @@ impl Window {
.style
()
.set_property
(
"top"
,
y
.to_string
()
.as_str
())
.unwrap
();
self
.sync_path
();
}
/// Set size
pub
fn
set_size
(
&
mut
self
,
width
:
u32
,
height
:
u32
)
{
self
.w
=
width
;
self
.h
=
height
;
self
.canvas
.set_width
(
width
);
self
.canvas
.set_height
(
height
);
self
.sync_path
();
}
/// Set title
...
...
@@ -275,6 +284,7 @@ impl Window {
if
let
Ok
(
document
)
=
document
()
{
document
.set_title
(
title
);
}
self
.sync_path
();
}
/// Blocking iterator over events
...
...
@@ -285,7 +295,12 @@ impl Window {
count
:
0
,
};
let
mut
sync_path
=
false
;
for
event
in
self
.events
.borrow_mut
()
.pop
()
{
match
event
.code
{
EVENT_RESIZE
|
EVENT_MOVE
=>
sync_path
=
true
,
_
=>
{}
}
if
iter
.count
<
iter
.events
.len
()
{
iter
.events
[
iter
.count
]
=
event
;
iter
.count
+=
1
;
...
...
@@ -294,6 +309,10 @@ impl Window {
}
}
if
sync_path
{
self
.sync_path
();
}
iter
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment