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
17941b95
Commit
17941b95
authored
Aug 28, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QT: Fixed annoyance with double buffering
parent
62ee6b21
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
57 deletions
+28
-57
xtt/lib/cow/qt/cow_qt_helpers.cpp
xtt/lib/cow/qt/cow_qt_helpers.cpp
+1
-0
xtt/lib/flow/qt/flow_draw_qt.cqt
xtt/lib/flow/qt/flow_draw_qt.cqt
+10
-25
xtt/lib/flow/qt/flow_draw_qt.h
xtt/lib/flow/qt/flow_draw_qt.h
+2
-2
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
+1
-1
xtt/lib/glow/qt/glow_draw_qt.cqt
xtt/lib/glow/qt/glow_draw_qt.cqt
+11
-26
xtt/lib/glow/qt/glow_draw_qt.h
xtt/lib/glow/qt/glow_draw_qt.h
+2
-2
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
+1
-1
No files found.
xtt/lib/cow/qt/cow_qt_helpers.cpp
View file @
17941b95
...
...
@@ -295,6 +295,7 @@ void set_pane_position(QSplitter* pane, int right)
if
(
right
>
0
)
{
sizes
<<
right
<<
total
-
right
;
}
else
{
right
=
-
right
;
sizes
<<
total
-
right
<<
right
;
}
pane
->
setSizes
(
sizes
);
...
...
xtt/lib/flow/qt/flow_draw_qt.cqt
View file @
17941b95
...
...
@@ -94,6 +94,7 @@ static char font_names[draw_eFont__][DRAW_FONT_SIZE][80]
"-*-Helvetica-Medium-R-Normal--24-*-*-*-P-*-ISO8859-1" } };
static QMouseEvent* last_event;
static QWidget* last_target;
static QColor flow_allocate_color(
FlowDrawQt* draw_ctx, const char* named_color);
...
...
@@ -293,7 +294,7 @@ int FlowDrawQt::init_nav(QWidget* nav_widget, void* flow_ctx)
return 1;
}
int FlowDrawQt::event_handler(QEvent* event)
int FlowDrawQt::event_handler(QEvent* event
, QWidget* target
)
{
static int button_pressed = 0;
static int button_clicked = 0;
...
...
@@ -309,24 +310,7 @@ int FlowDrawQt::event_handler(QEvent* event)
return 1;
}
QObject* windowParent = window;
QObject* navWindowParent = nav_window;
bool windowEvent = false;
bool navWindowEvent = false;
if (QApplication::focusWidget() != NULL) {
while (!(windowParent == NULL && navWindowParent == NULL)) {
windowEvent = (QApplication::focusWidget() == windowParent);
navWindowEvent = (QApplication::focusWidget() == navWindowParent);
if (windowEvent || navWindowEvent) {
break;
}
windowParent = (windowParent == NULL) ? NULL : windowParent->parent();
navWindowParent
= (navWindowParent == NULL) ? NULL : navWindowParent->parent();
}
}
if (windowEvent || event->type() == QEvent::KeyPress) {
if (target == window || event->type() == QEvent::KeyPress) {
switch (event->type()) {
case QEvent::KeyPress: {
QKeyEvent* keyEvent = ((QKeyEvent*)event);
...
...
@@ -462,14 +446,14 @@ int FlowDrawQt::event_handler(QEvent* event)
button_pressed = mouseEvent->button();
last_press_x = mouseEvent->x();
last_press_y = mouseEvent->y();
event_timer(mouseEvent);
event_timer(mouseEvent
, target
);
return 1;
}
if (!button_pressed) {
button_pressed = mouseEvent->button();
last_press_x = mouseEvent->x();
last_press_y = mouseEvent->y();
event_timer(mouseEvent);
event_timer(mouseEvent
, target
);
return 1;
} else {
// debug_print("event_handler: MouseButtonPress from timer\n");
...
...
@@ -599,7 +583,7 @@ int FlowDrawQt::event_handler(QEvent* event)
if (!button_clicked_and_pressed) {
/* wait for button double click */
button_clicked = 1;
event_timer(mouseEvent);
event_timer(mouseEvent
, target
);
button_pressed = 0;
return 1;
} else {
...
...
@@ -787,7 +771,7 @@ int FlowDrawQt::event_handler(QEvent* event)
default:
break;
}
} else if (
navWindowEvent
) {
} else if (
target == nav_window
) {
switch (event->type()) {
case QEvent::MouseButtonPress: {
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
...
...
@@ -1622,7 +1606,7 @@ bool FlowDrawQt::draw_timer_cb()
bool FlowDrawQt::event_timer_cb()
{
timer_id->stop();
event_handler(last_event);
event_handler(last_event
, last_target
);
return FALSE;
}
...
...
@@ -1633,13 +1617,14 @@ void FlowDrawQt::cancel_event_timer()
}
}
void FlowDrawQt::event_timer(QMouseEvent* event)
void FlowDrawQt::event_timer(QMouseEvent* event
, QWidget *target
)
{
if (last_event) {
delete last_event;
}
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(),
event->button(), event->buttons(), event->modifiers());
last_target = target;
initOneShotTimer(timer_id, SLOT(event_timer_cb()), 200);
}
...
...
xtt/lib/flow/qt/flow_draw_qt.h
View file @
17941b95
...
...
@@ -72,7 +72,7 @@ public:
int
init_nav
(
QWidget
*
nav_widget
,
void
*
flow_ctx
);
int
event_handler
(
QEvent
*
event
);
int
event_handler
(
QEvent
*
event
,
QWidget
*
target
);
void
enable_event
(
FlowCtx
*
ctx
,
flow_eEvent
event
,
flow_eEventType
event_type
,
int
(
*
event_cb
)(
FlowCtx
*
ctx
,
flow_tEvent
event
));
...
...
@@ -255,7 +255,7 @@ private:
int
x
,
int
y
,
char
*
text
,
int
len
);
void
cursor_helper
(
FlowCtx
*
ctx
,
draw_eCursor
cursor
,
bool
nav
=
false
);
void
event_timer
(
QMouseEvent
*
event
);
void
event_timer
(
QMouseEvent
*
event
,
QWidget
*
target
);
void
cancel_event_timer
();
flow_draw_sTimerCb
*
timer_cb
;
...
...
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
View file @
17941b95
...
...
@@ -246,7 +246,7 @@ void QtScrollWidgetFlow::handleEvent(QEvent* event)
if (event->type() == QEvent::MouseMove) {
drawer->window->update();
}
drawer->event_handler(event);
drawer->event_handler(event
, this
);
}
}
}
...
...
xtt/lib/glow/qt/glow_draw_qt.cqt
View file @
17941b95
...
...
@@ -142,6 +142,7 @@ static char font_names[glow_eFont__][glow_eDrawFont__][DRAW_FONT_SIZE][80] = {
};
static QMouseEvent* last_event;
static QWidget* last_target;
static QColor glow_allocate_named_color(
GlowDrawQt* draw_ctx, const char* named_color);
...
...
@@ -369,7 +370,7 @@ GlowDrawQt::GlowDrawQt(QWidget* toplevel, void** glow_ctx,
init_proc(toplevel, ctx, client_data);
}
int GlowDrawQt::event_handler(QEvent* event)
int GlowDrawQt::event_handler(QEvent* event
, QWidget* target
)
{
static int button_pressed = 0;
static int button_clicked = 0;
...
...
@@ -385,24 +386,7 @@ int GlowDrawQt::event_handler(QEvent* event)
return 1;
}
QObject* windowParent = m_wind->window;
QObject* navWindowParent = nav_wind->window;
bool windowEvent = false;
bool navWindowEvent = false;
if (QApplication::focusWidget() != NULL) {
while (!(windowParent == NULL && navWindowParent == NULL)) {
windowEvent = (QApplication::focusWidget() == windowParent);
navWindowEvent = (QApplication::focusWidget() == navWindowParent);
if (windowEvent || navWindowEvent) {
break;
}
windowParent = (windowParent == NULL) ? NULL : windowParent->parent();
navWindowParent
= (navWindowParent == NULL) ? NULL : navWindowParent->parent();
}
}
if (windowEvent || event->type() == QEvent::KeyPress) {
if (target == m_wind->window || event->type() == QEvent::KeyPress) {
if (GlowCtx::eventlog_enabled) {
log_event(event);
}
...
...
@@ -533,14 +517,14 @@ int GlowDrawQt::event_handler(QEvent* event)
button_pressed = mouseEvent->button();
last_press_x = mouseEvent->x();
last_press_y = mouseEvent->y();
event_timer(mouseEvent);
event_timer(mouseEvent
, target
);
return 1;
}
if (!button_pressed) {
button_pressed = mouseEvent->button();
last_press_x = mouseEvent->x();
last_press_y = mouseEvent->y();
event_timer(mouseEvent);
event_timer(mouseEvent
, target
);
return 1;
} else {
/* Press event, callback from timer */
...
...
@@ -687,7 +671,7 @@ int GlowDrawQt::event_handler(QEvent* event)
if (!button_clicked_and_pressed) {
/* wait for button double click */
button_clicked = 1;
event_timer(mouseEvent);
event_timer(mouseEvent
, target
);
button_pressed = 0;
return 1;
} else {
...
...
@@ -879,7 +863,7 @@ int GlowDrawQt::event_handler(QEvent* event)
default:
break;
}
} else if (
navWindowEvent
) {
} else if (
target == nav_wind->window
) {
switch (event->type()) {
case QEvent::MouseButtonPress: {
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
...
...
@@ -1602,7 +1586,7 @@ bool GlowDrawQt::draw_timer_cb()
bool GlowDrawQt::event_timer_cb()
{
timer_id->stop();
event_handler(last_event);
event_handler(last_event
, last_target
);
return FALSE;
}
...
...
@@ -1611,13 +1595,14 @@ void GlowDrawQt::cancel_event_timer()
timer_id->stop();
}
void GlowDrawQt::event_timer(QMouseEvent* event)
void GlowDrawQt::event_timer(QMouseEvent* event
, QWidget *target
)
{
if (last_event) {
delete last_event;
}
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(),
event->button(), event->buttons(), event->modifiers());
last_target = target;
initOneShotTimer(timer_id, SLOT(event_timer_cb()), 200);
}
...
...
@@ -3416,7 +3401,7 @@ void GlowDrawQt::event_exec(void* event, unsigned int size)
default:;
}
event_handler(&e);
event_handler(&e
, m_wind->window
);
}
int GlowDrawQt::open_color_selection(double* r, double* g, double* b)
...
...
xtt/lib/glow/qt/glow_draw_qt.h
View file @
17941b95
...
...
@@ -101,7 +101,7 @@ public:
int
closing_down
;
std
::
stack
<
GlowCustomColors
>
customcolors
;
int
event_handler
(
QEvent
*
event
);
int
event_handler
(
QEvent
*
event
,
QWidget
*
target
);
virtual
void
enable_event
(
glow_eEvent
event
,
glow_eEventType
event_type
,
int
(
*
event_cb
)(
GlowCtx
*
ctx
,
glow_tEvent
event
));
virtual
void
clear
(
GlowWind
*
w
);
...
...
@@ -271,7 +271,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
(
QMouseEvent
*
event
);
void
event_timer
(
QMouseEvent
*
event
,
QWidget
*
target
);
void
cancel_event_timer
();
glow_draw_sTimerCb
*
timer_cb
;
...
...
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
View file @
17941b95
...
...
@@ -251,7 +251,7 @@ void QtScrollWidgetGlow::handleEvent(QEvent* event)
if (event->type() == QEvent::MouseMove) {
drawer->m_wind->window->update();
}
drawer->event_handler(event);
drawer->event_handler(event
, this
);
}
}
}
...
...
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