Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
Esteban Blanc
proview
Commits
0e6c4ce7
Commit
0e6c4ce7
authored
Aug 15, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QT: Fixed Proviews fake double click.
parent
03e7bfab
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
34 deletions
+36
-34
xtt/lib/flow/qt/flow_draw_qt.cqt
xtt/lib/flow/qt/flow_draw_qt.cqt
+14
-16
xtt/lib/flow/qt/flow_draw_qt.h
xtt/lib/flow/qt/flow_draw_qt.h
+1
-1
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
+3
-0
xtt/lib/glow/qt/glow_draw_qt.cqt
xtt/lib/glow/qt/glow_draw_qt.cqt
+14
-16
xtt/lib/glow/qt/glow_draw_qt.h
xtt/lib/glow/qt/glow_draw_qt.h
+1
-1
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
+3
-0
No files found.
xtt/lib/flow/qt/flow_draw_qt.cqt
View file @
0e6c4ce7
...
...
@@ -92,7 +92,7 @@ static char font_names[draw_eFont__][DRAW_FONT_SIZE][80]
"-*-Helvetica-Medium-R-Normal--18-*-*-*-P-*-ISO8859-1",
"-*-Helvetica-Medium-R-Normal--24-*-*-*-P-*-ISO8859-1" } };
static Q
Event last_event(QEvent::None)
;
static Q
MouseEvent *last_event
;
static QColor flow_allocate_color(
FlowDrawQt* draw_ctx, const char* named_color);
...
...
@@ -409,7 +409,6 @@ int FlowDrawQt::event_handler(QEvent* event)
if (click_sensitivity & flow_mSensitivity_MB1Click
&& !(click_sensitivity & flow_mSensitivity_MB1DoubleClick)
&& !(click_sensitivity & flow_mSensitivity_MB1Press)) {
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = 0;
button_clicked = 1;
last_press_x = mouseEvent->x();
...
...
@@ -418,7 +417,6 @@ int FlowDrawQt::event_handler(QEvent* event)
} else if (!(click_sensitivity & flow_mSensitivity_MB1Click)
&& !(click_sensitivity & flow_mSensitivity_MB1DoubleClick)
&& click_sensitivity & flow_mSensitivity_MB1Press) {
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = 1;
button_clicked = 0;
last_press_x = mouseEvent->x();
...
...
@@ -431,7 +429,6 @@ int FlowDrawQt::event_handler(QEvent* event)
if (click_sensitivity & flow_mSensitivity_MB2Click
&& !(click_sensitivity & flow_mSensitivity_MB2DoubleClick)
&& !(click_sensitivity & flow_mSensitivity_MB2Press)) {
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = 0;
button_clicked = 1;
last_press_x = mouseEvent->x();
...
...
@@ -440,7 +437,6 @@ int FlowDrawQt::event_handler(QEvent* event)
} else if (!(click_sensitivity & flow_mSensitivity_MB2Click)
&& !(click_sensitivity & flow_mSensitivity_MB2DoubleClick)
&& click_sensitivity & flow_mSensitivity_MB2Press) {
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = 1;
button_clicked = 0;
last_press_x = mouseEvent->x();
...
...
@@ -467,21 +463,20 @@ int FlowDrawQt::event_handler(QEvent* event)
button_clicked_and_pressed = 1;
cancel_event_timer();
button_clicked = 0;
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = mouseEvent->button();
last_press_x = mouseEvent->x();
last_press_y = mouseEvent->y();
event_timer(
200
);
event_timer(
mouseEvent
);
return 1;
}
if (!button_pressed) {
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = mouseEvent->button();
last_press_x = mouseEvent->x();
last_press_y = mouseEvent->y();
event_timer(
200
);
event_timer(
mouseEvent
);
return 1;
} else {
debug_print("event_handler: MouseButtonPress from timer\n");
/* Press event, callback from timer */
button_pressed = 0;
button_clicked_and_pressed = 0;
...
...
@@ -607,9 +602,8 @@ int FlowDrawQt::event_handler(QEvent* event)
cancel_event_timer();
if (!button_clicked_and_pressed) {
/* wait for button double click */
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_clicked = 1;
event_timer(
200
);
event_timer(
mouseEvent
);
button_pressed = 0;
return 1;
} else {
...
...
@@ -690,8 +684,7 @@ int FlowDrawQt::event_handler(QEvent* event)
}
case QEvent::MouseMove: {
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
debug_print("event_handler: MouseMove\n");
QPoint pos = QCursor::pos();
QPoint pos = mouseEvent->pos();
if (button3_pressed) {
button3_pressed = 0;
...
...
@@ -1642,7 +1635,7 @@ bool FlowDrawQt::event_timer_cb()
{
delete timer_id;
timer_id = 0;
event_handler(
&
last_event);
event_handler(last_event);
return FALSE;
}
...
...
@@ -1654,12 +1647,17 @@ void FlowDrawQt::cancel_event_timer()
}
}
void FlowDrawQt::event_timer(
int time_ms
)
void FlowDrawQt::event_timer(
QMouseEvent *event
)
{
if (last_event) {
delete last_event;
}
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
timer_id = new QTimer();
timer_id->setSingleShot(true);
connect(timer_id, SIGNAL(timeout()), this, SLOT(event_timer_cb()));
timer_id->start(
time_ms
);
timer_id->start(
200
);
}
void FlowDrawQt::set_timer(
...
...
xtt/lib/flow/qt/flow_draw_qt.h
View file @
0e6c4ce7
...
...
@@ -258,7 +258,7 @@ private:
int
x
,
int
y
,
char
*
text
,
int
len
);
void
cursor_helper
(
FlowCtx
*
ctx
,
draw_eCursor
cursor
,
bool
nav
=
false
);
void
event_timer
(
int
timer_ms
);
void
event_timer
(
QMouseEvent
*
event
);
void
cancel_event_timer
();
flow_draw_sTimerCb
*
timer_cb
;
...
...
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
View file @
0e6c4ce7
...
...
@@ -58,6 +58,7 @@ void QtScrollWidgetFlow::init(unsigned int eCtxType,
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true);
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
...
...
@@ -70,6 +71,7 @@ QWidget* QtScrollWidgetFlow::initScroll(unsigned int eCtxType,
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true);
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
...
...
@@ -91,6 +93,7 @@ void QtScrollWidgetFlow::init(unsigned int eCtxType, QWidget* main)
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true);
this->ctxType = eCtxType;
is_navigator = 1;
main_widget = main;
...
...
xtt/lib/glow/qt/glow_draw_qt.cqt
View file @
0e6c4ce7
...
...
@@ -140,7 +140,7 @@ static char font_names[glow_eFont__][glow_eDrawFont__][DRAW_FONT_SIZE][80] = {
"-*-courier-Medium-R-Normal--24-*-*-*-m-*-ISO8859-1" } }
};
static Q
Event last_event(QEvent::None)
;
static Q
MouseEvent *last_event
;
static QColor glow_allocate_named_color(
GlowDrawQt* draw_ctx, const char* named_color);
...
...
@@ -489,7 +489,6 @@ int GlowDrawQt::event_handler(QEvent* event)
if (click_sensitivity & glow_mSensitivity_MB1Click
&& !(click_sensitivity & glow_mSensitivity_MB1DoubleClick)
&& !(click_sensitivity & glow_mSensitivity_MB1Press)) {
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = 0;
button_clicked = 1;
last_press_x = mouseEvent->x();
...
...
@@ -498,7 +497,6 @@ int GlowDrawQt::event_handler(QEvent* event)
} else if (!(click_sensitivity & glow_mSensitivity_MB1Click)
&& !(click_sensitivity & glow_mSensitivity_MB1DoubleClick)
&& click_sensitivity & glow_mSensitivity_MB1Press) {
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = 1;
button_clicked = 0;
last_press_x = mouseEvent->x();
...
...
@@ -518,7 +516,6 @@ int GlowDrawQt::event_handler(QEvent* event)
} else if (click_sensitivity & glow_mSensitivity_MB3Click
&& !(click_sensitivity & glow_mSensitivity_MB3DoubleClick)
&& !(click_sensitivity & glow_mSensitivity_MB3Press)) {
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = 0;
button_clicked = 1;
last_press_x = mouseEvent->x();
...
...
@@ -536,19 +533,17 @@ int GlowDrawQt::event_handler(QEvent* event)
button_clicked_and_pressed = 1;
cancel_event_timer();
button_clicked = 0;
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = mouseEvent->button();
last_press_x = mouseEvent->x();
last_press_y = mouseEvent->y();
event_timer(
200
);
event_timer(
mouseEvent
);
return 1;
}
if (!button_pressed) {
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_pressed = mouseEvent->button();
last_press_x = mouseEvent->x();
last_press_y = mouseEvent->y();
event_timer(
200
);
event_timer(
mouseEvent
);
return 1;
} else {
/* Press event, callback from timer */
...
...
@@ -694,9 +689,8 @@ int GlowDrawQt::event_handler(QEvent* event)
cancel_event_timer();
if (!button_clicked_and_pressed) {
/* wait for button double click */
memcpy((void*)&last_event, (void*)&event, sizeof(QEvent));
button_clicked = 1;
event_timer(
200
);
event_timer(
mouseEvent
);
button_pressed = 0;
return 1;
} else {
...
...
@@ -780,7 +774,7 @@ int GlowDrawQt::event_handler(QEvent* event)
}
case QEvent::MouseMove: {
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
QPoint pos =
QCursor::
pos();
QPoint pos =
mouseEvent->
pos();
if (button3_pressed) {
button3_pressed = 0;
...
...
@@ -1597,10 +1591,9 @@ bool GlowDrawQt::draw_timer_cb()
bool GlowDrawQt::event_timer_cb()
{
delete timer_id;
timer_id = 0;
event_handler(&last_event);
event_handler(last_event);
return FALSE;
}
...
...
@@ -1612,12 +1605,17 @@ void GlowDrawQt::cancel_event_timer()
}
}
void GlowDrawQt::event_timer(
int time_ms
)
void GlowDrawQt::event_timer(
QMouseEvent *event
)
{
if (last_event) {
delete last_event;
}
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
timer_id = new QTimer();
timer_id->setSingleShot(true);
QObject::connect(timer_id, SIGNAL(timeout()), this, SLOT(event_timer_cb()));
timer_id->start(
time_ms
);
timer_id->start(
200
);
}
void GlowDrawQt::set_timer(GlowCtx* paintertx, int time_ms,
...
...
xtt/lib/glow/qt/glow_draw_qt.h
View file @
0e6c4ce7
...
...
@@ -272,7 +272,7 @@ private:
int
image_helper
(
GlowWind
*
wind
,
int
x
,
int
y
,
int
width
,
int
height
,
glow_tImImage
image
,
glow_tPixmap
clip_mask
,
bool
d
=
false
);
void
event_timer
(
int
time_ms
);
void
event_timer
(
QMouseEvent
*
event
);
void
cancel_event_timer
();
glow_draw_sTimerCb
*
timer_cb
;
...
...
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
View file @
0e6c4ce7
...
...
@@ -60,6 +60,7 @@ void QtScrollWidgetGlow::init(unsigned int eCtxType,
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true);
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
...
...
@@ -72,6 +73,7 @@ QWidget* QtScrollWidgetGlow::initScroll(unsigned int eCtxType,
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true);
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
...
...
@@ -94,6 +96,7 @@ void QtScrollWidgetGlow::init(unsigned int eCtxType, QWidget* main)
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true);
this->ctxType = eCtxType;
is_navigator = 1;
main_widget = main;
...
...
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