mirror of https://github.com/buggins/dlangui.git
fix layout problems
This commit is contained in:
parent
a42c8c0806
commit
bf9f438d0f
|
@ -72,7 +72,7 @@
|
||||||
<debuglevel>0</debuglevel>
|
<debuglevel>0</debuglevel>
|
||||||
<debugids />
|
<debugids />
|
||||||
<versionlevel>0</versionlevel>
|
<versionlevel>0</versionlevel>
|
||||||
<versionids>Unicode USE_FREETYPE USE_SDL USE_OPENGL</versionids>
|
<versionids>Unicode USE_FREETYPE USE_OPENGL</versionids>
|
||||||
<dump_source>0</dump_source>
|
<dump_source>0</dump_source>
|
||||||
<mapverbosity>3</mapverbosity>
|
<mapverbosity>3</mapverbosity>
|
||||||
<createImplib>0</createImplib>
|
<createImplib>0</createImplib>
|
||||||
|
|
|
@ -505,6 +505,13 @@ struct ButtonDetails {
|
||||||
|
|
||||||
static final long DOUBLE_CLICK_THRESHOLD_MS = 200;
|
static final long DOUBLE_CLICK_THRESHOLD_MS = 200;
|
||||||
|
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
_downTs = _upTs = 0;
|
||||||
|
_downFlags = 0;
|
||||||
|
_downX = _downY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// update for button down
|
/// update for button down
|
||||||
void down(short x, short y, ushort flags) {
|
void down(short x, short y, ushort flags) {
|
||||||
//Log.d("Button down ", x, ",", y, " _downTs=", _downTs, " _upTs=", _upTs);
|
//Log.d("Button down ", x, ",", y, " _downTs=", _downTs, " _upTs=", _upTs);
|
||||||
|
|
|
@ -556,6 +556,15 @@ class Win32Window : Window {
|
||||||
protected ButtonDetails _mbutton;
|
protected ButtonDetails _mbutton;
|
||||||
protected ButtonDetails _rbutton;
|
protected ButtonDetails _rbutton;
|
||||||
|
|
||||||
|
private void updateButtonsState(uint flags) {
|
||||||
|
if (!(flags & MK_LBUTTON) && _lbutton.isDown)
|
||||||
|
_lbutton.reset();
|
||||||
|
if (!(flags & MK_MBUTTON) && _mbutton.isDown)
|
||||||
|
_mbutton.reset();
|
||||||
|
if (!(flags & MK_RBUTTON) && _rbutton.isDown)
|
||||||
|
_rbutton.reset();
|
||||||
|
}
|
||||||
|
|
||||||
private bool _mouseTracking;
|
private bool _mouseTracking;
|
||||||
private bool onMouse(uint message, uint flags, short x, short y) {
|
private bool onMouse(uint message, uint flags, short x, short y) {
|
||||||
debug(DebugMouseEvents) Log.d("Win32 Mouse Message ", message, " flags=", flags, " x=", x, " y=", y);
|
debug(DebugMouseEvents) Log.d("Win32 Mouse Message ", message, " flags=", flags, " x=", x, " y=", y);
|
||||||
|
@ -566,6 +575,7 @@ class Win32Window : Window {
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
action = MouseAction.Move;
|
action = MouseAction.Move;
|
||||||
|
updateButtonsState(flags);
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
action = MouseAction.ButtonDown;
|
action = MouseAction.ButtonDown;
|
||||||
|
|
|
@ -413,6 +413,17 @@ class ResizerWidget : Widget {
|
||||||
if (event.action == MouseAction.FocusOut && _dragging) {
|
if (event.action == MouseAction.FocusOut && _dragging) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if ((event.action == MouseAction.ButtonUp && event.button == MouseButton.Left) || (!event.lbutton.isDown && _dragging)) {
|
||||||
|
resetState(State.Pressed);
|
||||||
|
if (_dragging) {
|
||||||
|
//sendScrollEvent(ScrollAction.SliderReleased, _position);
|
||||||
|
_dragging = false;
|
||||||
|
if (resizeListener.assigned) {
|
||||||
|
resizeListener(this, ResizerEventType.EndDragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (event.action == MouseAction.Move && _dragging) {
|
if (event.action == MouseAction.Move && _dragging) {
|
||||||
int delta = _orientation == Orientation.Vertical ? event.y - _dragStart.y : event.x - _dragStart.x;
|
int delta = _orientation == Orientation.Vertical ? event.y - _dragStart.y : event.x - _dragStart.x;
|
||||||
if (resizeListener.assigned) {
|
if (resizeListener.assigned) {
|
||||||
|
@ -459,17 +470,6 @@ class ResizerWidget : Widget {
|
||||||
//onIndicatorDragging(_dragStartPosition, position);
|
//onIndicatorDragging(_dragStartPosition, position);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event.action == MouseAction.ButtonUp && event.button == MouseButton.Left) {
|
|
||||||
resetState(State.Pressed);
|
|
||||||
if (_dragging) {
|
|
||||||
//sendScrollEvent(ScrollAction.SliderReleased, _position);
|
|
||||||
_dragging = false;
|
|
||||||
if (resizeListener.assigned) {
|
|
||||||
resizeListener(this, ResizerEventType.EndDragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (event.action == MouseAction.Move && trackHover) {
|
if (event.action == MouseAction.Move && trackHover) {
|
||||||
if (!(state & State.Hovered)) {
|
if (!(state & State.Hovered)) {
|
||||||
Log.d("Hover ", id);
|
Log.d("Hover ", id);
|
||||||
|
|
Loading…
Reference in New Issue