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
a0832c09
Commit
a0832c09
authored
Jun 13, 2019
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QT: Fix issue with selection due to multiple local servers trying to use the same socket.
parent
fcf8e390
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
43 deletions
+42
-43
wb/lib/wb/qt/wb_nav_qt.cqt
wb/lib/wb/qt/wb_nav_qt.cqt
+4
-1
wb/lib/wb/qt/wb_pal_qt.cqt
wb/lib/wb/qt/wb_pal_qt.cqt
+4
-1
wb/lib/wb/qt/wb_wnav_qt.cqt
wb/lib/wb/qt/wb_wnav_qt.cqt
+20
-5
xtt/lib/cow/qt/cow_wow_qt.cqt
xtt/lib/cow/qt/cow_wow_qt.cqt
+14
-36
No files found.
wb/lib/wb/qt/wb_nav_qt.cqt
View file @
a0832c09
...
...
@@ -59,7 +59,6 @@ NavQt::NavQt(void* nav_parent_ctx, const char* nav_name,
form_widget = wrapInFrame(scrolledbrow);
server = new QLocalServer(trace_obj);
server->listen("STRING");
QObject::connect(
server, SIGNAL(newConnection()), trace_obj, SLOT(sel_convert_cb()));
...
...
@@ -107,6 +106,10 @@ void NavQtTraceObject::sel_convert_cb()
void NavQt::set_selection_owner(int set)
{
if (!server->isListening()) {
QLocalServer::removeServer("STRING");
server->listen("STRING");
}
selection_owner = set;
}
...
...
wb/lib/wb/qt/wb_pal_qt.cqt
View file @
a0832c09
...
...
@@ -59,7 +59,6 @@ PalQt::PalQt(void* pal_parent_ctx, const char* pal_name,
form_widget = wrapInFrame(scrolledbrow);
server = new QLocalServer(trace_obj);
server->listen("STRING");
QObject::connect(
server, SIGNAL(newConnection()), trace_obj, SLOT(sel_convert_cb()));
...
...
@@ -108,6 +107,10 @@ void PalQt::set_inputfocus(int focus)
void PalQt::set_selection_owner()
{
if (!server->isListening()) {
QLocalServer::removeServer("STRING");
server->listen("STRING");
}
selection_owner = 1;
brow_SetInverseColor(brow_ctx, flow_eDrawType_Line);
}
...
...
wb/lib/wb/qt/wb_wnav_qt.cqt
View file @
a0832c09
...
...
@@ -95,19 +95,15 @@ WNavQt::WNavQt(void* xn_parent_ctx, QWidget* xn_parent_wid, const char* xn_name,
*w = form_widget;
serverString = new QLocalServer(trace_obj);
serverString->listen("STRING");
QObject::connect(
serverString, SIGNAL(newConnection()), trace_obj, SLOT(sel_convert_cb()));
serverGraph = new QLocalServer(trace_obj);
serverGraph->listen("PWR_GRAPH");
QObject::connect(
serverGraph, SIGNAL(newConnection()), trace_obj, SLOT(sel_convert_cb()));
serverObjId = new QLocalServer(trace_obj);
serverObjId->listen("PWR_OBJID");
QObject::connect(
serverObjId, SIGNAL(newConnection()), trace_obj, SLOT(sel_convert_cb()));
serverAttrRef = new QLocalServer(trace_obj);
serverAttrRef->listen("PWR_ATTRREF");
QObject::connect(serverAttrRef, SIGNAL(newConnection()), trace_obj,
SLOT(sel_convert_cb()));
...
...
@@ -197,6 +193,23 @@ int WNavQt::get_selection(char* str, int len)
void WNavQt::set_selection_owner()
{
if (!serverString->isListening()) {
QLocalServer::removeServer("STRING");
serverString->listen("STRING");
}
if (!serverGraph->isListening()) {
QLocalServer::removeServer("PWR_GRAPH");
serverGraph->listen("PWR_GRAPH");
}
if (!serverObjId->isListening()) {
QLocalServer::removeServer("PWR_OBJID");
serverObjId->listen("PWR_OBJID");
}
if (!serverAttrRef->isListening()) {
QLocalServer::removeServer("PWR_ATTRREF");
serverAttrRef->listen("PWR_ATTRREF");
}
selection_owner = 1;
}
...
...
@@ -274,9 +287,11 @@ static void selection_data_set(
{
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out
.writeRawData(data, strlen(data)
);
out
<< QString(data
);
QLocalSocket* clientConnection = server->nextPendingConnection();
QObject::connect(clientConnection, SIGNAL(disconnected()),
clientConnection, SLOT(deleteLater()));
clientConnection->write(block);
clientConnection->flush();
clientConnection->disconnectFromServer();
...
...
xtt/lib/cow/qt/cow_wow_qt.cqt
View file @
a0832c09
...
...
@@ -72,15 +72,6 @@
#include <qlocalsocket.h>
typedef struct {
char str[200];
int len;
int received;
pwr_tStatus sts;
const char* atom;
int new_main;
} wow_sSelection;
typedef struct {
char title[80];
flow_tCtx flow_ctx;
...
...
@@ -424,46 +415,33 @@ void CoWowQtObject::DisplayLicense()
int CoWowQt::GetSelection(char* str, int size, const char* atom)
{
log_debug("GetSelection str=%s, size=%d, arom=%s\n", str, size, atom);
static wow_sSelection data;
data.received = 0;
data.sts = 0;
data.atom = atom;
data.new_main = 0;
QLocalSocket* socket = new QLocalSocket();
socket->connectToServer(fl(atom));
if (!socket->waitForConnected()) {
log_debug("GetSelection failed, could not connect to local server %s: %s\n", fl(atom), qPrintable(socket->errorString()));
}
while (!data.received) {
QString rcvStr;
int received = 0;
while (!received) {
if (socket->waitForReadyRead(50)) {
if (socket->bytesAvailable() > 0) {
QDataStream in(socket);
if (socket->bytesAvailable() > int(sizeof(data.str) - 1)
|| in.atEnd()) {
data.sts = 0;
continue;
}
in.readRawData(data.str, socket->bytesAvailable());
data.str[socket->bytesAvailable()] = 0;
data.len = socket->bytesAvailable();
data.sts = 1;
} else {
data.sts = 0;
QDataStream in(socket);
if (socket->bytesAvailable() > 0 && !in.atEnd()) {
in >> rcvStr;
}
data.received = 1;
received = 1;
}
QApplication::processEvents();
}
socket->close();
delete socket;
if (
data.sts && data.len
< size) {
strcpy(str,
data.str
);
if (
!rcvStr.isEmpty() && rcvStr.length()
< size) {
strcpy(str,
qPrintable(rcvStr)
);
}
return
data.sts
;
return
!rcvStr.isEmpty()
;
}
void CoWowQt::CreateFileSelDia(const char* title, void* parent_ctx,
...
...
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