Skip to content

Commit

Permalink
Resize and Move works, but is ALOT slower than a16f222.
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Printzell <[email protected]>
  • Loading branch information
Vild committed Jan 19, 2016
1 parent 0d40670 commit edbfc43
Show file tree
Hide file tree
Showing 17 changed files with 727 additions and 410 deletions.
271 changes: 95 additions & 176 deletions Class Hierarchy.dia

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ int main(string[] args) {
string size = "1920x1080";

/*
rules: evdev
model: pc105
layout: se
options: terminate:ctrl_alt_bksp
rules: evdev
model: pc105
layout: se
options: terminate:ctrl_alt_bksp
-keybd ephyr,,,xkbmodel=pc105,xkblayout=se,xkbrules=evdev,xkboption=terminate:ctrl_alt_bksp
*/
-keybd ephyr,,,xkbmodel=pc105,xkblayout=se,xkbrules=evdev,xkboption=terminate:ctrl_alt_bksp
*/

auto Xephyr = spawnProcess([`Xephyr`, `-keybd`, `ephyr,,,xkbmodel=pc105,xkblayout=se,xkbrules=evdev,xkboption=`,
`-name`, title, `-ac`, `-br`, `-noreset`, `-screen`, size, `:8`]);
`-name`, title, `-ac`, `-br`, `-noreset`, `-screen`, size, `:8`]);
scope (exit)
kill(Xephyr);

Expand Down
52 changes: 52 additions & 0 deletions source/dwin/backend/container.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,62 @@ public:
abstract void Move(short x, short y);
abstract void Resize(ushort width, ushort height);

abstract void Update();
abstract void Focus();

@property ref Layout Parent() {
return parent;
}

@property ref bool Dead() {
return dead;
}

@property short X() {
return x;
}

@property short X(short x) {
this.x = x;
Move(x, y);
return this.x;
}

@property short Y() {
return y;
}

@property short Y(short y) {
this.y = y;
Move(x, y);
return this.y;
}

@property ushort Width() {
return width;
}

@property ushort Width(ushort width) {
this.width = width;
Resize(width, height);
return this.width;
}

@property ushort Height() {
return height;
}

@property ushort Height(ushort height) {
this.height = height;
Resize(width, height);
return this.height;
}

protected:
Layout parent;
bool dead;
short x;
short y;
ushort width;
ushort height;
}
53 changes: 11 additions & 42 deletions source/dwin/backend/layout.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module dwin.backend.layout;
import std.container.array;
import std.algorithm.searching;
import dwin.backend.container;
import dwin.backend.mouse;

enum LayoutType {
Float,
Expand All @@ -23,64 +24,32 @@ public:
containers.linearRemove(containers[idx .. idx + 1]);
}

override void Move(short x, short y) {
this.x = x;
this.y = y;
}
abstract void MouseMovePressed(Container target, Mouse mouse);
abstract void MouseResizeReleased(Container target, Mouse mouse);
abstract void MouseMoveReleased(Container target, Mouse mouse);
abstract void MouseResizePressed(Container target, Mouse mouse);
abstract void MouseMotion(Container target, Mouse mouse);

override void Resize(ushort width, ushort height) {
this.width = width;
this.height = height;
}

@property short X() {
return x;
override void Update() {
}

@property short X(short x) {
override void Move(short x, short y) {
this.x = x;
Move(x, y);
return this.x;
}

@property short Y() {
return y;
}

@property short Y(short y) {
this.y = y;
Move(x, y);
return this.y;
}

@property ushort Width() {
return width;
}

@property ushort Width(ushort width) {
override void Resize(ushort width, ushort height) {
this.width = width;
Resize(width, height);
return this.width;
}

@property ushort Height() {
return height;
this.height = height;
}

@property ushort Height(ushort height) {
this.height = height;
Resize(width, height);
return this.height;
override void Focus() {
}

@property Array!Container Containers() {
return containers;
}

protected:
short x;
short y;
ushort width;
ushort height;
Array!Container containers;
}
62 changes: 62 additions & 0 deletions source/dwin/backend/mouse.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module dwin.backend.mouse;

import dwin.backend.mousestyle;

enum MouseStyles {
Normal,
Resizing,
Moving
}

abstract class Mouse {
public:
abstract void Update();
abstract void Move(short x, short y);

/// This will _NOT_ update the real position of the mouse
void Set(short x, short y) {
this.x = x;
this.y = y;
}

@property short X(short x) {
this.x = x;
Move(x, y);
return this.x;
}

@property short X() {
return this.x;
}

@property short Y(short y) {
this.y = y;
Move(x, y);
return this.y;
}

@property short Y() {
return this.y;
}

@property bool[5] Buttons() {
return buttons;
}

@property void Style(MouseStyles style) {
styles[style].Apply();
}

override string toString() {
import std.format : format;

return format("Mouse[X: %s, Y: %s, Buttons: '%(%s, %)']", x, y, buttons);
}

protected:
short x;
short y;
bool[5] buttons;

MouseStyle[MouseStyles.max + 1] styles;
}
5 changes: 5 additions & 0 deletions source/dwin/backend/mousestyle.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module dwin.backend.mousestyle;

abstract class MouseStyle {
abstract void Apply();
}
54 changes: 2 additions & 52 deletions source/dwin/backend/window.d
Original file line number Diff line number Diff line change
Expand Up @@ -16,62 +16,12 @@ public:
parent.Remove(container);
}

abstract void Update();
//abstract void Update();
//abstract void Move(short x, short y);
//abstract void Resize(ushort width, ushort height);
abstract void Show();
abstract void Hide();
//abstract void Focus();

@property abstract string Title();

@property ref bool Dead() {
return dead;
}

@property short X() {
return x;
}

@property short X(short x) {
this.x = x;
Move(x, y);
return this.x;
}

@property short Y() {
return y;
}

@property short Y(short y) {
this.y = y;
Move(x, y);
return this.y;
}

@property ushort Width() {
return width;
}

@property ushort Width(ushort width) {
this.width = width;
Resize(width, height);
return this.width;
}

@property ushort Height() {
return height;
}

@property ushort Height(ushort height) {
this.height = height;
Resize(width, height);
return this.height;
}

protected:
bool dead;
short x;
short y;
ushort width;
ushort height;
}
Loading

0 comments on commit edbfc43

Please sign in to comment.