Fix #8881: Add color drops to Backgrounds
- The Backgrounds preferences app will now accept color drops. - The Backgrounds app will update if a color drop to the desktop has changed its color due to a direct color drop Signed-off-by: Jerome Duval <jerome.duval@gmail.com>
This commit is contained in:
parent
23873c705c
commit
27c555cb7b
|
@ -39,6 +39,7 @@ All rights reserved.
|
|||
#include <Debug.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <Locale.h>
|
||||
#include <Messenger.h>
|
||||
#include <NodeMonitor.h>
|
||||
#include <Path.h>
|
||||
#include <PathFinder.h>
|
||||
|
@ -641,6 +642,14 @@ BDeskWindow::MessageReceived(BMessage* message)
|
|||
BScreen(this).SetDesktopColor(*color);
|
||||
fPoseView->SetViewColor(*color);
|
||||
fPoseView->SetLowColor(*color);
|
||||
|
||||
// Notify the backgrounds app that the background changed
|
||||
status_t initStatus;
|
||||
BMessenger messenger("application/x-vnd.Haiku-Backgrounds", -1,
|
||||
&initStatus);
|
||||
if (initStatus == B_OK)
|
||||
messenger.SendMessage(message);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ public:
|
|||
BackgroundsWindow();
|
||||
|
||||
void RefsReceived(BMessage* message);
|
||||
void MessageReceived(BMessage* message);
|
||||
|
||||
protected:
|
||||
virtual bool QuitRequested();
|
||||
|
@ -67,6 +68,14 @@ BackgroundsApplication::BackgroundsApplication()
|
|||
void
|
||||
BackgroundsApplication::MessageReceived(BMessage* message)
|
||||
{
|
||||
const void *data;
|
||||
ssize_t size;
|
||||
if (message->WasDropped() && message->FindData("RGBColor", B_RGB_COLOR_TYPE,
|
||||
&data, &size) == B_OK) {
|
||||
// This is the desktop telling us that it was changed by a color drop
|
||||
BMessenger(fWindow).SendMessage(message);
|
||||
return;
|
||||
}
|
||||
switch (message->what) {
|
||||
case B_SILENT_RELAUNCH:
|
||||
fWindow->Activate();
|
||||
|
@ -116,6 +125,13 @@ BackgroundsWindow::RefsReceived(BMessage* message)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
BackgroundsWindow::MessageReceived(BMessage* message)
|
||||
{
|
||||
BMessenger(fBackgroundsView).SendMessage(message);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BackgroundsWindow::QuitRequested()
|
||||
{
|
||||
|
|
|
@ -293,6 +293,19 @@ BackgroundsView::AllAttached()
|
|||
void
|
||||
BackgroundsView::MessageReceived(BMessage* message)
|
||||
{
|
||||
// Color drop
|
||||
if (message->WasDropped()) {
|
||||
rgb_color *clr;
|
||||
ssize_t out_size;
|
||||
if (message->FindData("RGBColor", B_RGB_COLOR_TYPE,
|
||||
(const void **)&clr, &out_size) == B_OK) {
|
||||
fPicker->SetValue(*clr);
|
||||
_UpdatePreview();
|
||||
_UpdateButtons();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (message->what) {
|
||||
case B_SIMPLE_DATA:
|
||||
case B_REFS_RECEIVED:
|
||||
|
|
Loading…
Reference in New Issue