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 <[email protected]>
This commit is contained in:
committed by
Jérôme Duval
parent
23873c705c
commit
27c555cb7b
@@ -39,6 +39,7 @@ All rights reserved.
|
|||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
|
#include <Messenger.h>
|
||||||
#include <NodeMonitor.h>
|
#include <NodeMonitor.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <PathFinder.h>
|
#include <PathFinder.h>
|
||||||
@@ -641,6 +642,14 @@ BDeskWindow::MessageReceived(BMessage* message)
|
|||||||
BScreen(this).SetDesktopColor(*color);
|
BScreen(this).SetDesktopColor(*color);
|
||||||
fPoseView->SetViewColor(*color);
|
fPoseView->SetViewColor(*color);
|
||||||
fPoseView->SetLowColor(*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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public:
|
|||||||
BackgroundsWindow();
|
BackgroundsWindow();
|
||||||
|
|
||||||
void RefsReceived(BMessage* message);
|
void RefsReceived(BMessage* message);
|
||||||
|
void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
@@ -67,6 +68,14 @@ BackgroundsApplication::BackgroundsApplication()
|
|||||||
void
|
void
|
||||||
BackgroundsApplication::MessageReceived(BMessage* message)
|
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) {
|
switch (message->what) {
|
||||||
case B_SILENT_RELAUNCH:
|
case B_SILENT_RELAUNCH:
|
||||||
fWindow->Activate();
|
fWindow->Activate();
|
||||||
@@ -116,6 +125,13 @@ BackgroundsWindow::RefsReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BackgroundsWindow::MessageReceived(BMessage* message)
|
||||||
|
{
|
||||||
|
BMessenger(fBackgroundsView).SendMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BackgroundsWindow::QuitRequested()
|
BackgroundsWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -293,6 +293,19 @@ BackgroundsView::AllAttached()
|
|||||||
void
|
void
|
||||||
BackgroundsView::MessageReceived(BMessage* message)
|
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) {
|
switch (message->what) {
|
||||||
case B_SIMPLE_DATA:
|
case B_SIMPLE_DATA:
|
||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
|
|||||||
Reference in New Issue
Block a user