Added system color, system font, and decorator update notification

Added a little server-side code to handle system color updates


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5088 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2003-10-19 00:03:06 +00:00
parent 01490aa446
commit d6e461f029
4 changed files with 91 additions and 23 deletions
+1
View File
@@ -72,5 +72,6 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel
extern CursorManager *cursormanager; extern CursorManager *cursormanager;
extern BitmapManager *bitmapmanager; extern BitmapManager *bitmapmanager;
extern ColorSet gui_colorset;
#endif #endif
+44
View File
@@ -50,6 +50,7 @@
#include "ServerBitmap.h" #include "ServerBitmap.h"
#include "ServerPicture.h" #include "ServerPicture.h"
#include "ServerConfig.h" #include "ServerConfig.h"
#include "WinBorder.h"
#include "LayerData.h" #include "LayerData.h"
#include "Utils.h" #include "Utils.h"
@@ -348,6 +349,49 @@ void ServerApp::_DispatchMessage(PortMessage *msg)
fontserver->Unlock(); fontserver->Unlock();
break; break;
} }
case AS_UPDATE_COLORS:
{
ServerWindow *win;
BMessage msg(_COLORS_UPDATED);
for(int32 i=0; i<_winlist->CountItems(); i++)
{
win=(ServerWindow*)_winlist->ItemAt(i);
win->Lock();
win->_winborder->UpdateColors();
win->SendMessageToClient(&msg);
win->Unlock();
}
break;
}
case AS_UPDATE_FONTS:
{
ServerWindow *win;
BMessage msg(_FONTS_UPDATED);
for(int32 i=0; i<_winlist->CountItems(); i++)
{
win=(ServerWindow*)_winlist->ItemAt(i);
win->Lock();
win->_winborder->UpdateFont();
win->SendMessageToClient(&msg);
win->Unlock();
}
break;
}
case AS_UPDATE_DECORATOR:
{
ServerWindow *win;
for(int32 i=0; i<_winlist->CountItems(); i++)
{
win=(ServerWindow*)_winlist->ItemAt(i);
win->Lock();
win->_winborder->UpdateDecorator();
win->Unlock();
}
break;
}
case AS_CREATE_WINDOW: case AS_CREATE_WINDOW:
{ {
// Create the ServerWindow to node monitor a new OBWindow // Create the ServerWindow to node monitor a new OBWindow
+4 -2
View File
@@ -2150,13 +2150,15 @@ Layer* ServerWindow::FindLayer(const Layer* start, int32 token) const
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
void ServerWindow::SendMessageToClient( const BMessage* msg ) const{ void ServerWindow::SendMessageToClient( const BMessage* msg ) const
{
ssize_t size; ssize_t size;
char *buffer; char *buffer;
size = msg->FlattenedSize(); size = msg->FlattenedSize();
buffer = new char[size]; buffer = new char[size];
if ( msg->Flatten( buffer, size ) == B_OK ){ if ( msg->Flatten( buffer, size ) == B_OK )
{
write_port( winLooperPort, msg->what, buffer, size ); write_port( winLooperPort, msg->what, buffer, size );
} }
else else
+22 -1
View File
@@ -381,6 +381,7 @@ STRACE_CLICK(("ClickMove: Resize\n"));
void WinBorder::MouseUp(int8 *buffer) void WinBorder::MouseUp(int8 *buffer)
{ {
STRACE_MOUSE(("WinBorder %s: MouseUp() \n",_title->String())); STRACE_MOUSE(("WinBorder %s: MouseUp() \n",_title->String()));
// buffer data: // buffer data:
// 1) int64 - time of mouse click // 1) int64 - time of mouse click
// 2) float - x coordinate of mouse click // 2) float - x coordinate of mouse click
@@ -498,17 +499,37 @@ void WinBorder::ResizeBy(float x, float y)
*/ */
void WinBorder::UpdateColors(void) void WinBorder::UpdateColors(void)
{ {
STRACE(("WinBorder %s: UpdateColors unimplemented\n",_title->String())); gui_colorset.Lock();
_decorator->SetColors(gui_colorset);
gui_colorset.Unlock();
// Tell the decorator to update all visible regions of the window border
if(_visible)
for(int32 i=0; i<_visible->CountRects(); i++)
_decorator->Draw(_visible->RectAt(i));
} }
void WinBorder::UpdateDecorator(void) void WinBorder::UpdateDecorator(void)
{ {
STRACE(("WinBorder %s: UpdateDecorator unimplemented\n",_title->String())); STRACE(("WinBorder %s: UpdateDecorator unimplemented\n",_title->String()));
// TODO: Implement
// What needs done here is to delete the current decorator and do a lot of the
// decorator-related setup done in the constructor. This definitely needs to be
// done *after* all the silliness with figuring out the clipping code is taken care of
} }
void WinBorder::UpdateFont(void) void WinBorder::UpdateFont(void)
{ {
STRACE(("WinBorder %s: UpdateFont unimplemented\n",_title->String())); STRACE(("WinBorder %s: UpdateFont unimplemented\n",_title->String()));
// TODO: Implement
// What needs done here is to first call _decorator->SetFont(). Following that,
// GetFootprint() will need to be called to obtain changes in the decorator's size due to
// changes in the font, whether they are face, size, or whatever. Thus, the WinBorder will
// need to do some region-related recalculation, as well.
} }
void WinBorder::UpdateScreen(void) void WinBorder::UpdateScreen(void)