Lots of minor tweaks here and there
Added debug code to a number of files Enabled ServerWindow and WinBorder mouse-handling code ScreenDriver is now double-buffered (exceedingly useful for testing) I'm trying to think, but nothing happens! :D git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3052 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -130,7 +130,7 @@ AppServer::AppServer(void)
|
|||||||
_decor_lock=create_sem(1,"app_server_decor_sem");
|
_decor_lock=create_sem(1,"app_server_decor_sem");
|
||||||
|
|
||||||
// Get the driver first - Poller thread utilizes the thing
|
// Get the driver first - Poller thread utilizes the thing
|
||||||
_driver=GetGfxDriver();
|
_driver=GetGfxDriver(ActiveScreen());
|
||||||
|
|
||||||
// Spawn our input-polling thread
|
// Spawn our input-polling thread
|
||||||
_poller_id=spawn_thread(PollerThread, "Poller", B_NORMAL_PRIORITY, this);
|
_poller_id=spawn_thread(PollerThread, "Poller", B_NORMAL_PRIORITY, this);
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ void CursorManager::ShowCursor(void)
|
|||||||
{
|
{
|
||||||
acquire_sem(_lock);
|
acquire_sem(_lock);
|
||||||
|
|
||||||
DisplayDriver *driver=GetGfxDriver();
|
DisplayDriver *driver=GetGfxDriver(ActiveScreen());
|
||||||
driver->ShowCursor();
|
driver->ShowCursor();
|
||||||
release_sem(_lock);
|
release_sem(_lock);
|
||||||
}
|
}
|
||||||
@@ -160,7 +160,7 @@ void CursorManager::HideCursor(void)
|
|||||||
{
|
{
|
||||||
acquire_sem(_lock);
|
acquire_sem(_lock);
|
||||||
|
|
||||||
DisplayDriver *driver=GetGfxDriver();
|
DisplayDriver *driver=GetGfxDriver(ActiveScreen());
|
||||||
driver->HideCursor();
|
driver->HideCursor();
|
||||||
release_sem(_lock);
|
release_sem(_lock);
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ void CursorManager::ObscureCursor(void)
|
|||||||
{
|
{
|
||||||
acquire_sem(_lock);
|
acquire_sem(_lock);
|
||||||
|
|
||||||
DisplayDriver *driver=GetGfxDriver();
|
DisplayDriver *driver=GetGfxDriver(ActiveScreen());
|
||||||
driver->ObscureCursor();
|
driver->ObscureCursor();
|
||||||
release_sem(_lock);
|
release_sem(_lock);
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ void CursorManager::SetCursor(int32 token)
|
|||||||
ServerCursor *c=_FindCursor(token);
|
ServerCursor *c=_FindCursor(token);
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
DisplayDriver *driver=GetGfxDriver();
|
DisplayDriver *driver=GetGfxDriver(ActiveScreen());
|
||||||
driver->SetCursor(c);
|
driver->SetCursor(c);
|
||||||
_current_which=B_CURSOR_OTHER;
|
_current_which=B_CURSOR_OTHER;
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ void CursorManager::SetCursor(cursor_which which)
|
|||||||
{
|
{
|
||||||
acquire_sem(_lock);
|
acquire_sem(_lock);
|
||||||
|
|
||||||
DisplayDriver *driver=GetGfxDriver();
|
DisplayDriver *driver=GetGfxDriver(ActiveScreen());
|
||||||
switch(which)
|
switch(which)
|
||||||
{
|
{
|
||||||
case B_CURSOR_DEFAULT:
|
case B_CURSOR_DEFAULT:
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
#include "RGBColor.h"
|
#include "RGBColor.h"
|
||||||
|
|
||||||
//#define DEBUG_DECORATOR
|
//#define DEBUG_DECORATOR
|
||||||
|
|
||||||
|
|
||||||
#define USE_VIEW_FILL_HACK
|
#define USE_VIEW_FILL_HACK
|
||||||
|
|
||||||
#ifdef DEBUG_DECORATOR
|
#ifdef DEBUG_DECORATOR
|
||||||
@@ -141,8 +143,8 @@ else
|
|||||||
if(_tabrect.Contains(pt))
|
if(_tabrect.Contains(pt))
|
||||||
{
|
{
|
||||||
// Here's part of our window management stuff
|
// Here's part of our window management stuff
|
||||||
if(buttons==B_PRIMARY_MOUSE_BUTTON && !GetFocus())
|
// if(buttons==B_PRIMARY_MOUSE_BUTTON && !GetFocus())
|
||||||
return CLICK_MOVETOFRONT;
|
// return CLICK_MOVETOFRONT;
|
||||||
if(buttons==B_SECONDARY_MOUSE_BUTTON)
|
if(buttons==B_SECONDARY_MOUSE_BUTTON)
|
||||||
return CLICK_MOVETOBACK;
|
return CLICK_MOVETOBACK;
|
||||||
return CLICK_DRAG;
|
return CLICK_DRAG;
|
||||||
|
|||||||
@@ -41,6 +41,12 @@
|
|||||||
|
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
|
|
||||||
|
//#define DEBUG_DESKTOP
|
||||||
|
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
//! This namespace encapsulates all globals specifically for the desktop
|
//! This namespace encapsulates all globals specifically for the desktop
|
||||||
namespace desktop_private {
|
namespace desktop_private {
|
||||||
int8 *dragmessage=NULL;
|
int8 *dragmessage=NULL;
|
||||||
@@ -73,12 +79,14 @@ void unlock_workspaces(void) { desktop_private::workspacelock.Unlock(); }
|
|||||||
*/
|
*/
|
||||||
void InitDesktop(void)
|
void InitDesktop(void)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: InitWorkspace\n");
|
||||||
|
#endif
|
||||||
desktop_private::screenlist=new BList(0);
|
desktop_private::screenlist=new BList(0);
|
||||||
DisplayDriver *tdriver;
|
DisplayDriver *tdriver;
|
||||||
Screen *s=NULL;
|
Screen *s=NULL;
|
||||||
|
|
||||||
#ifndef TEST_MODE
|
#ifndef TEST_MODE
|
||||||
|
|
||||||
// If we're using the AccelerantDriver for rendering, eventually we will loop through
|
// If we're using the AccelerantDriver for rendering, eventually we will loop through
|
||||||
// drivers until one can't initialize in order to support multiple monitors. For now,
|
// drivers until one can't initialize in order to support multiple monitors. For now,
|
||||||
// we'll just load one and be done with it.
|
// we'll just load one and be done with it.
|
||||||
@@ -99,6 +107,9 @@ void InitDesktop(void)
|
|||||||
tdriver->Shutdown();
|
tdriver->Shutdown();
|
||||||
delete tdriver;
|
delete tdriver;
|
||||||
tdriver=NULL;
|
tdriver=NULL;
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("\t NULL display driver. OK. We crash now. :P\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -123,6 +134,9 @@ void InitDesktop(void)
|
|||||||
tdriver->Shutdown();
|
tdriver->Shutdown();
|
||||||
delete tdriver;
|
delete tdriver;
|
||||||
tdriver=NULL;
|
tdriver=NULL;
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("\t NULL display driver. OK. We crash now. :P\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -133,11 +147,18 @@ void InitDesktop(void)
|
|||||||
desktop_private::activescreen=s;
|
desktop_private::activescreen=s;
|
||||||
s->SetSpace(0,B_32_BIT_640x480,true);
|
s->SetSpace(0,B_32_BIT_640x480,true);
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
else
|
||||||
|
printf("ERROR: NULL display driver\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Shuts down the graphics subsystem
|
//! Shuts down the graphics subsystem
|
||||||
void ShutdownDesktop(void)
|
void ShutdownDesktop(void)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: ShutdownDesktop\n");
|
||||||
|
#endif
|
||||||
Screen *s;
|
Screen *s;
|
||||||
|
|
||||||
for(int32 i=0;i<desktop_private::screenlist->CountItems();i++)
|
for(int32 i=0;i<desktop_private::screenlist->CountItems();i++)
|
||||||
@@ -165,6 +186,9 @@ void ShutdownDesktop(void)
|
|||||||
*/
|
*/
|
||||||
void AddWorkspace(int32 index=-1)
|
void AddWorkspace(int32 index=-1)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: AddWorkspace(%ld)\n",index+1);
|
||||||
|
#endif
|
||||||
lock_workspaces();
|
lock_workspaces();
|
||||||
lock_layers();
|
lock_layers();
|
||||||
|
|
||||||
@@ -192,6 +216,9 @@ void AddWorkspace(int32 index=-1)
|
|||||||
*/
|
*/
|
||||||
void DeleteWorkspace(int32 index)
|
void DeleteWorkspace(int32 index)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: DeleteWorkspace(%ld)\n",index+1);
|
||||||
|
#endif
|
||||||
lock_workspaces();
|
lock_workspaces();
|
||||||
lock_layers();
|
lock_layers();
|
||||||
|
|
||||||
@@ -214,7 +241,6 @@ void DeleteWorkspace(int32 index)
|
|||||||
*/
|
*/
|
||||||
int32 CountWorkspaces(void)
|
int32 CountWorkspaces(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
lock_workspaces();
|
lock_workspaces();
|
||||||
lock_layers();
|
lock_layers();
|
||||||
|
|
||||||
@@ -238,6 +264,9 @@ int32 CountWorkspaces(void)
|
|||||||
*/
|
*/
|
||||||
void SetWorkspaceCount(int32 count)
|
void SetWorkspaceCount(int32 count)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: SetWorkspaceCount(%ld)\n",count);
|
||||||
|
#endif
|
||||||
if(count<1 || count>32)
|
if(count<1 || count>32)
|
||||||
return;
|
return;
|
||||||
lock_workspaces();
|
lock_workspaces();
|
||||||
@@ -290,6 +319,9 @@ Workspace *WorkspaceAt(int32 index)
|
|||||||
*/
|
*/
|
||||||
void SetWorkspace(int32 workspace)
|
void SetWorkspace(int32 workspace)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: SetWorkspace(%ld)\n",workspace+1);
|
||||||
|
#endif
|
||||||
lock_workspaces();
|
lock_workspaces();
|
||||||
if(workspace<0 || workspace>(CountWorkspaces()-1))
|
if(workspace<0 || workspace>(CountWorkspaces()-1))
|
||||||
{
|
{
|
||||||
@@ -314,6 +346,9 @@ void SetWorkspace(int32 workspace)
|
|||||||
*/
|
*/
|
||||||
void SetScreen(screen_id id)
|
void SetScreen(screen_id id)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: SetScreen(%ld)\n",id.id);
|
||||||
|
#endif
|
||||||
Screen *scr;
|
Screen *scr;
|
||||||
for(int32 i=0;i<desktop_private::screenlist->CountItems();i++)
|
for(int32 i=0;i<desktop_private::screenlist->CountItems();i++)
|
||||||
{
|
{
|
||||||
@@ -355,7 +390,7 @@ screen_id ActiveScreen(void)
|
|||||||
Like the other multiscreen functions, this is unused. Because multiple screens are
|
Like the other multiscreen functions, this is unused. Because multiple screens are
|
||||||
not utilized, specifying an ID other than B_MAIN_SCREEN_ID will return NULL
|
not utilized, specifying an ID other than B_MAIN_SCREEN_ID will return NULL
|
||||||
*/
|
*/
|
||||||
DisplayDriver *GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID)
|
DisplayDriver *GetGfxDriver(screen_id screen)
|
||||||
{
|
{
|
||||||
return (desktop_private::activescreen)?desktop_private::activescreen->GetGfxDriver():NULL;
|
return (desktop_private::activescreen)?desktop_private::activescreen->GetGfxDriver():NULL;
|
||||||
}
|
}
|
||||||
@@ -370,8 +405,12 @@ DisplayDriver *GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID)
|
|||||||
|
|
||||||
Because of the lack of outside multimonitor support, the screen ID is ignored for now.
|
Because of the lack of outside multimonitor support, the screen ID is ignored for now.
|
||||||
*/
|
*/
|
||||||
status_t SetSpace(int32 index, int32 res, bool stick=true, screen_id screen=B_MAIN_SCREEN_ID)
|
status_t SetSpace(int32 index, int32 res, screen_id screen, bool stick=true)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: SetSpace(%ld,%ld,%s,%ld)\n",index+1,res,
|
||||||
|
stick?"stick":"non-stick",screen.id);
|
||||||
|
#endif
|
||||||
desktop_private::workspacelock.Lock();
|
desktop_private::workspacelock.Lock();
|
||||||
status_t stat=desktop_private::activescreen->SetSpace(index,res,stick);
|
status_t stat=desktop_private::activescreen->SetSpace(index,res,stick);
|
||||||
desktop_private::workspacelock.Unlock();
|
desktop_private::workspacelock.Unlock();
|
||||||
@@ -384,8 +423,12 @@ status_t SetSpace(int32 index, int32 res, bool stick=true, screen_id screen=B_MA
|
|||||||
\param workspace index of the workspace to add the window to
|
\param workspace index of the workspace to add the window to
|
||||||
\param screen Optional screen specifier. Currently unused.
|
\param screen Optional screen specifier. Currently unused.
|
||||||
*/
|
*/
|
||||||
void AddWindowToDesktop(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)
|
void AddWindowToDesktop(ServerWindow *win, int32 workspace, screen_id screen)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: AddWindowToDesktop(%s,%ld,%ld)\n",win?win->GetTitle():"NULL",
|
||||||
|
workspace+1,screen.id);
|
||||||
|
#endif
|
||||||
// Workspace() will be non-NULL if it has already been added to the desktop
|
// Workspace() will be non-NULL if it has already been added to the desktop
|
||||||
if(!win || win->GetWorkspace())
|
if(!win || win->GetWorkspace())
|
||||||
return;
|
return;
|
||||||
@@ -407,6 +450,9 @@ void AddWindowToDesktop(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE,
|
|||||||
*/
|
*/
|
||||||
void RemoveWindowFromDesktop(ServerWindow *win)
|
void RemoveWindowFromDesktop(ServerWindow *win)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: RemoveWindowFromDesktop(%s)\n",win?win->GetTitle():"NULL");
|
||||||
|
#endif
|
||||||
lock_workspaces();
|
lock_workspaces();
|
||||||
lock_layers();
|
lock_layers();
|
||||||
|
|
||||||
@@ -438,6 +484,9 @@ ServerWindow *GetActiveWindow(void)
|
|||||||
*/
|
*/
|
||||||
void SetActiveWindow(ServerWindow *win)
|
void SetActiveWindow(ServerWindow *win)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DESKTOP
|
||||||
|
printf("Desktop: SetActiveWindow(%s)\n",win?win->GetTitle():"NULL");
|
||||||
|
#endif
|
||||||
lock_workspaces();
|
lock_workspaces();
|
||||||
Workspace *w=desktop_private::activescreen->GetActiveWorkspace();
|
Workspace *w=desktop_private::activescreen->GetActiveWorkspace();
|
||||||
if(win->GetWorkspace()!=w)
|
if(win->GetWorkspace()!=w)
|
||||||
@@ -458,7 +507,7 @@ void SetActiveWindow(ServerWindow *win)
|
|||||||
\param screen Index of the screen to use. Currently ignored.
|
\param screen Index of the screen to use. Currently ignored.
|
||||||
\return The root layer or NULL if there was an invalid parameter.
|
\return The root layer or NULL if there was an invalid parameter.
|
||||||
*/
|
*/
|
||||||
Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID)
|
Layer *GetRootLayer(int32 workspace, screen_id screen)
|
||||||
{
|
{
|
||||||
lock_workspaces();
|
lock_workspaces();
|
||||||
lock_layers();
|
lock_layers();
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ void SetWorkspace(int32 workspace);
|
|||||||
void SetScreen(screen_id id);
|
void SetScreen(screen_id id);
|
||||||
int32 CountScreens(void);
|
int32 CountScreens(void);
|
||||||
screen_id ActiveScreen(void);
|
screen_id ActiveScreen(void);
|
||||||
DisplayDriver *GetGfxDriver(screen_id screen=B_MAIN_SCREEN_ID);
|
DisplayDriver *GetGfxDriver(screen_id screen);
|
||||||
status_t SetSpace(int32 index, int32 res, bool stick=true, screen_id screen=B_MAIN_SCREEN_ID);
|
status_t SetSpace(int32 index, int32 res, screen_id screen, bool stick=true);
|
||||||
|
|
||||||
void AddWindowToDesktop(ServerWindow *win, int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID);
|
void AddWindowToDesktop(ServerWindow *win, int32 workspace, screen_id screen);
|
||||||
void RemoveWindowFromDesktop(ServerWindow *win);
|
void RemoveWindowFromDesktop(ServerWindow *win);
|
||||||
ServerWindow *GetActiveWindow(void);
|
ServerWindow *GetActiveWindow(void);
|
||||||
void SetActiveWindow(ServerWindow *win);
|
void SetActiveWindow(ServerWindow *win);
|
||||||
Layer *GetRootLayer(int32 workspace=B_CURRENT_WORKSPACE, screen_id screen=B_MAIN_SCREEN_ID);
|
Layer *GetRootLayer(int32 workspace, screen_id screen);
|
||||||
|
|
||||||
void set_drag_message(int32 size, int8 *flattened);
|
void set_drag_message(int32 size, int8 *flattened);
|
||||||
int8* get_drag_message(int32 *size);
|
int8* get_drag_message(int32 *size);
|
||||||
|
|||||||
@@ -30,6 +30,16 @@
|
|||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "WinBorder.h"
|
#include "WinBorder.h"
|
||||||
|
|
||||||
|
//#define DEBUG_WORKSPACE
|
||||||
|
//#define DEBUG_SCREEN
|
||||||
|
|
||||||
|
#ifdef DEBUG_WORKSPACE
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Defined and initialized in AppServer.cpp
|
// Defined and initialized in AppServer.cpp
|
||||||
extern RGBColor workspace_default_color;
|
extern RGBColor workspace_default_color;
|
||||||
TokenHandler screen_id_handler;
|
TokenHandler screen_id_handler;
|
||||||
@@ -49,6 +59,9 @@ Workspace::Workspace(const graphics_card_info &gcinfo, const frame_buffer_info &
|
|||||||
_rootlayer=new RootLayer(BRect(0,0,fbinfo.display_width-1,fbinfo.display_height-1),
|
_rootlayer=new RootLayer(BRect(0,0,fbinfo.display_width-1,fbinfo.display_height-1),
|
||||||
"Workspace Root",_screen->GetGfxDriver());
|
"Workspace Root",_screen->GetGfxDriver());
|
||||||
_rootlayer->SetColor(workspace_default_color);
|
_rootlayer->SetColor(workspace_default_color);
|
||||||
|
#ifdef DEBUG_WORKSPACE
|
||||||
|
printf("Workspace::Workspace(%s)\n",_rootlayer->GetName());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -56,6 +69,9 @@ Workspace::Workspace(const graphics_card_info &gcinfo, const frame_buffer_info &
|
|||||||
*/
|
*/
|
||||||
Workspace::~Workspace(void)
|
Workspace::~Workspace(void)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WORKSPACE
|
||||||
|
printf("Workspace::~Workspace(%s)\n",_rootlayer->GetName());
|
||||||
|
#endif
|
||||||
if(_rootlayer)
|
if(_rootlayer)
|
||||||
{
|
{
|
||||||
_rootlayer->PruneTree();
|
_rootlayer->PruneTree();
|
||||||
@@ -70,6 +86,9 @@ Workspace::~Workspace(void)
|
|||||||
*/
|
*/
|
||||||
void Workspace::SetBGColor(const RGBColor &c)
|
void Workspace::SetBGColor(const RGBColor &c)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WORKSPACE
|
||||||
|
printf("Workspace::SetBGColor(): "); c.PrintToStream();
|
||||||
|
#endif
|
||||||
_rootlayer->SetColor(c);
|
_rootlayer->SetColor(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +117,9 @@ RootLayer *Workspace::GetRoot(void)
|
|||||||
*/
|
*/
|
||||||
void Workspace::SetData(const graphics_card_info &gcinfo, const frame_buffer_info &fbinfo)
|
void Workspace::SetData(const graphics_card_info &gcinfo, const frame_buffer_info &fbinfo)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WORKSPACE
|
||||||
|
printf("Workspace::SetData(%s)\n",_rootlayer->GetName());
|
||||||
|
#endif
|
||||||
if(_fbinfo.display_width!=fbinfo.display_width ||
|
if(_fbinfo.display_width!=fbinfo.display_width ||
|
||||||
_fbinfo.display_height!=fbinfo.display_height)
|
_fbinfo.display_height!=fbinfo.display_height)
|
||||||
{
|
{
|
||||||
@@ -128,6 +150,9 @@ void Workspace::GetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo)
|
|||||||
*/
|
*/
|
||||||
void Workspace::SetSpace(int32 res)
|
void Workspace::SetSpace(int32 res)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WORKSPACE
|
||||||
|
printf("Workspace::SetSpace(%ld) unimplemented\n",res);
|
||||||
|
#endif
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,6 +163,9 @@ void Workspace::SetSpace(int32 res)
|
|||||||
*/
|
*/
|
||||||
Screen::Screen(DisplayDriver *gfxmodule, uint8 workspaces)
|
Screen::Screen(DisplayDriver *gfxmodule, uint8 workspaces)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::Screen(%s,%u)\n",gfxmodule?"driver":"NULL",workspaces);
|
||||||
|
#endif
|
||||||
_workspacelist=NULL;
|
_workspacelist=NULL;
|
||||||
_driver=gfxmodule;
|
_driver=gfxmodule;
|
||||||
_resolution=0;
|
_resolution=0;
|
||||||
@@ -189,6 +217,9 @@ Screen::Screen(DisplayDriver *gfxmodule, uint8 workspaces)
|
|||||||
*/
|
*/
|
||||||
Screen::~Screen(void)
|
Screen::~Screen(void)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::~Screen\n");
|
||||||
|
#endif
|
||||||
if ( _workspacelist )
|
if ( _workspacelist )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -206,6 +237,9 @@ Screen::~Screen(void)
|
|||||||
*/
|
*/
|
||||||
void Screen::AddWorkspace(int32 index)
|
void Screen::AddWorkspace(int32 index)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::AddWorkspace(%ld)\n",index+1);
|
||||||
|
#endif
|
||||||
Workspace *workspace = new Workspace(_gcinfo,_fbinfo,this);
|
Workspace *workspace = new Workspace(_gcinfo,_fbinfo,this);
|
||||||
if ( (index == -1) || !_workspacelist->AddItem(workspace,index) )
|
if ( (index == -1) || !_workspacelist->AddItem(workspace,index) )
|
||||||
_workspacelist->AddItem(workspace);
|
_workspacelist->AddItem(workspace);
|
||||||
@@ -217,6 +251,9 @@ void Screen::AddWorkspace(int32 index)
|
|||||||
*/
|
*/
|
||||||
void Screen::DeleteWorkspace(int32 index)
|
void Screen::DeleteWorkspace(int32 index)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::DeleteWorkspace(%ld)\n",index+1);
|
||||||
|
#endif
|
||||||
Workspace *workspace;
|
Workspace *workspace;
|
||||||
workspace = (Workspace *)_workspacelist->RemoveItem(index);
|
workspace = (Workspace *)_workspacelist->RemoveItem(index);
|
||||||
if ( workspace )
|
if ( workspace )
|
||||||
@@ -255,6 +292,10 @@ void Screen::SetWorkspaceCount(int32 count)
|
|||||||
_workspacecount = count;
|
_workspacecount = count;
|
||||||
if ( _currentworkspace > count-1 )
|
if ( _currentworkspace > count-1 )
|
||||||
SetWorkspace(count-1);
|
SetWorkspace(count-1);
|
||||||
|
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::SetWorkspaceCount(%ld)\n",count);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -272,6 +313,9 @@ int32 Screen::CurrentWorkspace(void)
|
|||||||
*/
|
*/
|
||||||
void Screen::SetWorkspace(int32 index)
|
void Screen::SetWorkspace(int32 index)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::SetWorkspace(%ld)\n",index+1);
|
||||||
|
#endif
|
||||||
if ( (index >= 0) && (index <= _workspacecount-1) )
|
if ( (index >= 0) && (index <= _workspacecount-1) )
|
||||||
{
|
{
|
||||||
_currentworkspace = index;
|
_currentworkspace = index;
|
||||||
@@ -285,6 +329,9 @@ void Screen::SetWorkspace(int32 index)
|
|||||||
*/
|
*/
|
||||||
void Screen::Activate(bool active)
|
void Screen::Activate(bool active)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::Activate(%s)\n",active?"active":"inactive");
|
||||||
|
#endif
|
||||||
_active=active;
|
_active=active;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,6 +353,9 @@ DisplayDriver *Screen::GetGfxDriver(void)
|
|||||||
*/
|
*/
|
||||||
status_t Screen::SetSpace(int32 index, int32 res,bool stick)
|
status_t Screen::SetSpace(int32 index, int32 res,bool stick)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::SetSpace(%ld,%ld,%s)\n",index,res,stick?"stick":"non-stick");
|
||||||
|
#endif
|
||||||
// the specified workspace isn't active, so this should be easy...
|
// the specified workspace isn't active, so this should be easy...
|
||||||
Workspace *wkspc=(Workspace*)_workspacelist->ItemAt(index);
|
Workspace *wkspc=(Workspace*)_workspacelist->ItemAt(index);
|
||||||
if(!wkspc)
|
if(!wkspc)
|
||||||
@@ -332,6 +382,9 @@ status_t Screen::SetSpace(int32 index, int32 res,bool stick)
|
|||||||
*/
|
*/
|
||||||
void Screen::AddWindow(ServerWindow *win, int32 workspace)
|
void Screen::AddWindow(ServerWindow *win, int32 workspace)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::AddWindow(%s,%ld)\n",win?win->GetTitle():"NULL", workspace+1);
|
||||||
|
#endif
|
||||||
if(!win || !win->_winborder)
|
if(!win || !win->_winborder)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -349,6 +402,9 @@ void Screen::AddWindow(ServerWindow *win, int32 workspace)
|
|||||||
*/
|
*/
|
||||||
void Screen::RemoveWindow(ServerWindow *win)
|
void Screen::RemoveWindow(ServerWindow *win)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_SCREEN
|
||||||
|
printf("Screen::RemoveWindow(%s)\n",win?win->GetTitle():"NULL");
|
||||||
|
#endif
|
||||||
if(!win || !win->_winborder)
|
if(!win || !win->_winborder)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "TokenHandler.h"
|
#include "TokenHandler.h"
|
||||||
#include "RectUtils.h"
|
#include "RectUtils.h"
|
||||||
|
|
||||||
#define DEBUG_LAYER
|
//#define DEBUG_LAYER
|
||||||
|
|
||||||
//! TokenHandler object used to provide IDs for all Layers and, thus, BViews
|
//! TokenHandler object used to provide IDs for all Layers and, thus, BViews
|
||||||
TokenHandler view_token_handler;
|
TokenHandler view_token_handler;
|
||||||
@@ -970,3 +970,14 @@ BRect Layer::ConvertFromTop(BRect rect)
|
|||||||
else
|
else
|
||||||
return(rect);
|
return(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Implement and document
|
||||||
|
void Layer::MakeTopChild(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Implement and document
|
||||||
|
void Layer::MakeBottomChild(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public:
|
|||||||
Layer *FindLayer(int32 token);
|
Layer *FindLayer(int32 token);
|
||||||
Layer *GetChildAt(BPoint pt, bool recursive=false);
|
Layer *GetChildAt(BPoint pt, bool recursive=false);
|
||||||
PortLink *GetLink(void);
|
PortLink *GetLink(void);
|
||||||
|
const char *GetName(void) { return (_name)?_name->String():NULL; }
|
||||||
|
|
||||||
void Invalidate(BRect rect);
|
void Invalidate(BRect rect);
|
||||||
void Invalidate(BRegion region);
|
void Invalidate(BRegion region);
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ RGBColor RGBColor::MakeBlendColor(RGBColor color, float position)
|
|||||||
/*!
|
/*!
|
||||||
\brief Prints the 32-bit values of the color to standard out
|
\brief Prints the 32-bit values of the color to standard out
|
||||||
*/
|
*/
|
||||||
void RGBColor::PrintToStream(void)
|
void RGBColor::PrintToStream(void) const
|
||||||
{
|
{
|
||||||
printf("RGBColor (%u,%u,%u,%u)\n", color32.red,color32.green,color32.blue,color32.alpha);
|
printf("RGBColor (%u,%u,%u,%u)\n", color32.red,color32.green,color32.blue,color32.alpha);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
RGBColor(const RGBColor &col);
|
RGBColor(const RGBColor &col);
|
||||||
RGBColor(void);
|
RGBColor(void);
|
||||||
|
|
||||||
void PrintToStream(void);
|
void PrintToStream(void) const;
|
||||||
|
|
||||||
uint8 GetColor8(void);
|
uint8 GetColor8(void);
|
||||||
uint16 GetColor16(void);
|
uint16 GetColor16(void);
|
||||||
|
|||||||
@@ -44,11 +44,13 @@ RootLayer::RootLayer(BRect rect, const char *layername, DisplayDriver *gfxdriver
|
|||||||
_driver=gfxdriver;
|
_driver=gfxdriver;
|
||||||
_invalid=new BRegion(Bounds());
|
_invalid=new BRegion(Bounds());
|
||||||
_is_dirty=true;
|
_is_dirty=true;
|
||||||
|
_bgcolor=new RGBColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Frees all allocated heap memory (which happens to be none) ;)
|
//! Frees all allocated heap memory (which happens to be none) ;)
|
||||||
RootLayer::~RootLayer()
|
RootLayer::~RootLayer()
|
||||||
{
|
{
|
||||||
|
delete _bgcolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
+648
-1733
File diff suppressed because it is too large
Load Diff
@@ -29,58 +29,24 @@
|
|||||||
#define _SCREENDRIVER_H_
|
#define _SCREENDRIVER_H_
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <WindowScreen.h>
|
#include <Window.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <GraphicsCard.h>
|
#include <GraphicsCard.h>
|
||||||
#include <Accelerant.h>
|
#include <GraphicsDefs.h> // for pattern struct
|
||||||
|
#include <Cursor.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <OS.h>
|
#include <Region.h>
|
||||||
#include <Locker.h>
|
#include <Font.h>
|
||||||
#include <Region.h> // for clipping_rect definition
|
|
||||||
#include <Bitmap.h>
|
|
||||||
#include <OS.h>
|
|
||||||
#include "DisplayDriver.h"
|
#include "DisplayDriver.h"
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
|
#include <WindowScreen.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
#include FT_GLYPH_H
|
|
||||||
|
|
||||||
class VDWindow;
|
class BBitmap;
|
||||||
class ServerCursor;
|
|
||||||
class ServerBitmap;
|
|
||||||
class RGBColor;
|
|
||||||
class PortLink;
|
class PortLink;
|
||||||
|
class SDWindow;
|
||||||
|
class LayerData;
|
||||||
class ScreenDriver;
|
class ScreenDriver;
|
||||||
class PatternHandler;
|
|
||||||
|
|
||||||
// defines to translate acceleration function indices to something I can remember
|
|
||||||
#define HWLINE_8BIT 3
|
|
||||||
#define HWLINE_32BIT 4
|
|
||||||
#define HWRECT_8BIT 5
|
|
||||||
#define HWRECT_32BIT 6
|
|
||||||
#define HWBLIT 7
|
|
||||||
#define HWLINEARRAY_8BIT 8
|
|
||||||
#define HWLINEARRAY_32BIT 9
|
|
||||||
#define HWSYNC 10
|
|
||||||
#define HWINVERT 11
|
|
||||||
#define HWLINE_16BIT 12
|
|
||||||
#define HWRECT_16BIT 13
|
|
||||||
|
|
||||||
// function pointer typedefs for accelerated 2d functions - from Be Advanced Topics.
|
|
||||||
typedef int32 hwline8bit(int32 sx,int32 dx, int32 sy, int32 dy, uint8 color,
|
|
||||||
bool cliptorect,int16 clipleft, int16 cliptop, int16 clipright, int16 clipbottom);
|
|
||||||
typedef int32 hwline32bit(int32 sx,int32 dx, int32 sy, int32 dy, uint32 color,
|
|
||||||
bool cliptorect,int16 clipleft, int16 cliptop, int16 clipright, int16 clipbottom);
|
|
||||||
typedef int32 hwrect8bit(int32 left, int32 top, int32 right, int32 bottom, uint8 color);
|
|
||||||
typedef int32 hwrect32bit(int32 left, int32 top, int32 right, int32 bottom, uint32 color);
|
|
||||||
typedef int32 hwblit(int32 sx, int32 sy, int32 dx, int32 dy, int32 width, int32 height);
|
|
||||||
typedef int32 hwlinearray8bit(indexed_color_line *array, int32 linecount,
|
|
||||||
bool cliptorect,int16 clipleft, int16 cliptop, int16 clipright, int16 clipbottom);
|
|
||||||
typedef int32 hwlinearray32bit(rgb_color_line *array, int32 linecount,
|
|
||||||
bool cliptorect,int16 clipleft, int16 cliptop, int16 clipright, int16 clipbottom);
|
|
||||||
typedef int32 hwsync(void);
|
|
||||||
typedef int32 hwline16bit(int32 sx,int32 dx, int32 sy, int32 dy, uint16 color,
|
|
||||||
bool cliptorect,int16 clipleft, int16 cliptop, int16 clipright, int16 clipbottom);
|
|
||||||
typedef int32 hwrect16bit(int32 left, int32 top, int32 right, int32 bottom, uint16 color);
|
|
||||||
|
|
||||||
class FrameBuffer : public BWindowScreen
|
class FrameBuffer : public BWindowScreen
|
||||||
{
|
{
|
||||||
@@ -92,9 +58,9 @@ public:
|
|||||||
bool IsConnected(void) const { return is_connected; }
|
bool IsConnected(void) const { return is_connected; }
|
||||||
bool QuitRequested(void);
|
bool QuitRequested(void);
|
||||||
static int32 MouseMonitor(void *data);
|
static int32 MouseMonitor(void *data);
|
||||||
|
static int32 CopyThread(void *data);
|
||||||
|
void Invalidate(const BRect &r);
|
||||||
graphics_card_info gcinfo;
|
graphics_card_info gcinfo;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend ScreenDriver;
|
friend ScreenDriver;
|
||||||
|
|
||||||
@@ -102,56 +68,65 @@ protected:
|
|||||||
PortLink *serverlink;
|
PortLink *serverlink;
|
||||||
BPoint mousepos;
|
BPoint mousepos;
|
||||||
uint32 buttons;
|
uint32 buttons;
|
||||||
thread_id monitor_thread;
|
thread_id monitor_thread,copy_thread;
|
||||||
BView *view;
|
BView *view;
|
||||||
|
BBitmap *viewbmp;
|
||||||
|
ServerBitmap *cursor;
|
||||||
|
BRegion *invalid;
|
||||||
|
int32 invalidflag;
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
class SDView : public BView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SDView(BRect bounds);
|
||||||
|
~SDView(void);
|
||||||
|
void AttachedToWindow(void);
|
||||||
|
void Draw(BRect rect);
|
||||||
|
void MouseDown(BPoint pt);
|
||||||
|
void MouseMoved(BPoint pt, uint32 transit, const BMessage *msg);
|
||||||
|
void MouseUp(BPoint pt);
|
||||||
|
void MessageReceived(BMessage *msg);
|
||||||
|
|
||||||
// HW Acceleration stuff
|
BBitmap *viewbmp;
|
||||||
display_mode _dm;
|
PortLink *serverlink;
|
||||||
|
|
||||||
frame_buffer_config _fbc;
|
int hide_cursor;
|
||||||
|
BBitmap *cursor;
|
||||||
|
|
||||||
set_cursor_shape _scs;
|
BRect cursorframe, oldcursorframe;
|
||||||
move_cursor _mc;
|
bool obscure_cursor;
|
||||||
show_cursor _sc;
|
};
|
||||||
sync_token _st;
|
*/
|
||||||
engine_token *_et;
|
class SDWindow : public BWindowScreen
|
||||||
acquire_engine _ae;
|
{
|
||||||
release_engine _re;
|
public:
|
||||||
fill_rectangle _frect;
|
SDWindow(void);
|
||||||
fill_span _fspan;
|
~SDWindow(void);
|
||||||
|
void MessageReceived(BMessage *msg);
|
||||||
|
bool QuitRequested(void);
|
||||||
|
void WindowActivated(bool active);
|
||||||
|
|
||||||
screen_to_screen_blit _s2sb;
|
// SDView *view;
|
||||||
fill_rectangle _fr;
|
|
||||||
invert_rectangle _ir;
|
|
||||||
screen_to_screen_transparent_blit _s2stb;
|
|
||||||
fill_span _fs;
|
|
||||||
|
|
||||||
hwline32bit _hwline32;
|
|
||||||
hwrect32bit _hwrect32;
|
|
||||||
|
|
||||||
sync_token _stoken;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*!
|
||||||
ScreenDriver.cpp
|
\brief BView/BWindow combination graphics module
|
||||||
Replacement class for the ViewDriver which utilizes a BWindowScreen for ease
|
|
||||||
of testing without requiring a second video card for SecondDriver and also
|
|
||||||
without the limitations (mostly speed) of ViewDriver.
|
|
||||||
|
|
||||||
This module also emulates the input server via the keyboard.
|
First, slowest, and easiest driver class in the app_server which is designed
|
||||||
Cursor keys move the mouse and the left modifier keys Option and Ctrl, which
|
to utilize the BeOS graphics functions to cut out a lot of junk in getting the
|
||||||
operate the first and second mouse buttons, respectively.
|
drawing infrastructure in this server.
|
||||||
The right window key on American keymaps doesn't map to anything, so it is
|
|
||||||
not used. Consequently, when a right modifier key is pressed, it works normally.
|
|
||||||
|
|
||||||
The concept is pretty close to the retooled ViewDriver, where each module
|
The concept is to have SDView::Draw() draw a bitmap, which is a "frame buffer"
|
||||||
call locks a couple BLockers and draws to the buffer.
|
of sorts, utilize a second view to write to it. This cuts out
|
||||||
|
the most problems with having a crapload of code to get just right without
|
||||||
|
having to write a bunch of unit tests
|
||||||
|
|
||||||
Components:
|
Components: 3 classes, SDView, SDWindow, and ScreenDriver
|
||||||
ScreenDriver: actual driver module
|
|
||||||
FrameBuffer: BWindowScreen derivative which provides the module access
|
ScreenDriver - a wrapper class which mostly posts messages to the SDWindow
|
||||||
to the video card
|
SDWindow - does most of the work.
|
||||||
Internal functions for doing graphics on the buffer
|
SDView - doesn't do all that much except display the rendered bitmap
|
||||||
*/
|
*/
|
||||||
class ScreenDriver : public DisplayDriver
|
class ScreenDriver : public DisplayDriver
|
||||||
{
|
{
|
||||||
@@ -159,66 +134,67 @@ public:
|
|||||||
ScreenDriver(void);
|
ScreenDriver(void);
|
||||||
~ScreenDriver(void);
|
~ScreenDriver(void);
|
||||||
|
|
||||||
bool Initialize(void);
|
bool Initialize(void); // Sets the driver
|
||||||
void Shutdown(void);
|
void Shutdown(void); // You never know when you'll need this
|
||||||
|
|
||||||
// Settings functions
|
// Drawing functions
|
||||||
virtual void CopyBits(BRect src, BRect dest);
|
void CopyBits(BRect src, BRect dest);
|
||||||
virtual void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d);
|
void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest);
|
||||||
|
void DrawChar(char c, BPoint pt, LayerData *d);
|
||||||
// virtual void DrawPicture(SPicture *pic, BPoint pt);
|
// virtual void DrawPicture(SPicture *pic, BPoint pt);
|
||||||
virtual void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL);
|
void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL);
|
||||||
|
|
||||||
virtual void FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
void FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
||||||
virtual void FillBezier(BPoint *pts, LayerData *d, int8 *pat);
|
void FillBezier(BPoint *pts, LayerData *d, int8 *pat);
|
||||||
virtual void FillEllipse(BRect r, LayerData *d, int8 *pat);
|
void FillEllipse(BRect r, LayerData *d, int8 *pat);
|
||||||
// virtual void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat);
|
void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat);
|
||||||
virtual void FillRect(BRect r, LayerData *d, int8 *pat);
|
void FillRect(BRect r, LayerData *d, int8 *pat);
|
||||||
virtual void FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
void FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
||||||
// virtual void FillShape(SShape *sh, LayerData *d, int8 *pat);
|
// void FillShape(SShape *sh, LayerData *d, int8 *pat);
|
||||||
virtual void FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
void FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
||||||
|
|
||||||
virtual void HideCursor(void);
|
void HideCursor(void);
|
||||||
virtual void MoveCursorTo(float x, float y);
|
void InvertRect(BRect r);
|
||||||
virtual void InvertRect(BRect r);
|
bool IsCursorHidden(void);
|
||||||
virtual void ShowCursor(void);
|
void MoveCursorTo(float x, float y);
|
||||||
virtual void ObscureCursor(void);
|
// void MovePenTo(BPoint pt);
|
||||||
virtual void SetCursor(ServerCursor *cursor);
|
void ObscureCursor(void);
|
||||||
|
// BPoint PenPosition(void);
|
||||||
|
// float PenSize(void);
|
||||||
|
void SetCursor(ServerCursor *cursor);
|
||||||
|
// drawing_mode GetDrawingMode(void);
|
||||||
|
// void SetDrawingMode(drawing_mode mode);
|
||||||
|
void ShowCursor(void);
|
||||||
|
|
||||||
virtual void StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
void StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeBezier(BPoint *pts, LayerData *d, int8 *pat);
|
void StrokeBezier(BPoint *pts, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeEllipse(BRect r, LayerData *d, int8 *pat);
|
void StrokeEllipse(BRect r, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat);
|
void StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat);
|
||||||
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true);
|
void StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d);
|
||||||
virtual void StrokeRect(BRect r, LayerData *d, int8 *pat);
|
void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true);
|
||||||
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
void StrokeRect(BRect r, LayerData *d, int8 *pat);
|
||||||
// virtual void StrokeShape(SShape *sh, LayerData *d, int8 *pat);
|
void StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
|
||||||
virtual void StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
// void StrokeShape(SShape *sh, LayerData *d, int8 *pat);
|
||||||
// virtual void StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d);
|
void StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
|
||||||
virtual void SetMode(int32 mode);
|
void SetMode(int32 mode);
|
||||||
float StringWidth(const char *string, int32 length, LayerData *d);
|
float StringWidth(const char *string, int32 length, LayerData *d);
|
||||||
float StringHeight(const char *string, int32 length, LayerData *d);
|
float StringHeight(const char *string, int32 length, LayerData *d);
|
||||||
virtual bool DumpToFile(const char *path);
|
bool DumpToFile(const char *path);
|
||||||
|
FrameBuffer *screenwin;
|
||||||
protected:
|
protected:
|
||||||
|
void SetLayerData(LayerData *d, bool set_font_data=false);
|
||||||
void BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
|
void BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
|
||||||
void BlitGray2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
|
void BlitGray2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
|
||||||
void BlitBitmap(ServerBitmap *sourcebmp, BRect sourcerect, BRect destrect, drawing_mode mode=B_OP_COPY);
|
|
||||||
void ExtractToBitmap(ServerBitmap *destbmp, BRect destrect, BRect sourcerect);
|
|
||||||
void SetPixelPattern(int x, int y, uint8 *pattern, uint8 patternindex);
|
|
||||||
void Line(BPoint start, BPoint end, LayerData *d, int8 *pat);
|
|
||||||
void HLine(int32 x1, int32 x2, int32 y, RGBColor color);
|
|
||||||
void HLineThick(int32 x1, int32 x2, int32 y, int32 thick, PatternHandler *pat);
|
|
||||||
rgb_color GetBlitColor(rgb_color src, rgb_color dest, LayerData *d, bool use_high=true);
|
rgb_color GetBlitColor(rgb_color src, rgb_color dest, LayerData *d, bool use_high=true);
|
||||||
void SetPixel(int x, int y, RGBColor col);
|
int hide_cursor;
|
||||||
void SetPixel32(int x, int y, rgb_color col);
|
bool obscure_cursor;
|
||||||
void SetPixel16(int x, int y, uint16 col);
|
BBitmap *framebuffer;
|
||||||
void SetPixel8(int x, int y, uint8 col);
|
BView *drawview;
|
||||||
void SetThickPixel(int x, int y, int thick, RGBColor col);
|
BRegion laregion;
|
||||||
void SetThickPixel32(int x, int y, int thick, rgb_color col);
|
PortLink *serverlink;
|
||||||
void SetThickPixel16(int x, int y, int thick, uint16 col);
|
|
||||||
void SetThickPixel8(int x, int y, int thick, uint8 col);
|
rgb_color highcolor,lowcolor;
|
||||||
FrameBuffer *fbuffer;
|
bool is_initialized;
|
||||||
ServerCursor *cursor, *under_cursor;
|
|
||||||
BRect cursorframe;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ ServerApp::ServerApp(port_id sendport, port_id rcvport, int32 handlerID, char *s
|
|||||||
_appcursor=(defaultc)?new ServerCursor(defaultc):NULL;
|
_appcursor=(defaultc)?new ServerCursor(defaultc):NULL;
|
||||||
_lock=create_sem(1,"ServerApp sem");
|
_lock=create_sem(1,"ServerApp sem");
|
||||||
|
|
||||||
_driver=GetGfxDriver();
|
_driver=GetGfxDriver(ActiveScreen());
|
||||||
_cursorhidden=false;
|
_cursorhidden=false;
|
||||||
|
|
||||||
#ifdef DEBUG_SERVERAPP
|
#ifdef DEBUG_SERVERAPP
|
||||||
@@ -534,7 +534,7 @@ printf("ServerApp %s: Download Picture unimplemented\n",_signature.String());
|
|||||||
#ifdef DEBUG_SERVERAPP
|
#ifdef DEBUG_SERVERAPP
|
||||||
printf("ServerApp %s: SetScreenMode: workspace %ld, mode %lu\n",_signature.String(), workspace, mode);
|
printf("ServerApp %s: SetScreenMode: workspace %ld, mode %lu\n",_signature.String(), workspace, mode);
|
||||||
#endif
|
#endif
|
||||||
SetSpace(workspace,mode,*((bool*)index));
|
SetSpace(workspace,mode,ActiveScreen(),*((bool*)index));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#define HWDRIVER 3
|
#define HWDRIVER 3
|
||||||
|
|
||||||
// Display driver to be used by the server.
|
// Display driver to be used by the server.
|
||||||
#define DISPLAYDRIVER VIEWDRIVER
|
#define DISPLAYDRIVER SCREENDRIVER
|
||||||
|
|
||||||
// Uncomment this if the DisplayDriver should only rely on drawing functions implemented
|
// Uncomment this if the DisplayDriver should only rely on drawing functions implemented
|
||||||
// in software even though hardware-accelerated functions are available
|
// in software even though hardware-accelerated functions are available
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
|||||||
|
|
||||||
_token=win_token_handler.GetToken();
|
_token=win_token_handler.GetToken();
|
||||||
|
|
||||||
AddWindowToDesktop(this,index);
|
AddWindowToDesktop(this,index,ActiveScreen());
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
printf("ServerWindow %s:\n",_title->String());
|
printf("ServerWindow %s:\n",_title->String());
|
||||||
printf("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom);
|
printf("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom);
|
||||||
@@ -658,16 +658,20 @@ void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
|||||||
#ifdef DEBUG_SERVERWINDOW_MOUSE
|
#ifdef DEBUG_SERVERWINDOW_MOUSE
|
||||||
printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
||||||
#endif
|
#endif
|
||||||
/* ServerWindow *mousewin=NULL;
|
ServerWindow *mousewin=NULL;
|
||||||
int8 *index=buffer;
|
int8 *index=buffer;
|
||||||
|
|
||||||
// Find the window which will receive our mouse event.
|
// Find the window which will receive our mouse event.
|
||||||
Layer *root=GetRootLayer();
|
Layer *root=GetRootLayer(CurrentWorkspace(),ActiveScreen());
|
||||||
WinBorder *_winborder;
|
WinBorder *_winborder;
|
||||||
|
|
||||||
// activeborder is used to remember windows when resizing/moving windows
|
// activeborder is used to remember windows when resizing/moving windows
|
||||||
// or sliding a tab
|
// or sliding a tab
|
||||||
ASSERT(root!=NULL);
|
if(!root)
|
||||||
|
{
|
||||||
|
printf("ERROR: HandleMouseEvent has NULL root layer!!!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatch the mouse event to the proper window
|
// Dispatch the mouse event to the proper window
|
||||||
switch(code)
|
switch(code)
|
||||||
@@ -684,14 +688,10 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
|
|
||||||
// int64 time=*((int64*)index);
|
// int64 time=*((int64*)index);
|
||||||
index+=sizeof(int64);
|
index+=sizeof(int64);
|
||||||
float x=*((float*)index);
|
float x=*((float*)index); index+=sizeof(float);
|
||||||
index+=sizeof(float);
|
float y=*((float*)index); index+=sizeof(float);
|
||||||
float y=*((float*)index);
|
// int32 modifiers=*((int32*)index); index+=sizeof(uint32);
|
||||||
index+=sizeof(float);
|
// uint32 buttons=*((uint32*)index); index+=sizeof(uint32);
|
||||||
int32 modifiers=*((int32*)index);
|
|
||||||
index+=sizeof(uint32);
|
|
||||||
uint32 buttons=*((uint32*)index);
|
|
||||||
index+=sizeof(uint32);
|
|
||||||
// int32 clicks=*((int32*)index);
|
// int32 clicks=*((int32*)index);
|
||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
@@ -700,7 +700,7 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
mousewin=_winborder->Window();
|
mousewin=_winborder->Window();
|
||||||
_winborder->MouseDown(pt,buttons,modifiers);
|
_winborder->MouseDown(buffer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -714,10 +714,8 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
|
|
||||||
// int64 time=*((int64*)index);
|
// int64 time=*((int64*)index);
|
||||||
index+=sizeof(int64);
|
index+=sizeof(int64);
|
||||||
float x=*((float*)index);
|
float x=*((float*)index); index+=sizeof(float);
|
||||||
index+=sizeof(float);
|
float y=*((float*)index); index+=sizeof(float);
|
||||||
float y=*((float*)index);
|
|
||||||
index+=sizeof(float);
|
|
||||||
// int32 modifiers=*((int32*)index);
|
// int32 modifiers=*((int32*)index);
|
||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
@@ -729,8 +727,7 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
|
|
||||||
// Eventually, we will build in MouseUp messages with buttons specified
|
// Eventually, we will build in MouseUp messages with buttons specified
|
||||||
// For now, we just "assume" no mouse specification with a 0.
|
// For now, we just "assume" no mouse specification with a 0.
|
||||||
// _winborder->MouseUp(pt,0,0);
|
_winborder->MouseUp(buffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -743,26 +740,25 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
// 4) int32 - buttons down
|
// 4) int32 - buttons down
|
||||||
// int64 time=*((int64*)index);
|
// int64 time=*((int64*)index);
|
||||||
index+=sizeof(int64);
|
index+=sizeof(int64);
|
||||||
float x=*((float*)index);
|
float x=*((float*)index); index+=sizeof(float);
|
||||||
index+=sizeof(float);
|
float y=*((float*)index); index+=sizeof(float);
|
||||||
float y=*((float*)index);
|
// uint32 buttons=*((uint32*)index);
|
||||||
index+=sizeof(float);
|
|
||||||
uint32 buttons=*((uint32*)index);
|
|
||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
if(is_moving_window() || is_resizing_window() || is_sliding_tab())
|
// TODO: Fix
|
||||||
|
/* if(is_moving_window() || is_resizing_window() || is_sliding_tab())
|
||||||
{
|
{
|
||||||
mousewin=active_serverwindow;
|
mousewin=active_serverwindow;
|
||||||
mousewin->_winborder->MouseMoved(pt,buttons,0);
|
mousewin->_winborder->MouseMoved(pt,buttons,0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_winborder=(WinBorder*)root->GetChildAt(pt);
|
*/ _winborder=(WinBorder*)root->GetChildAt(pt);
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
mousewin=_winborder->Window();
|
mousewin=_winborder->Window();
|
||||||
_winborder->MouseMoved(pt,buttons,0);
|
_winborder->MouseMoved(buffer);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -771,7 +767,6 @@ printf("ServerWindow::HandleMouseEvent unimplemented\n");
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -37,8 +37,9 @@
|
|||||||
#include "WinBorder.h"
|
#include "WinBorder.h"
|
||||||
#include "AppServer.h" // for new_decorator()
|
#include "AppServer.h" // for new_decorator()
|
||||||
|
|
||||||
#define DEBUG_WINBORDER
|
//#define DEBUG_WINBORDER
|
||||||
//#define DEBUG_WINBORDER_MOUSE
|
//#define DEBUG_WINBORDER_MOUSE
|
||||||
|
//#define DEBUG_WINBORDER_CLICK
|
||||||
|
|
||||||
#ifdef DEBUG_WINBORDER
|
#ifdef DEBUG_WINBORDER
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -48,6 +49,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace winborder_private
|
namespace winborder_private
|
||||||
{
|
{
|
||||||
bool is_moving_window=false;
|
bool is_moving_window=false;
|
||||||
@@ -62,6 +67,8 @@ bool is_moving_window(void) { return winborder_private::is_moving_window; }
|
|||||||
void set_is_moving_window(bool state) { winborder_private::is_moving_window=state; }
|
void set_is_moving_window(bool state) { winborder_private::is_moving_window=state; }
|
||||||
bool is_resizing_window(void) { return winborder_private::is_resizing_window; }
|
bool is_resizing_window(void) { return winborder_private::is_resizing_window; }
|
||||||
void set_is_resizing_window(bool state) { winborder_private::is_resizing_window=state; }
|
void set_is_resizing_window(bool state) { winborder_private::is_resizing_window=state; }
|
||||||
|
bool is_sliding_tab(void) { return winborder_private::is_sliding_tab; }
|
||||||
|
void set_is_sliding_tab(bool state) { winborder_private::is_sliding_tab=state; }
|
||||||
WinBorder * get_active_winborder(void) { return winborder_private::active_winborder; }
|
WinBorder * get_active_winborder(void) { return winborder_private::active_winborder; }
|
||||||
void set_active_winborder(WinBorder *win) { winborder_private::active_winborder=win; }
|
void set_active_winborder(WinBorder *win) { winborder_private::active_winborder=win; }
|
||||||
|
|
||||||
@@ -80,8 +87,8 @@ WinBorder::WinBorder(BRect r, const char *name, int32 look, int32 feel, int32 fl
|
|||||||
_hresizewin=false;
|
_hresizewin=false;
|
||||||
_vresizewin=false;
|
_vresizewin=false;
|
||||||
|
|
||||||
_decorator=new_decorator(r,name,look,feel,flags,GetGfxDriver());
|
_decorator=new_decorator(r,name,look,feel,flags,GetGfxDriver(ActiveScreen()));
|
||||||
_decorator->SetDriver(GetGfxDriver());
|
_decorator->SetDriver(GetGfxDriver(ActiveScreen()));
|
||||||
|
|
||||||
#ifdef DEBUG_WINBORDER
|
#ifdef DEBUG_WINBORDER
|
||||||
printf("WinBorder %s:\n",_title->String());
|
printf("WinBorder %s:\n",_title->String());
|
||||||
@@ -103,37 +110,67 @@ void WinBorder::MouseDown(int8 *buffer)
|
|||||||
#ifdef DEBUG_WINBORDER_MOUSE
|
#ifdef DEBUG_WINBORDER_MOUSE
|
||||||
printf("WinBorder %s: MouseDown unimplemented\n",_title->String());
|
printf("WinBorder %s: MouseDown unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
/* _mbuttons=buttons;
|
// Buffer data:
|
||||||
kmodifiers=modifiers;
|
// 1) int64 - time of mouse click
|
||||||
click_type click=_decorator->Clicked(pt, _mbuttons, kmodifiers);
|
// 2) float - x coordinate of mouse click
|
||||||
|
// 3) float - y coordinate of mouse click
|
||||||
|
// 4) int32 - modifier keys down
|
||||||
|
// 5) int32 - buttons down
|
||||||
|
// 6) int32 - clicks
|
||||||
|
int8 *index=buffer; index+=sizeof(int64);
|
||||||
|
float x=*((float*)index); index+=sizeof(float);
|
||||||
|
float y=*((float*)index); index+=sizeof(float);
|
||||||
|
int32 modifiers=*((int32*)index); index+=sizeof(int32);
|
||||||
|
int32 buttons=*((int32*)index);
|
||||||
|
|
||||||
|
BPoint pt(x,y);
|
||||||
|
|
||||||
|
_mbuttons=buttons;
|
||||||
|
_kmodifiers=modifiers;
|
||||||
|
click_type click=_decorator->Clicked(pt, _mbuttons, _kmodifiers);
|
||||||
_mousepos=pt;
|
_mousepos=pt;
|
||||||
|
|
||||||
switch(click)
|
switch(click)
|
||||||
{
|
{
|
||||||
case CLICK_MOVETOBACK:
|
case CLICK_MOVETOBACK:
|
||||||
{
|
{
|
||||||
MoveToBack();
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("Click: MoveToBack\n");
|
||||||
|
#endif
|
||||||
|
MakeTopChild();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CLICK_MOVETOFRONT:
|
case CLICK_MOVETOFRONT:
|
||||||
{
|
{
|
||||||
MoveToFront();
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("Click: MoveToFront\n");
|
||||||
|
#endif
|
||||||
|
MakeBottomChild();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CLICK_CLOSE:
|
case CLICK_CLOSE:
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("Click: Close\n");
|
||||||
|
#endif
|
||||||
_decorator->SetClose(true);
|
_decorator->SetClose(true);
|
||||||
_decorator->Draw();
|
_decorator->Draw();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CLICK_ZOOM:
|
case CLICK_ZOOM:
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("Click: Zoom\n");
|
||||||
|
#endif
|
||||||
_decorator->SetZoom(true);
|
_decorator->SetZoom(true);
|
||||||
_decorator->Draw();
|
_decorator->Draw();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CLICK_MINIMIZE:
|
case CLICK_MINIMIZE:
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("Click: Minimize\n");
|
||||||
|
#endif
|
||||||
_decorator->SetMinimize(true);
|
_decorator->SetMinimize(true);
|
||||||
_decorator->Draw();
|
_decorator->Draw();
|
||||||
break;
|
break;
|
||||||
@@ -141,21 +178,40 @@ printf("WinBorder %s: MouseDown unimplemented\n",_title->String());
|
|||||||
case CLICK_DRAG:
|
case CLICK_DRAG:
|
||||||
{
|
{
|
||||||
if(buttons==B_PRIMARY_MOUSE_BUTTON)
|
if(buttons==B_PRIMARY_MOUSE_BUTTON)
|
||||||
is_moving_window=true;
|
{
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("Click: Drag\n");
|
||||||
|
#endif
|
||||||
|
MakeBottomChild();
|
||||||
|
set_is_moving_window(true);
|
||||||
|
}
|
||||||
|
|
||||||
if(buttons==B_SECONDARY_MOUSE_BUTTON)
|
if(buttons==B_SECONDARY_MOUSE_BUTTON)
|
||||||
MoveToBack();
|
{
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("Click: MoveToBack\n");
|
||||||
|
#endif
|
||||||
|
MakeTopChild();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CLICK_SLIDETAB:
|
case CLICK_SLIDETAB:
|
||||||
{
|
{
|
||||||
is_sliding_tab=true;
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("Click: Slide Tab\n");
|
||||||
|
#endif
|
||||||
|
set_is_sliding_tab(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CLICK_RESIZE:
|
case CLICK_RESIZE:
|
||||||
{
|
{
|
||||||
if(buttons==B_PRIMARY_MOUSE_BUTTON)
|
if(buttons==B_PRIMARY_MOUSE_BUTTON)
|
||||||
is_resizing_window=true;
|
{
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("Click: Resize\n");
|
||||||
|
#endif
|
||||||
|
set_is_resizing_window(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CLICK_NONE:
|
case CLICK_NONE:
|
||||||
@@ -167,19 +223,30 @@ printf("WinBorder %s: MouseDown unimplemented\n",_title->String());
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(click!=CLICK_NONE)
|
// TODO: fix this
|
||||||
ActivateWindow(_win);
|
// if(click!=CLICK_NONE)
|
||||||
*/
|
// ActivateWindow(_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinBorder::MouseMoved(int8 *buffer)
|
void WinBorder::MouseMoved(int8 *buffer)
|
||||||
{
|
{
|
||||||
|
// Buffer data:
|
||||||
|
// 1) int64 - time of mouse click
|
||||||
|
// 2) float - x coordinate of mouse click
|
||||||
|
// 3) float - y coordinate of mouse click
|
||||||
|
// 4) int32 - buttons down
|
||||||
|
int8 *index=buffer; index+=sizeof(int64);
|
||||||
|
float x=*((float*)index); index+=sizeof(float);
|
||||||
|
float y=*((float*)index); index+=sizeof(float);
|
||||||
|
int32 buttons=*((int32*)index);
|
||||||
|
|
||||||
|
BPoint pt(x,y);
|
||||||
|
click_type click=_decorator->Clicked(pt, _mbuttons, _kmodifiers);
|
||||||
|
|
||||||
#ifdef DEBUG_WINBORDER_MOUSE
|
#ifdef DEBUG_WINBORDER_MOUSE
|
||||||
printf("WinBorder %s: MouseMoved unimplemented\n",_title->String());
|
printf("WinBorder %s: MouseMoved unimplemented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
/* _mbuttons=buttons;
|
|
||||||
kmodifiers=modifiers;
|
|
||||||
click_type click=_decorator->Clicked(pt, _mbuttons, kmodifiers);
|
|
||||||
if(click!=CLICK_CLOSE && _decorator->GetClose())
|
if(click!=CLICK_CLOSE && _decorator->GetClose())
|
||||||
{
|
{
|
||||||
_decorator->SetClose(false);
|
_decorator->SetClose(false);
|
||||||
@@ -198,8 +265,11 @@ printf("WinBorder %s: MouseMoved unimplemented\n",_title->String());
|
|||||||
_decorator->Draw();
|
_decorator->Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_sliding_tab)
|
if(is_sliding_tab())
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("ClickMove: Slide Tab\n");
|
||||||
|
#endif
|
||||||
float dx=pt.x-_mousepos.x;
|
float dx=pt.x-_mousepos.x;
|
||||||
|
|
||||||
if(dx!=0)
|
if(dx!=0)
|
||||||
@@ -207,75 +277,97 @@ printf("WinBorder %s: MouseMoved unimplemented\n",_title->String());
|
|||||||
// SlideTab returns how much things were moved, and currently
|
// SlideTab returns how much things were moved, and currently
|
||||||
// supports just the x direction, so get the value so
|
// supports just the x direction, so get the value so
|
||||||
// we can invalidate the proper area.
|
// we can invalidate the proper area.
|
||||||
layerlock->Lock();
|
lock_layers();
|
||||||
parent->Invalidate(_decorator->SlideTab(dx,0));
|
_parent->Invalidate(_decorator->SlideTab(dx,0));
|
||||||
parent->RequestDraw();
|
_parent->RequestDraw();
|
||||||
_decorator->DrawTab();
|
_decorator->DrawTab();
|
||||||
layerlock->Unlock();
|
unlock_layers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(is_moving_window)
|
|
||||||
|
|
||||||
|
if(is_moving_window())
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("ClickMove: Drag\n");
|
||||||
|
#endif
|
||||||
float dx=pt.x-_mousepos.x,
|
float dx=pt.x-_mousepos.x,
|
||||||
dy=pt.y-_mousepos.y;
|
dy=pt.y-_mousepos.y;
|
||||||
if(dx!=0 || dy!=0)
|
if(buttons!=0 && (dx!=0 || dy!=0))
|
||||||
{
|
{
|
||||||
BRect oldmoveframe=_win->_frame;
|
BRect oldmoveframe=_win->_frame;
|
||||||
clientframe.OffsetBy(pt);
|
_clientframe.OffsetBy(pt);
|
||||||
|
|
||||||
_win->Lock();
|
_win->Lock();
|
||||||
_win->_frame.OffsetBy(dx,dy);
|
_win->_frame.OffsetBy(dx,dy);
|
||||||
_win->Unlock();
|
_win->Unlock();
|
||||||
|
|
||||||
layerlock->Lock();
|
lock_layers();
|
||||||
// InvalidateLowerSiblings(oldmoveframe);
|
_parent->Invalidate(oldmoveframe);
|
||||||
parent->Invalidate(oldmoveframe);
|
|
||||||
MoveBy(dx,dy);
|
MoveBy(dx,dy);
|
||||||
parent->RequestDraw();
|
_parent->RequestDraw();
|
||||||
_decorator->MoveBy(BPoint(dx, dy));
|
_decorator->MoveBy(BPoint(dx, dy));
|
||||||
_decorator->Draw();
|
_decorator->Draw();
|
||||||
layerlock->Unlock();
|
unlock_layers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(is_resizing_window)
|
|
||||||
|
|
||||||
|
if(is_resizing_window())
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_WINBORDER_CLICK
|
||||||
|
printf("ClickMove: Resize\n");
|
||||||
|
#endif
|
||||||
float dx=pt.x-_mousepos.x,
|
float dx=pt.x-_mousepos.x,
|
||||||
dy=pt.y-_mousepos.y;
|
dy=pt.y-_mousepos.y;
|
||||||
if(dx!=0 || dy!=0)
|
if(buttons!=0 && (dx!=0 || dy!=0))
|
||||||
{
|
{
|
||||||
clientframe.right+=dx;
|
_clientframe.right+=dx;
|
||||||
clientframe.bottom+=dy;
|
_clientframe.bottom+=dy;
|
||||||
|
|
||||||
_win->Lock();
|
_win->Lock();
|
||||||
_win->_frame.right+=dx;
|
_win->_frame.right+=dx;
|
||||||
_win->_frame.bottom+=dy;
|
_win->_frame.bottom+=dy;
|
||||||
_win->Unlock();
|
_win->Unlock();
|
||||||
|
|
||||||
layerlock->Lock();
|
lock_layers();
|
||||||
ResizeBy(dx,dy);
|
ResizeBy(dx,dy);
|
||||||
parent->RequestDraw();
|
_parent->RequestDraw();
|
||||||
layerlock->Unlock();
|
unlock_layers();
|
||||||
_decorator->ResizeBy(dx,dy);
|
_decorator->ResizeBy(dx,dy);
|
||||||
_decorator->Draw();
|
_decorator->Draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_mousepos=pt;
|
_mousepos=pt;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinBorder::MouseUp(int8 *buffer)
|
void WinBorder::MouseUp(int8 *buffer)
|
||||||
{
|
{
|
||||||
|
// buffer data:
|
||||||
|
// 1) int64 - time of mouse click
|
||||||
|
// 2) float - x coordinate of mouse click
|
||||||
|
// 3) float - y coordinate of mouse click
|
||||||
|
// 4) int32 - modifier keys down
|
||||||
|
int8 *index=buffer; index+=sizeof(int64);
|
||||||
|
float x=*((float*)index); index+=sizeof(float);
|
||||||
|
float y=*((float*)index); index+=sizeof(float);
|
||||||
|
int32 modifiers=*((int32*)index);
|
||||||
|
BPoint pt(x,y);
|
||||||
|
|
||||||
#ifdef DEBUG_WINBORDER_MOUSE
|
#ifdef DEBUG_WINBORDER_MOUSE
|
||||||
printf("WinBorder %s: MouseUp unimplmented\n",_title->String());
|
printf("WinBorder %s: MouseUp unimplmented\n",_title->String());
|
||||||
#endif
|
#endif
|
||||||
/*
|
|
||||||
_mbuttons=buttons;
|
|
||||||
kmodifiers=modifiers;
|
|
||||||
is_moving_window=false;
|
|
||||||
is_resizing_window=false;
|
|
||||||
is_sliding_tab=false;
|
|
||||||
|
|
||||||
click_type click=_decorator->Clicked(pt, _mbuttons, kmodifiers);
|
_mbuttons=0;
|
||||||
|
_kmodifiers=modifiers;
|
||||||
|
|
||||||
|
set_is_moving_window(false);
|
||||||
|
set_is_resizing_window(false);
|
||||||
|
set_is_sliding_tab(false);
|
||||||
|
|
||||||
|
click_type click=_decorator->Clicked(pt, _mbuttons, _kmodifiers);
|
||||||
|
|
||||||
switch(click)
|
switch(click)
|
||||||
{
|
{
|
||||||
@@ -310,7 +402,6 @@ printf("WinBorder %s: MouseUp unimplmented\n",_title->String());
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinBorder::RequestDraw(const BRect &r)
|
void WinBorder::RequestDraw(const BRect &r)
|
||||||
|
|||||||
Reference in New Issue
Block a user