From 00f04056836a0abb49aae054219b331368786da5 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 15 Apr 2020 17:25:46 +0100 Subject: [PATCH] Implement the rest of the predefined Message targets --- boxstack.cc | 11 +++++------ command.cc | 8 +++++--- command.h | 2 +- message.h | 3 ++- vchannelselect.cc | 2 +- vepgsettimer.cc | 2 +- vmedialist.cc | 2 +- vmediaview.cc | 2 +- vmute.cc | 2 +- vradiorec.cc | 4 ++-- vrecording.cc | 6 +++--- vrecordingmenu.cc | 4 ++-- vsleeptimer.cc | 6 +++--- vtimeredit.cc | 2 +- vvideomedia.cc | 6 +++--- vvideorec.cc | 4 ++-- vvolume.cc | 2 +- winmain.cc | 6 +++--- 18 files changed, 38 insertions(+), 36 deletions(-) diff --git a/boxstack.cc b/boxstack.cc index f5c3c68..d72500b 100644 --- a/boxstack.cc +++ b/boxstack.cc @@ -556,7 +556,7 @@ int BoxStack::handleCommand(int command) void BoxStack::processMessage(Message* m) { - if (m->to != this) + if ((m->p_to != Message::BOXSTACK) && (m->to != this)) { for (int i = numBoxes-1; i >= 0; i--) { @@ -570,12 +570,11 @@ void BoxStack::processMessage(Message* m) return; } - /* Handle mouse events*/ - // They come in with m->to = NULL? and just need to be delivered to top box? - if ((numBoxes > 1) && ((m->message == Message::MOUSE_MOVE) || (m->message == Message::MOUSE_LBDOWN) - || (m->message == Message::MOUSE_SCROLL))) + // Handle mouse events + // They just need to be delivered to top box + if (m->p_to == Message::MOUSE_RECEIVER) { - boxes[numBoxes-1]->processMessage(m); + if (numBoxes > 1) boxes[numBoxes-1]->processMessage(m); return; } diff --git a/command.cc b/command.cc index 34bc1e6..54dee97 100644 --- a/command.cc +++ b/command.cc @@ -109,7 +109,7 @@ void Command::stop() Message* m = new Message(); // break master loop m->message = Message::SHUTDOWN; - m->to = this; + m->p_to = Message::CONTROL; postMessage(m); } @@ -231,7 +231,7 @@ void Command::processMessage(Message* m) logger->log("Command", Log::DEBUG, "processing message %i", m->message); - if ((m->p_to == Message::CONTROL) || (m->to == this)) + if ((m->p_to == Message::CONTROL) || (m->to == this)) // Maybe don't check m->to here? Always use predefined? { switch(m->message) { @@ -409,6 +409,7 @@ void Command::handleCommand(int button) } } +/* void Command::sig1() { #ifdef DEV @@ -418,6 +419,7 @@ void Command::sig1() postMessage(m); #endif } +*/ void Command::doStandby() { @@ -570,7 +572,7 @@ void Command::connectionLost() logger->unsetExternLogger(); Message* m = new Message(); // break into master mutex m->message = Message::CONNECTION_LOST; - m->to = this; + m->p_to = Message::CONTROL; postMessage(m); } diff --git a/command.h b/command.h index 70c7a4c..62fb740 100644 --- a/command.h +++ b/command.h @@ -85,7 +85,7 @@ class Command : public MessageQueue void doWallpaper(); void doFromTheTop(bool which); // true - show vinfo,wait. false - del vinfo,restart void buildCrashedBox(); - void sig1(); +// void sig1(); void clearMQInputEvents(); static Command* instance; diff --git a/message.h b/message.h index c709b80..e362ec2 100644 --- a/message.h +++ b/message.h @@ -41,7 +41,8 @@ class Message { NA = 0, CONTROL, - BOXSTACK + BOXSTACK, + MOUSE_RECEIVER }; Message(); diff --git a/vchannelselect.cc b/vchannelselect.cc index 8bdd594..1a6881b 100644 --- a/vchannelselect.cc +++ b/vchannelselect.cc @@ -120,7 +120,7 @@ void VChannelSelect::changeChannel() // Close me m = new Message(); // Delete self m->from = this; - m->to = BoxStack::getInstance(); + m->p_to = Message::BOXSTACK; m->message = Message::CLOSE_ME; MessageQueue::getInstance()->postMessage(m); } diff --git a/vepgsettimer.cc b/vepgsettimer.cc index b9a009b..a941293 100644 --- a/vepgsettimer.cc +++ b/vepgsettimer.cc @@ -277,7 +277,7 @@ void VEpgSetTimer::doit() Message* m = new Message(); m->message = Message::ADD_VIEW; - m->to = boxstack; + m->p_to = Message::BOXSTACK; m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } diff --git a/vmedialist.cc b/vmedialist.cc index ef22b7b..1db39aa 100644 --- a/vmedialist.cc +++ b/vmedialist.cc @@ -1176,7 +1176,7 @@ int VMediaList::load() { Message* m = new Message(); m->message = Message::ADD_VIEW; - m->to = boxstack; + m->p_to = Message::BOXSTACK; m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } diff --git a/vmediaview.cc b/vmediaview.cc index 87e0f10..6aca5b8 100644 --- a/vmediaview.cc +++ b/vmediaview.cc @@ -1071,7 +1071,7 @@ void VMediaView::destroyInfo(bool fromTimer){ void VMediaView::sendViewMsg(Boxx *v) { Message* m = new Message(); m->message = Message::CLOSE_ME; - m->to = BoxStack::getInstance(); + m->p_to = Message::BOXSTACK; m->from = v; m->parameter=(ULONG)v; MessageQueue::getInstance()->postMessage(m); diff --git a/vmute.cc b/vmute.cc index 9a8ccdc..c10ad78 100644 --- a/vmute.cc +++ b/vmute.cc @@ -69,7 +69,7 @@ void VMute::timercall(int /* clientReference */) // delete me! Message* m = new Message(); // Delete self m->message = Message::CLOSE_ME; - m->to = BoxStack::getInstance(); + m->p_to = Message::BOXSTACK; m->from = this; MessageQueue::getInstance()->postMessage(m); } diff --git a/vradiorec.cc b/vradiorec.cc index 0e6bc68..deacb62 100644 --- a/vradiorec.cc +++ b/vradiorec.cc @@ -155,7 +155,7 @@ void VRadioRec::go(bool resume) Message* m = new Message(); m->message = Message::CLOSE_ME; m->from = this; - m->to = boxstack; + m->p_to = Message::BOXSTACK; MessageQueue::getInstance()->postMessage(m); VInfo* vi = new VInfo(); @@ -173,7 +173,7 @@ void VRadioRec::go(bool resume) m = new Message(); m->message = Message::ADD_VIEW; - m->to = boxstack; + m->p_to = Message::BOXSTACK; m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } diff --git a/vrecording.cc b/vrecording.cc index 6e4eae5..9c763cd 100644 --- a/vrecording.cc +++ b/vrecording.cc @@ -260,7 +260,7 @@ int VRecording::handleCommand(int command) Message* m = new Message(); m->message = Message::ADD_VIEW; - m->to = BoxStack::getInstance(); + m->p_to = Message::BOXSTACK; m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); @@ -436,7 +436,7 @@ void VRecording::processMessage(Message* m) { Message* m2 = new Message(); // Delete self m2->from = this; - m2->to = BoxStack::getInstance(); + m2->p_to = Message::BOXSTACK; m2->message = Message::CLOSE_ME; MessageQueue::getInstance()->postMessage(m2); @@ -451,7 +451,7 @@ void VRecording::processMessage(Message* m) { Message* m2 = new Message(); // Delete self m2->from = this; - m2->to = BoxStack::getInstance(); + m2->p_to = Message::BOXSTACK; m2->message = Message::CLOSE_ME; MessageQueue::getInstance()->postMessage(m2); diff --git a/vrecordingmenu.cc b/vrecordingmenu.cc index 52dc306..7627ee2 100644 --- a/vrecordingmenu.cc +++ b/vrecordingmenu.cc @@ -221,7 +221,7 @@ void VRecordingMenu::processMessage(Message* m) { Message* m2 = new Message(); // Delete self m2->from = this; - m2->to = BoxStack::getInstance(); + m2->p_to = Message::BOXSTACK; m2->message = Message::CLOSE_ME; MessageQueue::getInstance()->postMessage(m2); @@ -236,7 +236,7 @@ void VRecordingMenu::processMessage(Message* m) { Message* m2 = new Message(); // Delete self m2->from = this; - m2->to = BoxStack::getInstance(); + m2->p_to = Message::BOXSTACK; m2->message = Message::CLOSE_ME; MessageQueue::getInstance()->postMessage(m2); diff --git a/vsleeptimer.cc b/vsleeptimer.cc index 5acb22d..9651396 100644 --- a/vsleeptimer.cc +++ b/vsleeptimer.cc @@ -159,7 +159,7 @@ void Sleeptimer::threadMethod() Message* m1 = new Message(); m1->message = Message::ADD_VIEW; - m1->to = BoxStack::getInstance(); + m1->p_to = Message::BOXSTACK; m1->data = reinterpret_cast(count); MessageQueue::getInstance()->postMessage(m1); } @@ -228,7 +228,7 @@ void VSleeptimer::timercall(int /* clientReference */) // delete me! Message* m = new Message(); // Delete self m->message = Message::CLOSE_ME; - m->to = BoxStack::getInstance(); + m->p_to = Message::BOXSTACK; m->from = this; MessageQueue::getInstance()->postMessage(m); } @@ -295,7 +295,7 @@ void VCountdown::timercall(int /* clientReference */) // delete me! Message* m = new Message(); // Delete self m->message = Message::CLOSE_ME; - m->to = BoxStack::getInstance(); + m->p_to = Message::BOXSTACK; m->from = this; MessageQueue::getInstance()->postMessage(m); } diff --git a/vtimeredit.cc b/vtimeredit.cc index a66aca0..214cff8 100644 --- a/vtimeredit.cc +++ b/vtimeredit.cc @@ -261,7 +261,7 @@ void VTimerEdit::processMessage(Message* m) { Message* m2 = new Message(); // Delete self m2->from = this; - m2->to = BoxStack::getInstance(); + m2->p_to = Message::BOXSTACK; m2->message = Message::CLOSE_ME; MessageQueue::getInstance()->postMessage(m2); diff --git a/vvideomedia.cc b/vvideomedia.cc index 8393920..13ffe3c 100644 --- a/vvideomedia.cc +++ b/vvideomedia.cc @@ -172,7 +172,7 @@ void VVideoMedia::go(bool resume) Message* m = new Message(); m->message = Message::CLOSE_ME; m->from = this; - m->to = boxstack; + m->p_to = Message::BOXSTACK; MessageQueue::getInstance()->postMessage(m); VInfo* vi = new VInfo(); @@ -190,7 +190,7 @@ void VVideoMedia::go(bool resume) m = new Message(); m->message = Message::ADD_VIEW; - m->to = boxstack; + m->p_to = Message::BOXSTACK; m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } @@ -378,7 +378,7 @@ void VVideoMedia::processMessage(Message* m) case PlayerMedia::STREAM_END: { Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex - m2->to = BoxStack::getInstance(); + m2->p_to = Message::BOXSTACK; m2->message = Message::CLOSE_ME; MessageQueue::getInstance()->postMessage(m2); break; diff --git a/vvideorec.cc b/vvideorec.cc index 7fe5c86..792f318 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -188,7 +188,7 @@ void VVideoRec::go(bool resume) Message* m = new Message(); m->message = Message::CLOSE_ME; m->from = this; - m->to = boxstack; + m->p_to = Message::BOXSTACK; MessageQueue::getInstance()->postMessage(m); VInfo* vi = new VInfo(); @@ -207,7 +207,7 @@ void VVideoRec::go(bool resume) m = new Message(); m->message = Message::ADD_VIEW; - m->to = boxstack; + m->p_to = Message::BOXSTACK; m->data = reinterpret_cast(vi); MessageQueue::getInstance()->postMessage(m); } diff --git a/vvolume.cc b/vvolume.cc index c0fc58a..dd6941d 100644 --- a/vvolume.cc +++ b/vvolume.cc @@ -85,7 +85,7 @@ void VVolume::timercall(int /* clientReference */) // delete me! Message* m = new Message(); // Delete self m->message = Message::CLOSE_ME; - m->to = BoxStack::getInstance(); + m->p_to = Message::BOXSTACK; m->from = this; MessageQueue::getInstance()->postMessage(m); } diff --git a/winmain.cc b/winmain.cc index 2ace407..631c70c 100644 --- a/winmain.cc +++ b/winmain.cc @@ -690,7 +690,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) Message *mousemes=new Message(); mousemes->message=Message::MOUSE_MOVE; mousemes->from=NULL; - mousemes->to=BoxStack::getInstance(); + mousemes->p_to = Message::MOUSE_RECEIVER; mousemes->parameter=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF); mousemes->tag=0; messageQueue->postMessage(mousemes); @@ -722,7 +722,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) Message *mousemes=new Message(); mousemes->message=Message::MOUSE_LBDOWN; mousemes->from=NULL; - mousemes->to=BoxStack::getInstance(); + mousemes->p_to = Message::MOUSE_RECEIVER; mousemes->parameter=(mpos.x & 0xFFFF)<< 16| (mpos.y & 0xFFFF); mousemes->tag=0; messageQueue->postMessage(mousemes); @@ -735,7 +735,7 @@ LONG FAR PASCAL WindowProc(HWND wind, UINT msg, WPARAM wparam, LPARAM lparam) Message *mousemes = new Message(); mousemes->message = Message::MOUSE_SCROLL; mousemes->from = NULL; - mousemes->to = BoxStack::getInstance(); + mousemes->p_to = Message::MOUSE_RECEIVER; mousemes->parameter = (0 & 0xFFFF) << 16 | (GET_WHEEL_DELTA_WPARAM(wparam) &0xFFFF); mousemes->tag = (mpos.x & 0xFFFF) << 16 | (mpos.y & 0xFFFF); messageQueue->postMessage(mousemes); -- 2.39.5