diff --git a/engine/Client.cpp b/engine/Client.cpp index fecf9890..319ea482 100644 --- a/engine/Client.cpp +++ b/engine/Client.cpp @@ -754,6 +754,8 @@ void Client::line(int newLine) void Client::callAccept(const char* callId) { Debug(ClientDriver::self(),DebugInfo,"callAccept('%s')",callId); + if (!driverLockLoop()) + return; ClientChannel* cc = static_cast(ClientDriver::self()->find(callId)); if (cc) { cc->ref(); @@ -761,6 +763,7 @@ void Client::callAccept(const char* callId) setChannelInternal(cc); cc->deref(); } + driverUnlock(); } void Client::callReject(const char* callId) @@ -793,8 +796,11 @@ bool Client::callStart(const String& target, const String& line, target.c_str(),line.c_str(),proto.c_str(),account.c_str()); if (target.null()) return false; + if (!driverLockLoop()) + return false; ClientChannel* cc = new ClientChannel(target); Message* m = cc->message("call.route"); + driverUnlock(); Regexp r("^[a-z0-9]\\+/"); bool hasProto = r.matches(target.safe()); if (hasProto) @@ -931,6 +937,33 @@ void Client::idleActions() tmp->process(); } +bool Client::driverLock(long maxwait) +{ + if (maxwait < 0) + maxwait = 0; + return ClientDriver::self() && ClientDriver::self()->lock(maxwait); +} + +bool Client::driverLockLoop() +{ + if (!(isCurrent() && ClientDriver::self())) + return false; + + while (!driverLock()) { + if (Engine::exiting() || !ClientDriver::self()) + return false; + idleActions(); + yield(); + } + return true; +} + +void Client::driverUnlock() +{ + if (ClientDriver::self()) + ClientDriver::self()->unlock(); +} + bool UIHandler::received(Message &msg) { diff --git a/modules/skin/default/gtk2client.rc b/modules/skin/default/gtk2client.rc index ae674f91..713a4f58 100644 --- a/modules/skin/default/gtk2client.rc +++ b/modules/skin/default/gtk2client.rc @@ -30,6 +30,7 @@ style "window" { bg[NORMAL] = { 0.75, 0.80, 0.71 } bg[ACTIVE] = { 0.58, 0.67, 0.57 } bg[PRELIGHT] = { 0.66, 0.74, 0.64 } + font_name = "Sans 10" } style "button" { @@ -40,8 +41,8 @@ style "button" { style "border" { bg[NORMAL] = { 0.91, 0.47, 0.10 } - xthickness = 2 - ythickness = 2 + xthickness = 3 + ythickness = 3 } style "decoration" { diff --git a/yatecbase.h b/yatecbase.h index ee14d7e0..acbefe16 100644 --- a/yatecbase.h +++ b/yatecbase.h @@ -185,6 +185,9 @@ protected: void enableAction(const ClientChannel* chan, const String& action); inline bool needProxy() const { return m_oneThread && !isCurrent(); } + bool driverLockLoop(); + static bool driverLock(long maxwait = 0); + static void driverUnlock(); ObjList m_windows; String m_activeId; int m_line;