* added click to focus mouse mode; right-click for bring-to-front and send-to-back

(might cause some regressions in FFM)
* made accept first click user configurable
* updated the Mouse preflet to use the layout kit
* removed the warp and instant warp modes from the Mouse preflet
* changed internal representation of mouse modes (warp modes moved)
* coding style fixes



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33732 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Brecht Machiels 2009-10-22 21:10:19 +00:00
parent 9c90fc59d2
commit 926e63c885
27 changed files with 1033 additions and 611 deletions

View File

@ -160,9 +160,14 @@ struct mouse_map {
enum mode_mouse {
B_NORMAL_MOUSE = 0,
B_FOCUS_FOLLOWS_MOUSE = 1,
B_WARP_MOUSE = 3,
B_INSTANT_WARP_MOUSE = 7
B_CLICK_TO_FOCUS_MOUSE = -1,
B_FOCUS_FOLLOWS_MOUSE = 1
};
enum mode_focus_follows_mouse {
B_NORMAL_FOCUS_FOLLOWS_MOUSE = 0,
B_WARP_FOCUS_FOLLOWS_MOUSE = 1,
B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE = 2
};
@ -372,6 +377,12 @@ bool focus_follows_mouse();
void set_mouse_mode(mode_mouse mode);
mode_mouse mouse_mode();
void set_focus_follows_mouse_mode(mode_focus_follows_mouse mode);
mode_focus_follows_mouse focus_follows_mouse_mode();
void set_accept_first_click(bool acceptFirstClick);
bool accept_first_click();
rgb_color ui_color(color_which which);
void set_ui_color(const color_which& which, const rgb_color& color);
rgb_color tint_color(rgb_color color, float tint);

View File

@ -195,6 +195,10 @@ enum {
AS_IDLE_TIME,
AS_SET_MOUSE_MODE,
AS_GET_MOUSE_MODE,
AS_SET_FOCUS_FOLLOWS_MOUSE_MODE,
AS_GET_FOCUS_FOLLOWS_MOUSE_MODE,
AS_SET_ACCEPT_FIRST_CLICK,
AS_GET_ACCEPT_FIRST_CLICK,
AS_GET_MOUSE,
AS_SET_DECORATOR_SETTINGS,
AS_GET_DECORATOR_SETTINGS,

View File

@ -100,7 +100,8 @@ namespace BPrivate {
Returns \c true if the mode is known.
*/
bool
get_mode_parameter(uint32 mode, int32& width, int32& height, uint32& colorSpace)
get_mode_parameter(uint32 mode, int32& width, int32& height,
uint32& colorSpace)
{
switch (mode) {
case B_8_BIT_640x480:
@ -456,7 +457,8 @@ set_mouse_map(mouse_map *map)
BMessage command(IS_SET_MOUSE_MAP);
BMessage reply;
status_t err = command.AddData("mousemap", B_RAW_TYPE, map, sizeof(mouse_map));
status_t err = command.AddData("mousemap", B_RAW_TYPE, map,
sizeof(mouse_map));
if (err != B_OK)
return err;
return _control_input_server_(&command, &reply);
@ -652,12 +654,14 @@ _get_key_map(key_map **map, char **key_buffer, ssize_t *key_buffer_size)
_control_input_server_(&command, &reply);
if (reply.FindData("keymap", B_ANY_TYPE, &map_array, &map_count) != B_OK) {
if (reply.FindData("keymap", B_ANY_TYPE, &map_array, &map_count)
!= B_OK) {
*map = 0; *key_buffer = 0;
return;
}
if (reply.FindData("key_buffer", B_ANY_TYPE, &key_array, key_buffer_size) != B_OK) {
if (reply.FindData("key_buffer", B_ANY_TYPE, &key_array, key_buffer_size)
!= B_OK) {
*map = 0; *key_buffer = 0;
return;
}
@ -852,14 +856,14 @@ void
set_focus_follows_mouse(bool follow)
{
// obviously deprecated API
set_mouse_mode(B_WARP_MOUSE);
set_mouse_mode(B_FOCUS_FOLLOWS_MOUSE);
}
bool
focus_follows_mouse()
{
return mouse_mode() != B_NORMAL_MOUSE;
return mouse_mode() == B_FOCUS_FOLLOWS_MOUSE;
}
@ -876,7 +880,8 @@ set_mouse_mode(mode_mouse mode)
mode_mouse
mouse_mode()
{
// Gets the focus-follows-mouse style, such as normal, B_WARP_MOUSE, etc.
// Gets the mouse focus style, such as activate to click,
// focus to click, ...
mode_mouse mode = B_NORMAL_MOUSE;
BPrivate::AppServerLink link;
@ -890,6 +895,58 @@ mouse_mode()
}
void
set_focus_follows_mouse_mode(mode_focus_follows_mouse mode)
{
BPrivate::AppServerLink link;
link.StartMessage(AS_SET_FOCUS_FOLLOWS_MOUSE_MODE);
link.Attach<mode_focus_follows_mouse>(mode);
link.Flush();
}
mode_focus_follows_mouse
focus_follows_mouse_mode()
{
mode_focus_follows_mouse mode = B_NORMAL_FOCUS_FOLLOWS_MOUSE;
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_FOCUS_FOLLOWS_MOUSE_MODE);
int32 code;
if (link.FlushWithReply(code) == B_OK && code == B_OK)
link.Read<mode_focus_follows_mouse>(&mode);
return mode;
}
void
set_accept_first_click(bool acceptFirstClick)
{
BPrivate::AppServerLink link;
link.StartMessage(AS_SET_ACCEPT_FIRST_CLICK);
link.Attach<bool>(acceptFirstClick);
link.Flush();
}
bool
accept_first_click()
{
// Gets the accept first click status
bool acceptFirstClick = false;
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_ACCEPT_FIRST_CLICK);
int32 code;
if (link.FlushWithReply(code) == B_OK && code == B_OK)
link.Read<bool>(&acceptFirstClick);
return accept_first_click;
}
rgb_color
ui_color(color_which which)
{
@ -900,7 +957,8 @@ ui_color(color_which which)
}
if (be_app) {
server_read_only_memory* shared = BApplication::Private::ServerReadOnlyMemory();
server_read_only_memory* shared
= BApplication::Private::ServerReadOnlyMemory();
return shared->colors[index];
}
@ -1079,7 +1137,8 @@ get_decorator(void)
/*!
\brief queries the server for the name of the decorator with a certain index
\brief queries the server for the name of the decorator with a certain
index
\param index The index of the decorator to get the name for
\param name BString to receive the name of the decorator
\return B_OK if successful, B_ERROR if not
@ -1323,8 +1382,8 @@ truncate_end(const char* source, char* dest, uint32 numChars,
const float* escapementArray, float width, float ellipsisWidth, float size)
{
float currentWidth = 0.0;
ellipsisWidth /= size; // test if this is as accurate as escapementArray * size
width /= size;
ellipsisWidth /= size; // test if this is as accurate
width /= size; // as escapementArray * size
uint32 lastFit = 0, c;
for (c = 0; c < numChars; c++) {
@ -1378,7 +1437,8 @@ copy_from_end(const char* src, char* dst, uint32 numChars, uint32 length,
currentWidth += ellipsisWidth;
// go forward again until ellipsis fits (already beyond the target)
for (uint32 c2 = c; c2 < numChars; c2++) {
//printf(" backward: %c (%ld) (%.1f - %.1f = %.1f)\n", *dst, c2, currentWidth, escapementArray[c2] * size, currentWidth - escapementArray[c2] * size);
//printf(" backward: %c (%ld) (%.1f - %.1f = %.1f)\n", *dst, c2, currentWidth, escapementArray[c2] * size,
// currentWidth - escapementArray[c2] * size);
currentWidth -= escapementArray[c2] * size;
do {
src++;
@ -1411,7 +1471,8 @@ truncate_middle(const char* source, char* dest, uint32 numChars,
uint32 left = 0;
float leftWidth = 0.0;
while (left < numChars && (leftWidth + (escapementArray[left] * size)) < mid)
while (left < numChars && (leftWidth + (escapementArray[left] * size))
< mid)
leftWidth += (escapementArray[left++] * size);
if (left == numChars)
@ -1419,7 +1480,8 @@ truncate_middle(const char* source, char* dest, uint32 numChars,
float rightWidth = 0.0;
uint32 right = numChars;
while (right > left && (rightWidth + (escapementArray[right - 1] * size)) < mid)
while (right > left && (rightWidth + (escapementArray[right - 1] * size))
< mid)
rightWidth += (escapementArray[--right] * size);
if (left >= right)
@ -1490,7 +1552,8 @@ truncate_string(const char* string, uint32 mode, float width,
char* result, const float* escapementArray, float fontSize,
float ellipsisWidth, int32 length, int32 numChars)
{
// TODO: that's actually not correct: the string could be smaller than ellipsisWidth
// TODO: that's actually not correct: the string could be smaller than
// ellipsisWidth
if (string == NULL /*|| width < ellipsisWidth*/) {
// we don't have room for a single glyph
strcpy(result, "");
@ -1540,8 +1603,8 @@ truncate_string(const char* string, uint32 mode, float width,
// FALL THROUGH (at least do something)
case B_TRUNCATE_MIDDLE:
default:
truncated = truncate_middle(source, dest, numChars, escapementArray,
width, ellipsisWidth, fontSize);
truncated = truncate_middle(source, dest, numChars,
escapementArray, width, ellipsisWidth, fontSize);
break;
}

View File

@ -24,6 +24,7 @@
#include <binary_compatibility/Interface.h>
#include <MenuPrivate.h>
#include <TokenSpace.h>
#include <InterfaceDefs.h>
#include "BMCPrivate.h"
@ -337,10 +338,17 @@ BMenuBar::MouseDown(BPoint where)
if (fTracking)
return;
BWindow* window = Window();
if (!window->IsActive() || !window->IsFront()) {
window->Activate();
window->UpdateIfNeeded();
uint32 buttons;
GetMouse(&where, &buttons);
BWindow* window = Window();
if (!window->IsActive() || !window->IsFront()) {
if ((mouse_mode() == B_FOCUS_FOLLOWS_MOUSE)
|| ((mouse_mode() == B_CLICK_TO_FOCUS_MOUSE)
&& ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0))) {
window->Activate();
window->UpdateIfNeeded();
}
}
StartMenuBar(-1, false, false);

View File

@ -6,6 +6,7 @@
* Jérôme Duval,
* Axel Dörfler (axeld@pinc-software.de)
* Andrew McCall (mccall@digitalparadise.co.uk)
* Brecht Machiels (brecht@mos6581.org)
*/
#ifndef MOUSE_CONSTANTS_H
#define MOUSE_CONSTANTS_H
@ -17,6 +18,8 @@ const uint32 kMsgRevert = 'BTre';
const uint32 kMsgMouseType = 'PUmt';
const uint32 kMsgMouseFocusMode = 'PUmf';
const uint32 kMsgFollowsMouseMode = 'PUff';
const uint32 kMsgAcceptFirstClick = 'PUaf';
const uint32 kMsgMouseMap = 'PUmm';
const uint32 kMsgDoubleClickSpeed = 'SLdc';

View File

@ -6,9 +6,9 @@
* Jérôme Duval,
* Axel Dörfler (axeld@pinc-software.de)
* Andrew McCall (mccall@digitalparadise.co.uk)
* Brecht Machiels (brecht@mos6581.org)
*/
#include <FindDirectory.h>
#include <File.h>
#include <Path.h>
@ -18,7 +18,6 @@
#include "MouseSettings.h"
// The R5 settings file differs from that of OpenBeOS;
// the latter maps 16 different mouse buttons
#define R5_COMPATIBLE 1
@ -27,6 +26,7 @@ static const bigtime_t kDefaultClickSpeed = 500000;
static const int32 kDefaultMouseSpeed = 65536;
static const int32 kDefaultMouseType = 3; // 3 button mouse
static const int32 kDefaultAccelerationFactor = 65536;
static const bool kDefaultAcceptFirstClick = false;
MouseSettings::MouseSettings()
@ -37,6 +37,8 @@ MouseSettings::MouseSettings()
fOriginalSettings = fSettings;
fOriginalMode = fMode;
fOriginalFocusFollowsMouseMode = fFocusFollowsMouseMode;
fOriginalAcceptFirstClick = fAcceptFirstClick;
}
@ -75,6 +77,8 @@ MouseSettings::_RetrieveSettings()
fprintf(stderr, "error when get_mouse_type\n");
fMode = mouse_mode();
fFocusFollowsMouseMode = focus_follows_mouse_mode();
fAcceptFirstClick = accept_first_click();
// also try to load the window position from disk
@ -151,19 +155,32 @@ MouseSettings::Dump()
char *mode = "unknown";
switch (fMode) {
case B_NORMAL_MOUSE:
mode = "normal";
mode = "click to activate";
break;
case B_CLICK_TO_FOCUS_MOUSE:
mode = "click to focus";
break;
case B_FOCUS_FOLLOWS_MOUSE:
mode = "focus follows mouse";
break;
case B_WARP_MOUSE:
mode = "warp mouse";
}
printf("mouse mode:\t%s\n", mode);
char *focus_follows_mouse_mode = "unknown";
switch (fMode) {
case B_NORMAL_FOCUS_FOLLOWS_MOUSE:
focus_follows_mouse_mode = "normal";
break;
case B_INSTANT_WARP_MOUSE:
mode = "instant warp mouse";
case B_WARP_FOCUS_FOLLOWS_MOUSE:
focus_follows_mouse_mode = "warp";
break;
case B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE:
focus_follows_mouse_mode = "instant warp";
break;
}
printf("mode:\t\t%s\n", mode);
printf("focus follows mouse mode:\t%s\n", focus_follows_mouse_mode);
printf("accept first click:\t%s\n",
fAcceptFirstClick ? "enabled" : "disabled");
}
#endif
@ -177,6 +194,8 @@ MouseSettings::Defaults()
SetMouseType(kDefaultMouseType);
SetAccelerationFactor(kDefaultAccelerationFactor);
SetMouseMode(B_NORMAL_MOUSE);
SetFocusFollowsMouseMode(B_NORMAL_FOCUS_FOLLOWS_MOUSE);
SetAcceptFirstClick(kDefaultAcceptFirstClick);
mouse_map map;
if (get_mouse_map(&map) == B_OK) {
@ -197,6 +216,8 @@ MouseSettings::IsDefaultable()
|| fSettings.type != kDefaultMouseType
|| fSettings.accel.accel_factor != kDefaultAccelerationFactor
|| fMode != B_NORMAL_MOUSE
|| fFocusFollowsMouseMode != B_NORMAL_FOCUS_FOLLOWS_MOUSE
|| fAcceptFirstClick != kDefaultAcceptFirstClick
|| fSettings.map.button[0] != B_PRIMARY_MOUSE_BUTTON
|| fSettings.map.button[1] != B_SECONDARY_MOUSE_BUTTON
|| fSettings.map.button[2] != B_TERTIARY_MOUSE_BUTTON;
@ -212,6 +233,9 @@ MouseSettings::Revert()
SetMouseType(fOriginalSettings.type);
SetAccelerationFactor(fOriginalSettings.accel.accel_factor);
SetMouseMode(fOriginalMode);
SetFocusFollowsMouseMode(fOriginalFocusFollowsMouseMode);
SetAcceptFirstClick(fOriginalAcceptFirstClick);
SetMapping(fOriginalSettings.map);
}
@ -313,3 +337,19 @@ MouseSettings::SetMouseMode(mode_mouse mode)
fMode = mode;
}
void
MouseSettings::SetFocusFollowsMouseMode(mode_focus_follows_mouse mode)
{
set_focus_follows_mouse_mode(mode);
fFocusFollowsMouseMode = mode;
}
void
MouseSettings::SetAcceptFirstClick(bool accept_first_click)
{
set_accept_first_click(accept_first_click);
fAcceptFirstClick = accept_first_click;
}

View File

@ -6,19 +6,21 @@
* Jérôme Duval,
* Axel Dörfler (axeld@pinc-software.de)
* Andrew McCall (mccall@digitalparadise.co.uk)
* Brecht Machiels (brecht@mos6581.org)
*/
#ifndef MOUSE_SETTINGS_H
#define MOUSE_SETTINGS_H
#include <InterfaceDefs.h>
#include <Point.h>
#include <SupportDefs.h>
#include "kb_mouse_settings.h"
#include <SupportDefs.h>
#include <InterfaceDefs.h>
class BPath;
class MouseSettings {
public:
MouseSettings();
@ -52,6 +54,14 @@ public:
mode_mouse MouseMode() const { return fMode; }
void SetMouseMode(mode_mouse mode);
mode_focus_follows_mouse FocusFollowsMouseMode() const {
return fFocusFollowsMouseMode;
}
void SetFocusFollowsMouseMode(mode_focus_follows_mouse mode);
bool AcceptFirstClick() const { return fAcceptFirstClick; }
void SetAcceptFirstClick(bool accept_first_click);
private:
static status_t _GetSettingsPath(BPath &path);
void _RetrieveSettings();
@ -59,6 +69,9 @@ private:
mouse_settings fSettings, fOriginalSettings;
mode_mouse fMode, fOriginalMode;
mode_focus_follows_mouse fFocusFollowsMouseMode;
mode_focus_follows_mouse fOriginalFocusFollowsMouseMode;
bool fAcceptFirstClick, fOriginalAcceptFirstClick;
BPoint fWindowPosition;
};

View File

@ -30,7 +30,6 @@
#include "MouseSettings.h"
#include "MouseWindow.h"
static const int32 kButtonTop = 6;
static const int32 kMouseDownWidth = 72;
static const int32 kMouseDownHeight = 30;
@ -86,9 +85,9 @@ getMappingNumber(int32 mapping)
// #pragma mark -
MouseView::MouseView(BRect rect, const MouseSettings &settings)
MouseView::MouseView(const MouseSettings &settings)
:
BView(rect, "mouse_view", B_FOLLOW_ALL, B_PULSE_NEEDED | B_WILL_DRAW),
BView("mouse_view", B_PULSE_NEEDED | B_WILL_DRAW),
fSettings(settings),
fType(-1),
fButtons(0),

View File

@ -11,38 +11,40 @@
#define MOUSE_VIEW_H
#include <View.h>
#include <Bitmap.h>
#include <PopUpMenu.h>
#include <View.h>
class MouseSettings;
class MouseView : public BView {
public:
MouseView(BRect frame, const MouseSettings &settings);
virtual ~MouseView();
MouseView(const MouseSettings &settings);
virtual ~MouseView();
virtual void AttachedToWindow();
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void Draw(BRect frame);
virtual void GetPreferredSize(float *_width, float *_height);
virtual void AttachedToWindow();
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void Draw(BRect frame);
virtual void GetPreferredSize(float *_width, float *_height);
void SetMouseType(int32 type);
void MouseMapUpdated();
void UpdateFromSettings();
void SetMouseType(int32 type);
void MouseMapUpdated();
void UpdateFromSettings();
private:
int32 _ConvertFromVisualOrder(int32 button);
typedef BView inherited;
typedef BView inherited;
const MouseSettings &fSettings;
const MouseSettings &fSettings;
BBitmap *fMouseBitmap, *fMouseDownBitmap;
BRect fMouseDownBounds;
int32 fType;
uint32 fButtons;
uint32 fOldButtons;
int32 fType;
uint32 fButtons;
uint32 fOldButtons;
};
#endif /* MOUSE_VIEW_H */

View File

@ -6,20 +6,22 @@
* Jérôme Duval,
* Axel Dörfler (axeld@pinc-software.de)
* Andrew McCall (mccall@digitalparadise.co.uk)
* Brecht Machiels (brecht@mos6581.org)
*/
#include <Alert.h>
#include <Application.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <Button.h>
#include <CheckBox.h>
#include <Debug.h>
#include <Menu.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <Message.h>
#include <Screen.h>
#include <Slider.h>
#include <Button.h>
#include <Menu.h>
#include <MenuItem.h>
#include <MenuField.h>
#include <Debug.h>
#include <string.h>
#include "MouseWindow.h"
#include "MouseConstants.h"
@ -29,44 +31,41 @@
MouseWindow::MouseWindow(BRect _rect)
:
BWindow(_rect, "Mouse", B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS |
B_AUTO_UPDATE_SIZE_LIMITS)
{
BView* view = new BView(Bounds(), "view", B_FOLLOW_ALL, 0);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(view);
// Add the main settings view
fSettingsView = new SettingsView(Bounds().InsetBySelf(kBorderSpace,
kBorderSpace), fSettings);
view->AddChild(fSettingsView);
fSettingsView = new SettingsView(fSettings);
fSettingsBox = new BBox("main box");
fSettingsBox->AddChild(fSettingsView);
// Add the "Default" button
BRect rect(kBorderSpace, fSettingsView->Frame().bottom + kItemSpace + 2,
kBorderSpace + 75, fSettingsView->Frame().bottom + 20);
fDefaultsButton = new BButton(rect, "defaults", "Defaults",
new BMessage(kMsgDefaults));
fDefaultsButton->ResizeToPreferred();
fDefaultsButton = new BButton("Defaults", new BMessage(kMsgDefaults));
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
view->AddChild(fDefaultsButton);
// Add the "Revert" button
rect.OffsetBy(fDefaultsButton->Bounds().Width() + kItemSpace, 0);
fRevertButton = new BButton(rect, "revert", "Revert",
new BMessage(kMsgRevert));
fRevertButton = new BButton("Revert", new BMessage(kMsgRevert));
fRevertButton->SetEnabled(false);
fRevertButton->ResizeToPreferred();
view->AddChild(fRevertButton);
SetPulseRate(100000);
// we are using the pulse rate to scan pressed mouse
// buttons and draw the selected imagery
ResizeTo(fSettingsView->Frame().right + kBorderSpace,
fRevertButton->Frame().bottom + kBorderSpace - 1);
// Build the layout
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.Add(fSettingsBox)
.AddGroup(B_HORIZONTAL, 5)
.Add(fDefaultsButton)
.Add(fRevertButton)
.AddGlue()
.End()
.SetInsets(10, 10, 10, 10)
);
// check if the window is on screen
rect = BScreen().Frame();
BRect rect = BScreen().Frame();
rect.InsetBySelf(20, 20);
BPoint position = fSettings.WindowPosition();
@ -137,6 +136,41 @@ MouseWindow::MessageReceived(BMessage* message)
fSettings.SetMouseMode((mode_mouse)mode);
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
fRevertButton->SetEnabled(true);
fSettingsView->fFocusFollowsMouseMenu->SetEnabled(
mode == B_FOCUS_FOLLOWS_MOUSE);
fSettingsView->fAcceptFirstClickBox->SetEnabled(
mode != B_FOCUS_FOLLOWS_MOUSE);
}
break;
}
case kMsgFollowsMouseMode:
{
int32 mode;
if (message->FindInt32("mode_focus_follows_mouse", &mode)
== B_OK) {
fSettings.SetFocusFollowsMouseMode(
(mode_focus_follows_mouse)mode);
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
fRevertButton->SetEnabled(true);
}
break;
}
case kMsgAcceptFirstClick:
{
BHandler *handler;
if (message->FindPointer("source",
reinterpret_cast<void**>(&handler)) == B_OK) {
bool acceptFirstClick = false;
BCheckBox *acceptFirstClickBox =
dynamic_cast<BCheckBox*>(handler);
if (acceptFirstClickBox)
acceptFirstClick = acceptFirstClickBox->Value()
== B_CONTROL_ON;
fSettings.SetAcceptFirstClick(acceptFirstClick);
fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
fRevertButton->SetEnabled(true);
}
break;
}

View File

@ -6,18 +6,20 @@
* Jérôme Duval,
* Axel Dörfler (axeld@pinc-software.de)
* Andrew McCall (mccall@digitalparadise.co.uk)
* Brecht Machiels (brecht@mos6581.org)
*/
#ifndef MOUSE_WINDOW_H
#define MOUSE_WINDOW_H
#include <Window.h>
#include <Box.h>
#include <Button.h>
#include <Window.h>
#include "MouseSettings.h"
class SettingsView;
class SettingsView;
class MouseWindow : public BWindow {
public:
@ -31,6 +33,7 @@ private:
BButton *fDefaultsButton;
BButton *fRevertButton;
SettingsView *fSettingsView;
BBox *fSettingsBox;
};
#endif /* MOUSE_WINDOW_H */

View File

@ -6,23 +6,26 @@
* Jérôme Duval,
* Axel Dörfler (axeld@pinc-software.de)
* Andrew McCall (mccall@digitalparadise.co.uk)
* Brecht Machiels (brecht@mos6581.org)
*/
#include "SettingsView.h"
#include <InterfaceDefs.h>
#include <Button.h>
#include <Box.h>
#include <Bitmap.h>
#include <TranslationUtils.h>
#include <TextControl.h>
#include <Slider.h>
#include <PopUpMenu.h>
#include <Box.h>
#include <Button.h>
#include <Debug.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <InterfaceDefs.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <Debug.h>
#include <PopUpMenu.h>
#include <Slider.h>
#include <TextControl.h>
#include <TranslationUtils.h>
#include <Window.h>
#include "SettingsView.h"
#include "MouseConstants.h"
#include "MouseSettings.h"
#include "MouseView.h"
@ -35,12 +38,24 @@ mouse_mode_to_index(mode_mouse mode)
case B_NORMAL_MOUSE:
default:
return 0;
case B_FOCUS_FOLLOWS_MOUSE:
case B_CLICK_TO_FOCUS_MOUSE:
return 1;
case B_WARP_MOUSE:
case B_FOCUS_FOLLOWS_MOUSE:
return 2;
}
}
static int32
focus_follows_mouse_mode_to_index(mode_focus_follows_mouse mode)
{
switch (mode) {
case B_NORMAL_FOCUS_FOLLOWS_MOUSE:
default:
return 0;
case B_WARP_FOCUS_FOLLOWS_MOUSE:
return 1;
case B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE:
return 2;
case B_INSTANT_WARP_MOUSE:
return 3;
}
}
@ -48,151 +63,153 @@ mouse_mode_to_index(mode_mouse mode)
// #pragma mark -
SettingsView::SettingsView(BRect rect, MouseSettings &settings)
:
BBox(rect, "main_view"),
SettingsView::SettingsView(MouseSettings &settings)
: BBox("main_view"),
fSettings(settings)
{
ResizeToPreferred();
fDoubleClickBitmap = BTranslationUtils::GetBitmap("double_click_bmap");
fSpeedBitmap = BTranslationUtils::GetBitmap("speed_bmap");
fAccelerationBitmap = BTranslationUtils::GetBitmap("acceleration_bmap");
// Add the "Mouse Type" pop up menu
fTypeMenu = new BPopUpMenu("unknown");
fTypeMenu->AddItem(new BMenuItem("1-Button", new BMessage(kMsgMouseType)));
fTypeMenu->AddItem(new BMenuItem("2-Button", new BMessage(kMsgMouseType)));
fTypeMenu->AddItem(new BMenuItem("3-Button", new BMessage(kMsgMouseType)));
BMenuField *field = new BMenuField(BRect(7, 8, 155, 190), "mouse_type",
"Mouse type:", fTypeMenu);
field->SetDivider(field->StringWidth(field->Label()) + kItemSpace);
field->SetAlignment(B_ALIGN_RIGHT);
AddChild(field);
BFont font = be_plain_font;
float length = font.StringWidth("Mouse type: [3-Button]") + 20;
fLeftArea.Set(8, 7, length + 8, 198);
if (fLeftArea.Width() < 125)
fLeftArea.right = fLeftArea.left + 125;
fRightArea.Set(fLeftArea.right + 10, 11, 200, 7);
BMenuField *fTypeField = new BMenuField("Mouse type:", fTypeMenu, NULL);
fTypeField->SetAlignment(B_ALIGN_RIGHT);
// Create the "Double-click speed slider...
fClickSpeedSlider = new BSlider(fRightArea, "double_click_speed",
"Double-click speed", new BMessage(kMsgDoubleClickSpeed), 0, 1000);
fClickSpeedSlider = new BSlider("double_click_speed", "Double-click speed",
new BMessage(kMsgDoubleClickSpeed), 0, 1000, B_HORIZONTAL);
fClickSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fClickSpeedSlider->SetHashMarkCount(5);
fClickSpeedSlider->SetLimitLabels("Slow", "Fast");
AddChild(fClickSpeedSlider);
length = fClickSpeedSlider->Bounds().Height() + 6;
fDoubleClickBmpPoint.y = fRightArea.top +
(length - (fDoubleClickBitmap != NULL
? fDoubleClickBitmap->Bounds().Height() : 0)) / 2;
fRightArea.top += length;
// Create the "Mouse Speed" slider...
fMouseSpeedSlider = new BSlider(fRightArea, "mouse_speed", "Mouse Speed",
new BMessage(kMsgMouseSpeed), 0, 1000);
fMouseSpeedSlider = new BSlider("mouse_speed", "Mouse Speed",
new BMessage(kMsgMouseSpeed), 0, 1000, B_HORIZONTAL);
fMouseSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fMouseSpeedSlider->SetHashMarkCount(7);
fMouseSpeedSlider->SetLimitLabels("Slow", "Fast");
AddChild(fMouseSpeedSlider);
fSpeedBmpPoint.y = fRightArea.top +
(length - (fSpeedBitmap != NULL
? fSpeedBitmap->Bounds().Height() : 0)) / 2;
fRightArea.top += length;
// Create the "Mouse Acceleration" slider...
fAccelerationSlider = new BSlider(fRightArea, "mouse_acceleration",
"Mouse Acceleration", new BMessage(kMsgAccelerationFactor), 0, 1000);
fAccelerationSlider = new BSlider("mouse_acceleration",
"Mouse Acceleration", new BMessage(kMsgAccelerationFactor),
0, 1000, B_HORIZONTAL);
fAccelerationSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fAccelerationSlider->SetHashMarkCount(5);
fAccelerationSlider->SetLimitLabels("Slow", "Fast");
AddChild(fAccelerationSlider);
fAccelerationBmpPoint.y = fRightArea.top +
(length - (fAccelerationBitmap != NULL
? fAccelerationBitmap->Bounds().Height() : 0)) / 2;
fRightArea.top += length - 3;
// Add the "Focus follows mouse" pop up menu
fFocusMenu = new BPopUpMenu("Disabled");
const char *focusLabels[] = {"Disabled", "Enabled", "Warping",
"Instant-Warping"};
const mode_mouse focusModes[] = {B_NORMAL_MOUSE, B_FOCUS_FOLLOWS_MOUSE,
B_WARP_MOUSE, B_INSTANT_WARP_MOUSE};
// Mouse image...
fMouseView = new MouseView(fSettings);
for (int i = 0; i < 4; i++) {
// Create the "Double-click test area" text box...
BTextControl *fDoubleClick = new BTextControl(NULL,
"Double-click test area", NULL);
fDoubleClick->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
// Add the "Mouse focus mode" pop up menu
fFocusMenu = new BPopUpMenu("Click to Activate");
const char *focusLabels[] = {"Click to Activate", "Click to Focus",
"Focus Follows Mouse"};
const mode_mouse focusModes[] = {B_NORMAL_MOUSE, B_CLICK_TO_FOCUS_MOUSE,
B_FOCUS_FOLLOWS_MOUSE};
for (int i = 0; i < 3; i++) {
BMessage *message = new BMessage(kMsgMouseFocusMode);
message->AddInt32("mode", focusModes[i]);
fFocusMenu->AddItem(new BMenuItem(focusLabels[i], message));
}
BRect frame(fRightArea.left, fRightArea.top + 10, fRightArea.left +
font.StringWidth("Focus follows mouse:") +
font.StringWidth(focusLabels[3]) + 30, 200);
field = new BMenuField(frame, "ffm", "Focus follows mouse:", fFocusMenu,
true);
field->SetDivider(field->StringWidth(field->Label()) + kItemSpace);
field->SetAlignment(B_ALIGN_RIGHT);
AddChild(field);
BMenuField *fFocusField = new BMenuField("Focus mode:", fFocusMenu, NULL);
fFocusField->SetAlignment(B_ALIGN_RIGHT);
// Add the "Focus follows mouse mode" pop up menu
fFocusFollowsMouseMenu = new BPopUpMenu("Normal");
const char *focusFollowsMouseLabels[] = {"Normal", "Warp", "Instant Warp"};
const mode_focus_follows_mouse focusFollowsMouseModes[] =
{B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE,
B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE};
// Finalize the areas
fRightArea.bottom = fRightArea.top;
fRightArea.top = 11;
fRightArea.right = frame.right + 8;
if (fRightArea.Width() < 200)
fRightArea.right = fRightArea.left + 200;
fLeftArea.bottom = fRightArea.bottom;
for (int i = 0; i < 3; i++) {
BMessage *message = new BMessage(kMsgFollowsMouseMode);
message->AddInt32("mode_focus_follows_mouse",
focusFollowsMouseModes[i]);
// Position mouse bitmaps
fDoubleClickBmpPoint.x = fRightArea.right - 15
- (fDoubleClickBitmap != NULL ? fDoubleClickBitmap->Bounds().right : 0);
fSpeedBmpPoint.x = fRightArea.right - 15
- (fSpeedBitmap != NULL ? fSpeedBitmap->Bounds().right : 0);
fAccelerationBmpPoint.x = fRightArea.right - 15
- (fAccelerationBitmap != NULL ? fAccelerationBitmap->Bounds().right
: 0);
fFocusFollowsMouseMenu->AddItem(new BMenuItem(
focusFollowsMouseLabels[i], message));
}
// Resize sliders to equal size
length = fRightArea.left - 5;
fClickSpeedSlider->ResizeTo(fDoubleClickBmpPoint.x - length,
fClickSpeedSlider->Bounds().Height());
fMouseSpeedSlider->ResizeTo(fSpeedBmpPoint.x - length,
fMouseSpeedSlider->Bounds().Height());
fAccelerationSlider->ResizeTo(fAccelerationBmpPoint.x - length,
fAccelerationSlider->Bounds().Height());
BMenuField *fFocusFollowsMouseField = new BMenuField(
"Focus follows mouse mode:", fFocusFollowsMouseMenu, NULL);
fFocusFollowsMouseField->SetAlignment(B_ALIGN_RIGHT);
// Mouse image...
frame.Set(0, 0, 148, 162);
fMouseView = new MouseView(frame, fSettings);
fMouseView->ResizeToPreferred();
fMouseView->MoveBy((fLeftArea.right - fMouseView->Bounds().Width()) / 2,
(fLeftArea.bottom - fMouseView->Bounds().Height()) / 2);
AddChild(fMouseView);
// Add the "Click-through" check box
fAcceptFirstClickBox = new BCheckBox("Accept first click",
new BMessage(kMsgAcceptFirstClick));
// Create the "Double-click test area" text box...
frame.Set(fLeftArea.left, fLeftArea.bottom + 10, fLeftArea.right, 0);
BTextControl *textControl = new BTextControl(frame,
"double_click_test_area", NULL, "Double-click test area", NULL);
textControl->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
AddChild(textControl);
// dividers
BBox* hdivider = new BBox(
BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
hdivider->SetExplicitMaxSize(BSize(1, B_SIZE_UNLIMITED));
BBox* vdivider = new BBox(
BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
vdivider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));
ResizeTo(fRightArea.right + 5, fLeftArea.bottom + 60);
// Build the layout
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.AddGroup(B_HORIZONTAL, 10)
.AddGroup(B_VERTICAL, 10, 1)
.AddGroup(B_HORIZONTAL, 10)
.AddGlue()
.Add(fTypeField)
.AddGlue()
.End()
.AddGlue()
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
.AddGlue()
.Add(fMouseView)
.AddGlue()
)
.AddGlue()
.Add(fDoubleClick)
.End()
.Add(hdivider)
.AddGroup(B_VERTICAL, 5, 3)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(fClickSpeedSlider)
)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(fMouseSpeedSlider)
)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(fAccelerationSlider)
)
.End()
.End()
.Add(vdivider)
.AddGroup(B_HORIZONTAL, 10)
.Add(fFocusField)
.AddGlue()
.AddGroup(B_VERTICAL, 0)
.Add(fAcceptFirstClickBox)
//.Add(fFocusFollowsMouseField)
.End()
.End()
.SetInsets(5, 5, 5, 5)
);
}
SettingsView::~SettingsView()
{
delete fDoubleClickBitmap;
delete fSpeedBitmap;
delete fAccelerationBitmap;
}
@ -203,69 +220,6 @@ SettingsView::AttachedToWindow()
}
void
SettingsView::GetPreferredSize(float* _width, float* _height)
{
if (_width)
*_width = fRightArea.right + 5;
if (_height)
*_height = fLeftArea.bottom + 60;
}
void
SettingsView::Draw(BRect updateFrame)
{
inherited::Draw(updateFrame);
SetHighColor(120, 120, 120);
SetLowColor(255, 255, 255);
// Line above the test area
fLeft = fLeftArea.LeftBottom();
fRight = fLeftArea.RightBottom();
StrokeLine(fLeft, fRight, B_SOLID_HIGH);
fLeft.y++; fRight.y++;
StrokeLine(fLeft, fRight, B_SOLID_LOW);
// Line above focus follows mouse
fLeft = fRightArea.LeftBottom();
fRight = fRightArea.RightBottom();
StrokeLine(fLeft, fRight, B_SOLID_HIGH);
fLeft.y++; fRight.y++;
StrokeLine(fLeft, fRight, B_SOLID_LOW);
// Line in the middle
fLeft = fLeftArea.RightTop();
fRight = fLeftArea.RightBottom();
fLeft.x += 5;
fRight.x += 5;
StrokeLine(fLeft, fRight, B_SOLID_HIGH);
fLeft.x++; fRight.x++;
StrokeLine(fLeft, fRight, B_SOLID_LOW);
SetDrawingMode(B_OP_OVER);
// Draw the icons
if (fDoubleClickBitmap != NULL
&& updateFrame.Intersects(BRect(fDoubleClickBmpPoint,
fDoubleClickBmpPoint + fDoubleClickBitmap->Bounds().RightBottom())))
DrawBitmapAsync(fDoubleClickBitmap, fDoubleClickBmpPoint);
if (fSpeedBitmap != NULL
&& updateFrame.Intersects(BRect(fSpeedBmpPoint, fSpeedBmpPoint
+ fSpeedBitmap->Bounds().RightBottom())))
DrawBitmapAsync(fSpeedBitmap, fSpeedBmpPoint);
if (fAccelerationBitmap != NULL
&& updateFrame.Intersects(BRect(fAccelerationBmpPoint, fAccelerationBmpPoint
+ fAccelerationBitmap->Bounds().RightBottom())))
DrawBitmapAsync(fAccelerationBitmap, fAccelerationBmpPoint);
SetDrawingMode(B_OP_COPY);
}
void
SettingsView::SetMouseType(int32 type)
{
@ -304,4 +258,16 @@ SettingsView::UpdateFromSettings()
item = fFocusMenu->ItemAt(mouse_mode_to_index(fSettings.MouseMode()));
if (item != NULL)
item->SetMarked(true);
item = fFocusFollowsMouseMenu->ItemAt(
focus_follows_mouse_mode_to_index(fSettings.FocusFollowsMouseMode()));
if (item != NULL)
item->SetMarked(true);
fFocusFollowsMouseMenu->SetEnabled(fSettings.MouseMode()
== B_FOCUS_FOLLOWS_MOUSE);
fAcceptFirstClickBox->SetValue(fSettings.AcceptFirstClick()
? B_CONTROL_ON : B_CONTROL_OFF);
}

View File

@ -6,6 +6,7 @@
* Jérôme Duval,
* Axel Dörfler (axeld@pinc-software.de)
* Andrew McCall (mccall@digitalparadise.co.uk)
* Brecht Machiels (brecht@mos6581.org)
*/
#ifndef SETTINGS_VIEW_H
#define SETTINGS_VIEW_H
@ -14,6 +15,7 @@
#include <Box.h>
#include <Bitmap.h>
#include <Button.h>
#include <CheckBox.h>
#include <Slider.h>
#include <PopUpMenu.h>
@ -23,32 +25,27 @@ class MouseView;
class SettingsView : public BBox {
public:
SettingsView(BRect frame, MouseSettings &settings);
public:
SettingsView(MouseSettings &settings);
virtual ~SettingsView();
virtual void AttachedToWindow();
virtual void GetPreferredSize(float* _width, float* _height);
virtual void Draw(BRect frame);
void SetMouseType(int32 type);
void MouseMapUpdated();
void UpdateFromSettings();
private:
private:
friend class MouseWindow;
typedef BBox inherited;
const MouseSettings &fSettings;
BPopUpMenu *fTypeMenu, *fFocusMenu;
BPopUpMenu *fTypeMenu, *fFocusMenu, *fFocusFollowsMouseMenu;
BCheckBox *fAcceptFirstClickBox;
MouseView *fMouseView;
BSlider *fClickSpeedSlider, *fMouseSpeedSlider, *fAccelerationSlider;
BBitmap *fDoubleClickBitmap, *fSpeedBitmap, *fAccelerationBitmap;
BRect fLeftArea, fRightArea;
BPoint fLeft, fRight;
BPoint fDoubleClickBmpPoint, fSpeedBmpPoint, fAccelerationBmpPoint;
};
#endif /* SETTINGS_VIEW_H */

View File

@ -13,6 +13,16 @@
#include "DefaultDecorator.h"
#include <new>
#include <stdio.h>
#include <Autolock.h>
#include <GradientLinear.h>
#include <Rect.h>
#include <View.h>
#include <WindowPrivate.h>
#include "BitmapDrawingEngine.h"
#include "DesktopSettings.h"
#include "DrawingEngine.h"
@ -21,15 +31,6 @@
#include "PatternHandler.h"
#include "ServerBitmap.h"
#include <WindowPrivate.h>
#include <Autolock.h>
#include <GradientLinear.h>
#include <Rect.h>
#include <View.h>
#include <new>
#include <stdio.h>
//#define DEBUG_DECORATOR
#ifdef DEBUG_DECORATOR
@ -576,7 +577,7 @@ DefaultDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
// NOTE: On R5, windows are not moved to back if clicked inside the
// resize area with the second mouse button. So we check this after
// the check above
if (buttons == B_SECONDARY_MOUSE_BUTTON)
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
return DEC_MOVETOBACK;
if (fWasDoubleClick && !(fFlags & B_NOT_MINIMIZABLE))

View File

@ -10,9 +10,11 @@
#define DEFAULT_DECORATOR_H
#include "Decorator.h"
#include <Region.h>
#include "Decorator.h"
class Desktop;
class ServerBitmap;

View File

@ -5,8 +5,9 @@
* Authors:
* Adrian Oanca <adioanca@cotty.iren.ro>
* Stephan Aßmus <superstippi@gmx.de>
* Axel Dörfler, axeld@pinc-software.de
* Andrej Spielmann, <andrej.spielmann@seh.ox.ac.uk>
* Axel Dörfler <axeld@pinc-software.de>
* Andrej Spielmann <andrej.spielmann@seh.ox.ac.uk>
* Brecht Machiels <brecht@mos6581.org>
*/
@ -123,7 +124,8 @@ KeyboardFilter::_UpdateFocus(int32 key, uint32 modifiers, EventTarget** _target)
// be done differently, though (using something like B_LOCK_WINDOW_FOCUS)
// (at least B_WINDOW_ACTIVATED must be postponed)
if (fLastFocus == NULL || (focus != fLastFocus && now - fTimestamp > 100000)) {
if (fLastFocus == NULL
|| (focus != fLastFocus && now - fTimestamp > 100000)) {
// if the time span between the key presses is very short
// we keep our previous focus alive - this is safe even
// if the target doesn't exist anymore, as we don't reset
@ -215,8 +217,8 @@ MouseFilter::MouseFilter(Desktop* desktop)
filter_result
MouseFilter::Filter(BMessage* message, EventTarget** _target, int32* _viewToken,
BMessage* latestMouseMoved)
MouseFilter::Filter(BMessage* message, EventTarget** _target,
int32* _viewToken, BMessage* latestMouseMoved)
{
BPoint where;
if (message->FindPoint("where", &where) != B_OK)
@ -244,7 +246,8 @@ MouseFilter::Filter(BMessage* message, EventTarget** _target, int32* _viewToken,
case B_MOUSE_UP:
window->MouseUp(message, where, &viewToken);
fDesktop->SetMouseEventWindow(NULL);
if (buttons == 0)
fDesktop->SetMouseEventWindow(NULL);
break;
case B_MOUSE_MOVED:
@ -388,7 +391,8 @@ Desktop::Init()
return B_ERROR;
}
fVirtualScreen.HWInterface()->MoveCursorTo(fVirtualScreen.Frame().Width() / 2,
fVirtualScreen.HWInterface()->MoveCursorTo(
fVirtualScreen.Frame().Width() / 2,
fVirtualScreen.Frame().Height() / 2);
#if TEST_MODE
@ -843,6 +847,24 @@ Desktop::RemoveWorkspacesView(WorkspacesView* view)
// #pragma mark - Methods for Window manipulation
/*! \brief Activates or focusses the window based on the pointer position.
*/
void
Desktop::SelectWindow(Window* window)
{
if (fSettings->MouseMode() != B_NORMAL_MOUSE) {
// Only bring the window to front when it is not the window under the
// mouse pointer. This should result in sensible behaviour.
if (window != fWindowUnderMouse
|| (window == fWindowUnderMouse && window != FocusWindow()))
ActivateWindow(window);
else
SetFocusWindow(window);
} else
ActivateWindow(window);
}
/*! \brief Tries to move the specified window to the front of the screen,
and make it the focus window.
@ -853,7 +875,8 @@ Desktop::RemoveWorkspacesView(WorkspacesView* view)
void
Desktop::ActivateWindow(Window* window)
{
STRACE(("ActivateWindow(%p, %s)\n", window, window ? window->Title() : "<none>"));
STRACE(("ActivateWindow(%p, %s)\n", window, window
? window->Title() : "<none>"));
if (window == NULL) {
fBack = NULL;
@ -1003,8 +1026,10 @@ Desktop::SendWindowBehind(Window* window, Window* behindOf)
MarkDirty(dirty);
_UpdateFronts();
SetFocusWindow(fSettings->FocusFollowsMouse() ?
WindowAt(fLastMousePosition) : NULL);
if (fSettings->MouseMode() == B_FOCUS_FOLLOWS_MOUSE)
SetFocusWindow(WindowAt(fLastMousePosition));
else if (fSettings->MouseMode() == B_NORMAL_MOUSE)
SetFocusWindow(NULL);
bool sendFakeMouseMoved = false;
if (FocusWindow() != window)
@ -1413,7 +1438,8 @@ Desktop::SetWindowFeel(Window* window, window_feel newFeel)
// adopt the window's current workspaces
if (!window->IsNormal())
_ChangeWindowWorkspaces(window, window->Workspaces(), window->SubsetWorkspaces());
_ChangeWindowWorkspaces(window, window->Workspaces(),
window->SubsetWorkspaces());
// make sure the window has the correct position in the window lists
// (ie. all floating windows have to be on the top, ...)
@ -2083,7 +2109,8 @@ Desktop::_LaunchInputServer()
if (entryStatus == B_OK)
entryStatus = roster.Launch(&ref);
if (entryStatus == B_OK || entryStatus == B_ALREADY_RUNNING) {
syslog(LOG_ERR, "Failed to launch the input server by signature: %s!\n",
syslog(LOG_ERR,
"Failed to launch the input server by signature: %s!\n",
strerror(status));
return;
}
@ -2119,7 +2146,8 @@ Desktop::_PrepareQuit()
// wait for the last app to die
if (count > 0)
acquire_sem_etc(fShutdownSemaphore, fShutdownCount, B_RELATIVE_TIMEOUT, 250000);
acquire_sem_etc(fShutdownSemaphore, fShutdownCount, B_RELATIVE_TIMEOUT,
250000);
fApplicationsLock.Unlock();
}
@ -2135,7 +2163,8 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
// Attached data:
// 1) port_id - receiver port of a regular app
// 2) port_id - client looper port - for sending messages to the client
// 2) port_id - client looper port - for sending messages to the
// client
// 2) team_id - app's team ID
// 3) int32 - handler token of the regular app
// 4) char * - signature of the regular app
@ -2179,8 +2208,8 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
case AS_DELETE_APP:
{
// Delete a ServerApp. Received only from the respective ServerApp when a
// BApplication asks it to quit.
// Delete a ServerApp. Received only from the respective ServerApp
// when a BApplication asks it to quit.
// Attached Data:
// 1) thread_id - thread ID of the ServerApp to be deleted
@ -2213,7 +2242,8 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
if (fQuitting && count <= 1) {
// wait for the last app to die
acquire_sem_etc(fShutdownSemaphore, fShutdownCount, B_RELATIVE_TIMEOUT, 500000);
acquire_sem_etc(fShutdownSemaphore, fShutdownCount,
B_RELATIVE_TIMEOUT, 500000);
PostMessage(kMsgQuitLooper);
}
break;
@ -2268,8 +2298,8 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
case B_QUIT_REQUESTED:
// We've been asked to quit, so (for now) broadcast to all
// test apps to quit. This situation will occur only when the server
// is compiled as a regular Be application.
// test apps to quit. This situation will occur only when the
// server is compiled as a regular Be application.
fApplicationsLock.Lock();
fShutdownSemaphore = create_sem(0, "desktop shutdown");
@ -2313,7 +2343,8 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
}
default:
printf("Desktop %d:%s received unexpected code %ld\n", 0, "baron", code);
printf("Desktop %d:%s received unexpected code %ld\n", 0, "baron",
code);
if (link.NeedsReply()) {
// the client is now blocking and waiting for a reply!
@ -2425,8 +2456,10 @@ Desktop::_UpdateFront(bool updateFloating)
fFront = NULL;
for (Window* window = _CurrentWindows().LastWindow();
window != NULL; window = window->PreviousWindow(fCurrentWorkspace)) {
if (window->IsHidden() || window->IsFloating() || !window->SupportsFront())
window != NULL;
window = window->PreviousWindow(fCurrentWorkspace)) {
if (window->IsHidden() || window->IsFloating()
|| !window->SupportsFront())
continue;
fFront = window;
@ -2564,7 +2597,8 @@ void
Desktop::_UpdateSubsetWorkspaces(Window* window, int32 previousIndex,
int32 newIndex)
{
STRACE(("_UpdateSubsetWorkspaces(window %p, %s)\n", window, window->Title()));
STRACE(("_UpdateSubsetWorkspaces(window %p, %s)\n", window,
window->Title()));
// if the window is hidden, the subset windows are up-to-date already
if (!window->IsNormal() || window->IsHidden())
@ -2720,7 +2754,8 @@ Desktop::_LastFocusSubsetWindow(Window* window)
for (Window* front = fFocusList.LastWindow(); front != NULL;
front = front->PreviousWindow(kFocusList)) {
if (front != window && !front->IsHidden() && window->HasInSubset(front))
if (front != window && !front->IsHidden()
&& window->HasInSubset(front))
return front;
}
@ -3142,7 +3177,8 @@ Desktop::_SetWorkspace(int32 index)
}
if (window->Frame().LeftTop() != position) {
// the window was visible before, but its on-screen location changed
// the window was visible before, but its on-screen location
// changed
BPoint offset = position - window->Frame().LeftTop();
MoveWindowBy(window, offset.x, offset.y);
// TODO: be a bit smarter than this...

View File

@ -5,8 +5,9 @@
* Authors:
* Adrian Oanca <adioanca@cotty.iren.ro>
* Stephan Aßmus <superstippi@gmx.de>
* Axel Dörfler, axeld@pinc-software.de
* Axel Dörfler <axeld@pinc-software.de>
* Andrej Spielmann, <andrej.spielmann@seh.ox.ac.uk>
* Brecht Machiels <brecht@mos6581.org>
*/
#ifndef DESKTOP_H
#define DESKTOP_H
@ -161,6 +162,7 @@ public:
// Window methods
void SelectWindow(Window* window);
void ActivateWindow(Window* window);
void SendWindowBehind(Window* window,
Window* behindOf = NULL);

View File

@ -11,6 +11,15 @@
#include "DesktopSettings.h"
#include "DesktopSettingsPrivate.h"
#include <Directory.h>
#include <File.h>
#include <FindDirectory.h>
#include <Path.h>
#include <DefaultColors.h>
#include <ServerReadOnlyMemory.h>
#include "Desktop.h"
#include "FontCache.h"
#include "FontCacheEntry.h"
@ -18,14 +27,6 @@
#include "GlobalSubpixelSettings.h"
#include "ServerConfig.h"
#include <DefaultColors.h>
#include <ServerReadOnlyMemory.h>
#include <Directory.h>
#include <File.h>
#include <FindDirectory.h>
#include <Path.h>
DesktopSettingsPrivate::DesktopSettingsPrivate(server_read_only_memory* shared)
:
@ -50,6 +51,8 @@ DesktopSettingsPrivate::_SetDefaults()
fFixedFont = *gFontManager->DefaultFixedFont();
fMouseMode = B_NORMAL_MOUSE;
fFocusFollowsMouseMode = B_NORMAL_FOCUS_FOLLOWS_MOUSE;
fAcceptFirstClick = false;
fShowAllDraggers = true;
// init scrollbar info
@ -194,9 +197,18 @@ DesktopSettingsPrivate::_Load()
status = settings.Unflatten(&file);
if (status == B_OK) {
int32 mode;
if (settings.FindInt32("mode", &mode) == B_OK) {
if (settings.FindInt32("mode", &mode) == B_OK)
fMouseMode = (mode_mouse)mode;
int32 focusFollowsMouseMode;
if (settings.FindInt32("focus follows mouse mode",
&focusFollowsMouseMode) == B_OK) {
fFocusFollowsMouseMode =
(mode_focus_follows_mouse)focusFollowsMouseMode;
}
bool acceptFirstClick;
if (settings.FindBool("accept first click", &acceptFirstClick)
== B_OK)
fAcceptFirstClick = acceptFirstClick;
}
}
@ -235,8 +247,8 @@ DesktopSettingsPrivate::_Load()
fMenuInfo.click_to_open = clickToOpen;
bool triggersAlwaysShown;
if (settings.FindBool("triggers always shown", &triggersAlwaysShown)
== B_OK) {
if (settings.FindBool("triggers always shown",
&triggersAlwaysShown) == B_OK) {
fMenuInfo.triggers_always_shown = triggersAlwaysShown;
}
@ -350,6 +362,9 @@ DesktopSettingsPrivate::Save(uint32 mask)
if (path.Append("mouse") == B_OK) {
BMessage settings('asms');
settings.AddInt32("mode", (int32)fMouseMode);
settings.AddInt32("focus follows mouse mode",
(int32)fFocusFollowsMouseMode);
settings.AddBool("accept first click", fAcceptFirstClick);
BFile file;
status = file.SetTo(path.Path(), B_CREATE_FILE | B_ERASE_FILE
@ -498,6 +513,15 @@ DesktopSettingsPrivate::SetMouseMode(const mode_mouse mode)
}
void
DesktopSettingsPrivate::SetFocusFollowsMouseMode(
const mode_focus_follows_mouse mode)
{
fFocusFollowsMouseMode = mode;
Save(kMouseSettings);
}
mode_mouse
DesktopSettingsPrivate::MouseMode() const
{
@ -505,10 +529,32 @@ DesktopSettingsPrivate::MouseMode() const
}
mode_focus_follows_mouse
DesktopSettingsPrivate::FocusFollowsMouseMode() const
{
return fFocusFollowsMouseMode;
}
void
DesktopSettingsPrivate::SetAcceptFirstClick(const bool acceptFirstClick)
{
fAcceptFirstClick = acceptFirstClick;
Save(kMouseSettings);
}
bool
DesktopSettingsPrivate::AcceptFirstClick() const
{
return fAcceptFirstClick;
}
bool
DesktopSettingsPrivate::FocusFollowsMouse() const
{
return MouseMode() != B_NORMAL_MOUSE;
return MouseMode() == B_FOCUS_FOLLOWS_MOUSE;
}
@ -740,6 +786,13 @@ DesktopSettings::MouseMode() const
}
mode_focus_follows_mouse
DesktopSettings::FocusFollowsMouseMode() const
{
return fSettings->FocusFollowsMouseMode();
}
bool
DesktopSettings::FocusFollowsMouse() const
{
@ -747,6 +800,13 @@ DesktopSettings::FocusFollowsMouse() const
}
bool
DesktopSettings::AcceptFirstClick() const
{
return fSettings->AcceptFirstClick();
}
bool
DesktopSettings::ShowAllDraggers() const
{
@ -882,6 +942,21 @@ LockedDesktopSettings::SetMouseMode(const mode_mouse mode)
}
void
LockedDesktopSettings::SetFocusFollowsMouseMode(
const mode_focus_follows_mouse mode)
{
fSettings->SetFocusFollowsMouseMode(mode);
}
void
LockedDesktopSettings::SetAcceptFirstClick(const bool acceptFirstClick)
{
fSettings->SetAcceptFirstClick(acceptFirstClick);
}
void
LockedDesktopSettings::SetShowAllDraggers(bool show)
{

View File

@ -44,7 +44,9 @@ class DesktopSettings {
void GetMenuInfo(menu_info& info) const;
mode_mouse MouseMode() const;
mode_focus_follows_mouse FocusFollowsMouseMode() const;
bool FocusFollowsMouse() const;
bool AcceptFirstClick() const;
bool ShowAllDraggers() const;
@ -77,6 +79,9 @@ class LockedDesktopSettings : public DesktopSettings {
void SetMenuInfo(const menu_info& info);
void SetMouseMode(mode_mouse mode);
void SetFocusFollowsMouseMode(
const mode_focus_follows_mouse mode);
void SetAcceptFirstClick(bool accept_first_click);
void SetShowAllDraggers(bool show);

View File

@ -11,10 +11,12 @@
#include "DesktopSettings.h"
#include "ServerFont.h"
#include <Locker.h>
#include "ServerFont.h"
struct server_read_only_memory;
@ -43,7 +45,12 @@ public:
void SetMouseMode(mode_mouse mode);
mode_mouse MouseMode() const;
void SetFocusFollowsMouseMode(
mode_focus_follows_mouse mode);
mode_focus_follows_mouse FocusFollowsMouseMode() const;
bool FocusFollowsMouse() const;
void SetAcceptFirstClick(bool accept_first_click);
bool AcceptFirstClick() const;
void SetShowAllDraggers(bool show);
bool ShowAllDraggers() const;
@ -85,6 +92,8 @@ private:
scroll_bar_info fScrollBarInfo;
menu_info fMenuInfo;
mode_mouse fMouseMode;
mode_focus_follows_mouse fFocusFollowsMouseMode;
bool fAcceptFirstClick;
bool fShowAllDraggers;
int32 fWorkspacesColumns;
int32 fWorkspacesRows;

View File

@ -26,280 +26,285 @@ string_for_message_code(uint32 code, BString& string)
CODE(AS_EVENT_STREAM_CLOSED);
// Desktop definitions (through the ServerApp, though)
case AS_GET_WINDOW_LIST: string = "AS_GET_WINDOW_LIST"; break;
case AS_GET_WINDOW_INFO: string = "AS_GET_WINDOW_INFO"; break;
case AS_MINIMIZE_TEAM: string = "AS_MINIMIZE_TEAM"; break;
case AS_BRING_TEAM_TO_FRONT: string = "AS_BRING_TEAM_TO_FRONT"; break;
case AS_WINDOW_ACTION: string = "AS_WINDOW_ACTION"; break;
CODE(AS_GET_WINDOW_LIST);
CODE(AS_GET_WINDOW_INFO);
CODE(AS_MINIMIZE_TEAM);
CODE(AS_BRING_TEAM_TO_FRONT);
CODE(AS_WINDOW_ACTION);
// Application definitions
case AS_CREATE_APP: string = "AS_CREATE_APP"; break;
case AS_DELETE_APP: string = "AS_DELETE_APP"; break;
case AS_QUIT_APP: string = "AS_QUIT_APP"; break;
case AS_ACTIVATE_APP: string = "AS_ACTIVATE_APP"; break;
case AS_APP_CRASHED: string = "AS_APP_CRASHED"; break;
CODE(AS_CREATE_APP);
CODE(AS_DELETE_APP);
CODE(AS_QUIT_APP);
CODE(AS_ACTIVATE_APP);
CODE(AS_APP_CRASHED);
case AS_CREATE_WINDOW: string = "AS_CREATE_WINDOW"; break;
case AS_CREATE_OFFSCREEN_WINDOW: string = "AS_CREATE_OFFSCREEN_WINDOW"; break;
case AS_DELETE_WINDOW: string = "AS_DELETE_WINDOW"; break;
case AS_CREATE_BITMAP: string = "AS_CREATE_BITMAP"; break;
case AS_DELETE_BITMAP: string = "AS_DELETE_BITMAP"; break;
case AS_GET_BITMAP_OVERLAY_RESTRICTIONS: string = "AS_GET_BITMAP_OVERLAY_RESTRICTIONS"; break;
CODE(AS_CREATE_WINDOW);
CODE(AS_CREATE_OFFSCREEN_WINDOW);
CODE(AS_DELETE_WINDOW);
CODE(AS_CREATE_BITMAP);
CODE(AS_DELETE_BITMAP);
CODE(AS_GET_BITMAP_OVERLAY_RESTRICTIONS);
// Cursor commands
case AS_SET_CURSOR: string = "AS_SET_CURSOR"; break;
case AS_SET_VIEW_CURSOR: string = "AS_SET_VIEW_CURSOR"; break;
CODE(AS_SET_CURSOR);
CODE(AS_SET_VIEW_CURSOR);
case AS_SHOW_CURSOR: string = "AS_SHOW_CURSOR"; break;
case AS_HIDE_CURSOR: string = "AS_HIDE_CURSOR"; break;
case AS_OBSCURE_CURSOR: string = "AS_OBSCURE_CURSOR"; break;
case AS_QUERY_CURSOR_HIDDEN: string = "AS_QUERY_CURSOR_HIDDEN"; break;
CODE(AS_SHOW_CURSOR);
CODE(AS_HIDE_CURSOR);
CODE(AS_OBSCURE_CURSOR);
CODE(AS_QUERY_CURSOR_HIDDEN);
case AS_CREATE_CURSOR: string = "AS_CREATE_CURSOR"; break;
case AS_REFERENCE_CURSOR: string = "AS_REFERENCE_CURSOR"; break;
case AS_DELETE_CURSOR: string = "AS_DELETE_CURSOR"; break;
CODE(AS_CREATE_CURSOR);
CODE(AS_REFERENCE_CURSOR);
CODE(AS_DELETE_CURSOR);
case AS_BEGIN_RECT_TRACKING: string = "AS_BEGIN_RECT_TRACKING"; break;
case AS_END_RECT_TRACKING: string = "AS_END_RECT_TRACKING"; break;
CODE(AS_BEGIN_RECT_TRACKING);
CODE(AS_END_RECT_TRACKING);
// Window definitions
case AS_SHOW_WINDOW: string = "AS_SHOW_WINDOW"; break;
case AS_HIDE_WINDOW: string = "AS_HIDE_WINDOW"; break;
case AS_MINIMIZE_WINDOW: string = "AS_MINIMIZE_WINDOW"; break;
case AS_QUIT_WINDOW: string = "AS_QUIT_WINDOW"; break;
case AS_SEND_BEHIND: string = "AS_SEND_BEHIND"; break;
case AS_SET_LOOK: string = "AS_SET_LOOK"; break;
case AS_SET_FEEL: string = "AS_SET_FEEL"; break;
case AS_SET_FLAGS: string = "AS_SET_FLAGS"; break;
case AS_DISABLE_UPDATES: string = "AS_DISABLE_UPDATES"; break;
case AS_ENABLE_UPDATES: string = "AS_ENABLE_UPDATES"; break;
case AS_BEGIN_UPDATE: string = "AS_BEGIN_UPDATE"; break;
case AS_END_UPDATE: string = "AS_END_UPDATE"; break;
case AS_NEEDS_UPDATE: string = "AS_NEEDS_UPDATE"; break;
case AS_SET_WINDOW_TITLE: string = "AS_SET_WINDOW_TITLE"; break;
case AS_ADD_TO_SUBSET: string = "AS_ADD_TO_SUBSET"; break;
case AS_REMOVE_FROM_SUBSET: string = "AS_REMOVE_FROM_SUBSET"; break;
case AS_SET_ALIGNMENT: string = "AS_SET_ALIGNMENT"; break;
case AS_GET_ALIGNMENT: string = "AS_GET_ALIGNMENT"; break;
case AS_GET_WORKSPACES: string = "AS_GET_WORKSPACES"; break;
case AS_SET_WORKSPACES: string = "AS_SET_WORKSPACES"; break;
case AS_WINDOW_RESIZE: string = "AS_WINDOW_RESIZE"; break;
case AS_WINDOW_MOVE: string = "AS_WINDOW_MOVE"; break;
case AS_SET_SIZE_LIMITS: string = "AS_SET_SIZE_LIMITS"; break;
case AS_ACTIVATE_WINDOW: string = "AS_ACTIVATE_WINDOW"; break;
case AS_IS_FRONT_WINDOW: string = "AS_IS_FRONT_WINDOW"; break;
CODE(AS_SHOW_WINDOW);
CODE(AS_HIDE_WINDOW);
CODE(AS_MINIMIZE_WINDOW);
CODE(AS_QUIT_WINDOW);
CODE(AS_SEND_BEHIND);
CODE(AS_SET_LOOK);
CODE(AS_SET_FEEL);
CODE(AS_SET_FLAGS);
CODE(AS_DISABLE_UPDATES);
CODE(AS_ENABLE_UPDATES);
CODE(AS_BEGIN_UPDATE);
CODE(AS_END_UPDATE);
CODE(AS_NEEDS_UPDATE);
CODE(AS_SET_WINDOW_TITLE);
CODE(AS_ADD_TO_SUBSET);
CODE(AS_REMOVE_FROM_SUBSET);
CODE(AS_SET_ALIGNMENT);
CODE(AS_GET_ALIGNMENT);
CODE(AS_GET_WORKSPACES);
CODE(AS_SET_WORKSPACES);
CODE(AS_WINDOW_RESIZE);
CODE(AS_WINDOW_MOVE);
CODE(AS_SET_SIZE_LIMITS);
CODE(AS_ACTIVATE_WINDOW);
CODE(AS_IS_FRONT_WINDOW);
// BPicture definitions
case AS_CREATE_PICTURE: string = "AS_CREATE_PICTURE"; break;
case AS_DELETE_PICTURE: string = "AS_DELETE_PICTURE"; break;
case AS_CLONE_PICTURE: string = "AS_CLONE_PICTURE"; break;
case AS_DOWNLOAD_PICTURE: string = "AS_DOWNLOAD_PICTURE"; break;
CODE(AS_CREATE_PICTURE);
CODE(AS_DELETE_PICTURE);
CODE(AS_CLONE_PICTURE);
CODE(AS_DOWNLOAD_PICTURE);
// Font-related server communications
case AS_SET_SYSTEM_FONT: string = "AS_SET_SYSTEM_FONT"; break;
case AS_GET_SYSTEM_FONTS: string = "AS_GET_SYSTEM_FONTS"; break;
case AS_GET_SYSTEM_DEFAULT_FONT: string = "AS_GET_SYSTEM_DEFAULT_FONT"; break;
CODE(AS_SET_SYSTEM_FONT);
CODE(AS_GET_SYSTEM_FONTS);
CODE(AS_GET_SYSTEM_DEFAULT_FONT);
case AS_GET_FONT_LIST_REVISION: string = "AS_GET_FONT_LIST_REVISION"; break;
case AS_GET_FAMILY_AND_STYLES: string = "AS_GET_FAMILY_AND_STYLES"; break;
CODE(AS_GET_FONT_LIST_REVISION);
CODE(AS_GET_FAMILY_AND_STYLES);
case AS_GET_FAMILY_AND_STYLE: string = "AS_GET_FAMILY_AND_STYLE"; break;
case AS_GET_FAMILY_AND_STYLE_IDS: string = "AS_GET_FAMILY_AND_STYLE_IDS"; break;
case AS_GET_FONT_BOUNDING_BOX: string = "AS_GET_FONT_BOUNDING_BOX"; break;
case AS_GET_TUNED_COUNT: string = "AS_GET_TUNED_COUNT"; break;
case AS_GET_TUNED_INFO: string = "AS_GET_TUNED_INFO"; break;
case AS_GET_FONT_HEIGHT: string = "AS_GET_FONT_HEIGHT"; break;
case AS_GET_FONT_FILE_FORMAT: string = "AS_GET_FONT_FILE_FORMAT"; break;
case AS_GET_EXTRA_FONT_FLAGS: string = "AS_GET_EXTRA_FONT_FLAGS"; break;
CODE(AS_GET_FAMILY_AND_STYLE);
CODE(AS_GET_FAMILY_AND_STYLE_IDS);
CODE(AS_GET_FONT_BOUNDING_BOX);
CODE(AS_GET_TUNED_COUNT);
CODE(AS_GET_TUNED_INFO);
CODE(AS_GET_FONT_HEIGHT);
CODE(AS_GET_FONT_FILE_FORMAT);
CODE(AS_GET_EXTRA_FONT_FLAGS);
case AS_GET_STRING_WIDTHS: string = "AS_GET_STRING_WIDTHS"; break;
case AS_GET_EDGES: string = "AS_GET_EDGES"; break;
case AS_GET_ESCAPEMENTS: string = "AS_GET_ESCAPEMENTS"; break;
case AS_GET_ESCAPEMENTS_AS_FLOATS: string = "AS_GET_ESCAPEMENTS_AS_FLOATS"; break;
case AS_GET_BOUNDINGBOXES_CHARS: string = "AS_GET_BOUNDINGBOXES_CHARS"; break;
case AS_GET_BOUNDINGBOXES_STRING: string = "AS_GET_BOUNDINGBOXES_STRING"; break;
case AS_GET_BOUNDINGBOXES_STRINGS: string = "AS_GET_BOUNDINGBOXES_STRINGS"; break;
case AS_GET_HAS_GLYPHS: string = "AS_GET_HAS_GLYPHS"; break;
case AS_GET_GLYPH_SHAPES: string = "AS_GET_GLYPH_SHAPES"; break;
case AS_GET_TRUNCATED_STRINGS: string = "AS_GET_TRUNCATED_STRINGS"; break;
CODE(AS_GET_STRING_WIDTHS);
CODE(AS_GET_EDGES);
CODE(AS_GET_ESCAPEMENTS);
CODE(AS_GET_ESCAPEMENTS_AS_FLOATS);
CODE(AS_GET_BOUNDINGBOXES_CHARS);
CODE(AS_GET_BOUNDINGBOXES_STRING);
CODE(AS_GET_BOUNDINGBOXES_STRINGS);
CODE(AS_GET_HAS_GLYPHS);
CODE(AS_GET_GLYPH_SHAPES);
CODE(AS_GET_TRUNCATED_STRINGS);
// Screen methods
case AS_VALID_SCREEN_ID: string = "AS_VALID_SCREEN_ID"; break;
case AS_GET_NEXT_SCREEN_ID: string = "AS_GET_NEXT_SCREEN_ID"; break;
case AS_SCREEN_GET_MODE: string = "AS_SCREEN_GET_MODE"; break;
case AS_SCREEN_SET_MODE: string = "AS_SCREEN_SET_MODE"; break;
case AS_PROPOSE_MODE: string = "AS_PROPOSE_MODE"; break;
case AS_GET_MODE_LIST: string = "AS_GET_MODE_LIST"; break;
CODE(AS_VALID_SCREEN_ID);
CODE(AS_GET_NEXT_SCREEN_ID);
CODE(AS_SCREEN_GET_MODE);
CODE(AS_SCREEN_SET_MODE);
CODE(AS_PROPOSE_MODE);
CODE(AS_GET_MODE_LIST);
case AS_GET_PIXEL_CLOCK_LIMITS: string = "AS_GET_PIXEL_CLOCK_LIMITS"; break;
case AS_GET_TIMING_CONSTRAINTS: string = "AS_GET_TIMING_CONSTRAINTS"; break;
CODE(AS_GET_PIXEL_CLOCK_LIMITS);
CODE(AS_GET_TIMING_CONSTRAINTS);
case AS_SCREEN_GET_COLORMAP: string = "AS_SCREEN_GET_COLORMAP"; break;
case AS_GET_DESKTOP_COLOR: string = "AS_GET_DESKTOP_COLOR"; break;
case AS_SET_DESKTOP_COLOR: string = "AS_SET_DESKTOP_COLOR"; break;
case AS_GET_SCREEN_ID_FROM_WINDOW: string = "AS_GET_SCREEN_ID_FROM_WINDOW"; break;
CODE(AS_SCREEN_GET_COLORMAP);
CODE(AS_GET_DESKTOP_COLOR);
CODE(AS_SET_DESKTOP_COLOR);
CODE(AS_GET_SCREEN_ID_FROM_WINDOW);
case AS_READ_BITMAP: string = "AS_READ_BITMAP"; break;
CODE(AS_READ_BITMAP);
case AS_GET_RETRACE_SEMAPHORE: string = "AS_GET_RETRACE_SEMAPHORE"; break;
case AS_GET_ACCELERANT_INFO: string = "AS_GET_ACCELERANT_INFO"; break;
case AS_GET_MONITOR_INFO: string = "AS_GET_MONITOR_INFO"; break;
case AS_GET_FRAME_BUFFER_CONFIG: string = "AS_GET_FRAME_BUFFER_CONFIG"; break;
CODE(AS_GET_RETRACE_SEMAPHORE);
CODE(AS_GET_ACCELERANT_INFO);
CODE(AS_GET_MONITOR_INFO);
CODE(AS_GET_FRAME_BUFFER_CONFIG);
case AS_SET_DPMS: string = "AS_SET_DPMS"; break;
case AS_GET_DPMS_STATE: string = "AS_GET_DPMS_STATE"; break;
case AS_GET_DPMS_CAPABILITIES: string = "AS_GET_DPMS_CAPABILITIES"; break;
CODE(AS_SET_DPMS);
CODE(AS_GET_DPMS_STATE);
CODE(AS_GET_DPMS_CAPABILITIES);
// Misc stuff
case AS_GET_ACCELERANT_PATH: string = "AS_GET_ACCELERANT_PATH"; break;
case AS_GET_DRIVER_PATH: string = "AS_GET_DRIVER_PATH"; break;
CODE(AS_GET_ACCELERANT_PATH);
CODE(AS_GET_DRIVER_PATH);
// Global function call defs
case AS_SET_UI_COLORS: string = "AS_SET_UI_COLORS"; break;
case AS_SET_UI_COLOR: string = "AS_SET_UI_COLOR"; break;
case AS_SET_DECORATOR: string = "AS_SET_DECORATOR"; break;
case AS_GET_DECORATOR: string = "AS_GET_DECORATOR"; break;
case AS_R5_SET_DECORATOR: string = "AS_R5_SET_DECORATOR"; break;
case AS_COUNT_DECORATORS: string = "AS_COUNT_DECORATORS"; break;
case AS_GET_DECORATOR_NAME: string = "AS_GET_DECORATOR_NAME"; break;
CODE(AS_SET_UI_COLORS);
CODE(AS_SET_UI_COLOR);
CODE(AS_SET_DECORATOR);
CODE(AS_GET_DECORATOR);
case AS_R5_SET_DECORATOR:
string = "AS_R5_SET_DECORATOR"; break;
CODE(AS_COUNT_DECORATORS);
CODE(AS_GET_DECORATOR_NAME);
CODE(AS_SET_WORKSPACE_LAYOUT);
CODE(AS_GET_WORKSPACE_LAYOUT);
case AS_CURRENT_WORKSPACE: string = "AS_CURRENT_WORKSPACE"; break;
case AS_ACTIVATE_WORKSPACE: string = "AS_ACTIVATE_WORKSPACE"; break;
case AS_GET_SCROLLBAR_INFO: string = "AS_GET_SCROLLBAR_INFO"; break;
case AS_SET_SCROLLBAR_INFO: string = "AS_SET_SCROLLBAR_INFO"; break;
case AS_GET_MENU_INFO: string = "AS_GET_MENU_INFO"; break;
case AS_SET_MENU_INFO: string = "AS_SET_MENU_INFO"; break;
case AS_IDLE_TIME: string = "AS_IDLE_TIME"; break;
case AS_SET_MOUSE_MODE: string = "AS_SET_MOUSE_MODE"; break;
case AS_GET_MOUSE_MODE: string = "AS_GET_MOUSE_MODE"; break;
case AS_GET_MOUSE: string = "AS_GET_MOUSE"; break;
case AS_SET_DECORATOR_SETTINGS: string = "AS_SET_DECORATOR_SETTINGS"; break;
case AS_GET_DECORATOR_SETTINGS: string = "AS_GET_DECORATOR_SETTINGS"; break;
case AS_GET_SHOW_ALL_DRAGGERS: string = "AS_GET_SHOW_ALL_DRAGGERS"; break;
case AS_SET_SHOW_ALL_DRAGGERS: string = "AS_SET_SHOW_ALL_DRAGGERS"; break;
CODE(AS_CURRENT_WORKSPACE);
CODE(AS_ACTIVATE_WORKSPACE);
CODE(AS_GET_SCROLLBAR_INFO);
CODE(AS_SET_SCROLLBAR_INFO);
CODE(AS_GET_MENU_INFO);
CODE(AS_SET_MENU_INFO);
CODE(AS_IDLE_TIME);
CODE(AS_SET_MOUSE_MODE);
CODE(AS_GET_MOUSE_MODE);
CODE(AS_SET_FOCUS_FOLLOWS_MOUSE_MODE);
CODE(AS_GET_FOCUS_FOLLOWS_MOUSE_MODE);
CODE(AS_SET_ACCEPT_FIRST_CLICK);
CODE(AS_GET_ACCEPT_FIRST_CLICK);
CODE(AS_GET_MOUSE);
CODE(AS_SET_DECORATOR_SETTINGS);
CODE(AS_GET_DECORATOR_SETTINGS);
CODE(AS_GET_SHOW_ALL_DRAGGERS);
CODE(AS_SET_SHOW_ALL_DRAGGERS);
// Subpixel antialiasing & hinting
case AS_SET_SUBPIXEL_ANTIALIASING: string = "AS_SET_SUBPIXEL_ANTIALIASING"; break;
case AS_GET_SUBPIXEL_ANTIALIASING: string = "AS_GET_SUBPIXEL_ANTIALIASING"; break;
case AS_SET_HINTING: string = "AS_SET_HINTING"; break;
case AS_GET_HINTING: string = "AS_GET_HINTING"; break;
case AS_SET_SUBPIXEL_AVERAGE_WEIGHT: string = "AS_SET_SUBPIXEL_AVERAGE_WEIGHT"; break;
case AS_GET_SUBPIXEL_AVERAGE_WEIGHT: string = "AS_GET_SUBPIXEL_AVERAGE_WEIGHT"; break;
case AS_SET_SUBPIXEL_ORDERING: string = "AS_SET_SUBPIXEL_ORDERING"; break;
case AS_GET_SUBPIXEL_ORDERING: string = "AS_GET_SUBPIXEL_ORDERING"; break;
CODE(AS_SET_SUBPIXEL_ANTIALIASING);
CODE(AS_GET_SUBPIXEL_ANTIALIASING);
CODE(AS_SET_HINTING);
CODE(AS_GET_HINTING);
CODE(AS_SET_SUBPIXEL_AVERAGE_WEIGHT);
CODE(AS_GET_SUBPIXEL_AVERAGE_WEIGHT);
CODE(AS_SET_SUBPIXEL_ORDERING);
CODE(AS_GET_SUBPIXEL_ORDERING);
// Graphics calls
case AS_SET_HIGH_COLOR: string = "AS_SET_HIGH_COLOR"; break;
case AS_SET_LOW_COLOR: string = "AS_SET_LOW_COLOR"; break;
case AS_SET_VIEW_COLOR: string = "AS_SET_VIEW_COLOR"; break;
CODE(AS_SET_HIGH_COLOR);
CODE(AS_SET_LOW_COLOR);
CODE(AS_SET_VIEW_COLOR);
case AS_STROKE_ARC: string = "AS_STROKE_ARC"; break;
case AS_STROKE_BEZIER: string = "AS_STROKE_BEZIER"; break;
case AS_STROKE_ELLIPSE: string = "AS_STROKE_ELLIPSE"; break;
case AS_STROKE_LINE: string = "AS_STROKE_LINE"; break;
case AS_STROKE_LINEARRAY: string = "AS_STROKE_LINEARRAY"; break;
case AS_STROKE_POLYGON: string = "AS_STROKE_POLYGON"; break;
case AS_STROKE_RECT: string = "AS_STROKE_RECT"; break;
case AS_STROKE_ROUNDRECT: string = "AS_STROKE_ROUNDRECT"; break;
case AS_STROKE_SHAPE: string = "AS_STROKE_SHAPE"; break;
case AS_STROKE_TRIANGLE: string = "AS_STROKE_TRIANGLE"; break;
CODE(AS_STROKE_ARC);
CODE(AS_STROKE_BEZIER);
CODE(AS_STROKE_ELLIPSE);
CODE(AS_STROKE_LINE);
CODE(AS_STROKE_LINEARRAY);
CODE(AS_STROKE_POLYGON);
CODE(AS_STROKE_RECT);
CODE(AS_STROKE_ROUNDRECT);
CODE(AS_STROKE_SHAPE);
CODE(AS_STROKE_TRIANGLE);
case AS_FILL_ARC: string = "AS_FILL_ARC"; break;
case AS_FILL_ARC_GRADIENT: string = "AS_FILL_ARC_GRADIENT"; break;
case AS_FILL_BEZIER: string = "AS_FILL_BEZIER"; break;
case AS_FILL_BEZIER_GRADIENT: string = "AS_FILL_BEZIER_GRADIENT"; break;
case AS_FILL_ELLIPSE: string = "AS_FILL_ELLIPSE"; break;
case AS_FILL_ELLIPSE_GRADIENT: string = "AS_FILL_ELLIPSE_GRADIENT"; break;
case AS_FILL_POLYGON: string = "AS_FILL_POLYGON"; break;
case AS_FILL_POLYGON_GRADIENT: string = "AS_FILL_POLYGON_GRADIENT"; break;
case AS_FILL_RECT: string = "AS_FILL_RECT"; break;
case AS_FILL_RECT_GRADIENT: string = "AS_FILL_RECT_GRADIENT"; break;
case AS_FILL_REGION: string = "AS_FILL_REGION"; break;
case AS_FILL_REGION_GRADIENT: string = "AS_FILL_REGION_GRADIENT"; break;
case AS_FILL_ROUNDRECT: string = "AS_FILL_ROUNDRECT"; break;
case AS_FILL_ROUNDRECT_GRADIENT: string = "AS_FILL_ROUNDRECT_GRADIENT"; break;
case AS_FILL_SHAPE: string = "AS_FILL_SHAPE"; break;
case AS_FILL_SHAPE_GRADIENT: string = "AS_FILL_SHAPE_GRADIENT"; break;
case AS_FILL_TRIANGLE: string = "AS_FILL_TRIANGLE"; break;
case AS_FILL_TRIANGLE_GRADIENT: string = "AS_FILL_TRIANGLE_GRADIENT"; break;
CODE(AS_FILL_ARC);
CODE(AS_FILL_ARC_GRADIENT);
CODE(AS_FILL_BEZIER);
CODE(AS_FILL_BEZIER_GRADIENT);
CODE(AS_FILL_ELLIPSE);
CODE(AS_FILL_ELLIPSE_GRADIENT);
CODE(AS_FILL_POLYGON);
CODE(AS_FILL_POLYGON_GRADIENT);
CODE(AS_FILL_RECT);
CODE(AS_FILL_RECT_GRADIENT);
CODE(AS_FILL_REGION);
CODE(AS_FILL_REGION_GRADIENT);
CODE(AS_FILL_ROUNDRECT);
CODE(AS_FILL_ROUNDRECT_GRADIENT);
CODE(AS_FILL_SHAPE);
CODE(AS_FILL_SHAPE_GRADIENT);
CODE(AS_FILL_TRIANGLE);
CODE(AS_FILL_TRIANGLE_GRADIENT);
case AS_DRAW_STRING: string = "AS_DRAW_STRING"; break;
case AS_DRAW_STRING_WITH_DELTA: string = "AS_DRAW_STRING_WITH_DELTA"; break;
CODE(AS_DRAW_STRING);
CODE(AS_DRAW_STRING_WITH_DELTA);
case AS_SYNC: string = "AS_SYNC"; break;
CODE(AS_SYNC);
case AS_VIEW_CREATE: string = "AS_VIEW_CREATE"; break;
case AS_VIEW_DELETE: string = "AS_VIEW_DELETE"; break;
case AS_VIEW_CREATE_ROOT: string = "AS_VIEW_CREATE_ROOT"; break;
case AS_VIEW_SHOW: string = "AS_VIEW_SHOW"; break;
case AS_VIEW_HIDE: string = "AS_VIEW_HIDE"; break;
case AS_VIEW_MOVE: string = "AS_VIEW_MOVE"; break;
case AS_VIEW_RESIZE: string = "AS_VIEW_RESIZE"; break;
case AS_VIEW_DRAW: string = "AS_VIEW_DRAW"; break;
CODE(AS_VIEW_CREATE);
CODE(AS_VIEW_DELETE);
CODE(AS_VIEW_CREATE_ROOT);
CODE(AS_VIEW_SHOW);
CODE(AS_VIEW_HIDE);
CODE(AS_VIEW_MOVE);
CODE(AS_VIEW_RESIZE);
CODE(AS_VIEW_DRAW);
// View definitions
case AS_VIEW_GET_COORD: string = "AS_VIEW_GET_COORD"; break;
case AS_VIEW_SET_FLAGS: string = "AS_VIEW_SET_FLAGS"; break;
case AS_VIEW_SET_ORIGIN: string = "AS_VIEW_SET_ORIGIN"; break;
case AS_VIEW_GET_ORIGIN: string = "AS_VIEW_GET_ORIGIN"; break;
case AS_VIEW_RESIZE_MODE: string = "AS_VIEW_RESIZE_MODE"; break;
case AS_VIEW_BEGIN_RECT_TRACK: string = "AS_VIEW_BEGIN_RECT_TRACK"; break;
case AS_VIEW_END_RECT_TRACK: string = "AS_VIEW_END_RECT_TRACK"; break;
case AS_VIEW_DRAG_RECT: string = "AS_VIEW_DRAG_RECT"; break;
case AS_VIEW_DRAG_IMAGE: string = "AS_VIEW_DRAG_IMAGE"; break;
case AS_VIEW_SCROLL: string = "AS_VIEW_SCROLL"; break;
case AS_VIEW_SET_LINE_MODE: string = "AS_VIEW_SET_LINE_MODE"; break;
case AS_VIEW_GET_LINE_MODE: string = "AS_VIEW_GET_LINE_MODE"; break;
case AS_VIEW_PUSH_STATE: string = "AS_VIEW_PUSH_STATE"; break;
case AS_VIEW_POP_STATE: string = "AS_VIEW_POP_STATE"; break;
case AS_VIEW_SET_SCALE: string = "AS_VIEW_SET_SCALE"; break;
case AS_VIEW_GET_SCALE: string = "AS_VIEW_GET_SCALE"; break;
case AS_VIEW_SET_DRAWING_MODE: string = "AS_VIEW_SET_DRAWING_MODE"; break;
case AS_VIEW_GET_DRAWING_MODE: string = "AS_VIEW_GET_DRAWING_MODE"; break;
case AS_VIEW_SET_BLENDING_MODE: string = "AS_VIEW_SET_BLENDING_MODE"; break;
case AS_VIEW_GET_BLENDING_MODE: string = "AS_VIEW_GET_BLENDING_MODE"; break;
case AS_VIEW_SET_PEN_LOC: string = "AS_VIEW_SET_PEN_LOC"; break;
case AS_VIEW_GET_PEN_LOC: string = "AS_VIEW_GET_PEN_LOC"; break;
case AS_VIEW_SET_PEN_SIZE: string = "AS_VIEW_SET_PEN_SIZE"; break;
case AS_VIEW_GET_PEN_SIZE: string = "AS_VIEW_GET_PEN_SIZE"; break;
case AS_VIEW_SET_HIGH_COLOR: string = "AS_VIEW_SET_HIGH_COLOR"; break;
case AS_VIEW_SET_LOW_COLOR: string = "AS_VIEW_SET_LOW_COLOR"; break;
case AS_VIEW_SET_VIEW_COLOR: string = "AS_VIEW_SET_VIEW_COLOR"; break;
case AS_VIEW_GET_HIGH_COLOR: string = "AS_VIEW_GET_HIGH_COLOR"; break;
case AS_VIEW_GET_LOW_COLOR: string = "AS_VIEW_GET_LOW_COLOR"; break;
case AS_VIEW_GET_VIEW_COLOR: string = "AS_VIEW_GET_VIEW_COLOR"; break;
case AS_VIEW_PRINT_ALIASING: string = "AS_VIEW_PRINT_ALIASING"; break;
case AS_VIEW_CLIP_TO_PICTURE: string = "AS_VIEW_CLIP_TO_PICTURE"; break;
case AS_VIEW_GET_CLIP_REGION: string = "AS_VIEW_GET_CLIP_REGION"; break;
case AS_VIEW_DRAW_BITMAP: string = "AS_VIEW_DRAW_BITMAP"; break;
case AS_VIEW_SET_EVENT_MASK: string = "AS_VIEW_SET_EVENT_MASK"; break;
case AS_VIEW_SET_MOUSE_EVENT_MASK: string = "AS_VIEW_SET_MOUSE_EVENT_MASK"; break;
CODE(AS_VIEW_GET_COORD);
CODE(AS_VIEW_SET_FLAGS);
CODE(AS_VIEW_SET_ORIGIN);
CODE(AS_VIEW_GET_ORIGIN);
CODE(AS_VIEW_RESIZE_MODE);
CODE(AS_VIEW_BEGIN_RECT_TRACK);
CODE(AS_VIEW_END_RECT_TRACK);
CODE(AS_VIEW_DRAG_RECT);
CODE(AS_VIEW_DRAG_IMAGE);
CODE(AS_VIEW_SCROLL);
CODE(AS_VIEW_SET_LINE_MODE);
CODE(AS_VIEW_GET_LINE_MODE);
CODE(AS_VIEW_PUSH_STATE);
CODE(AS_VIEW_POP_STATE);
CODE(AS_VIEW_SET_SCALE);
CODE(AS_VIEW_GET_SCALE);
CODE(AS_VIEW_SET_DRAWING_MODE);
CODE(AS_VIEW_GET_DRAWING_MODE);
CODE(AS_VIEW_SET_BLENDING_MODE);
CODE(AS_VIEW_GET_BLENDING_MODE);
CODE(AS_VIEW_SET_PEN_LOC);
CODE(AS_VIEW_GET_PEN_LOC);
CODE(AS_VIEW_SET_PEN_SIZE);
CODE(AS_VIEW_GET_PEN_SIZE);
CODE(AS_VIEW_SET_HIGH_COLOR);
CODE(AS_VIEW_SET_LOW_COLOR);
CODE(AS_VIEW_SET_VIEW_COLOR);
CODE(AS_VIEW_GET_HIGH_COLOR);
CODE(AS_VIEW_GET_LOW_COLOR);
CODE(AS_VIEW_GET_VIEW_COLOR);
CODE(AS_VIEW_PRINT_ALIASING);
CODE(AS_VIEW_CLIP_TO_PICTURE);
CODE(AS_VIEW_GET_CLIP_REGION);
CODE(AS_VIEW_DRAW_BITMAP);
CODE(AS_VIEW_SET_EVENT_MASK);
CODE(AS_VIEW_SET_MOUSE_EVENT_MASK);
case AS_VIEW_DRAW_STRING: string = "AS_VIEW_DRAW_STRING"; break;
case AS_VIEW_SET_CLIP_REGION: string = "AS_VIEW_SET_CLIP_REGION"; break;
case AS_VIEW_LINE_ARRAY: string = "AS_VIEW_LINE_ARRAY"; break;
case AS_VIEW_BEGIN_PICTURE: string = "AS_VIEW_BEGIN_PICTURE"; break;
case AS_VIEW_APPEND_TO_PICTURE: string = "AS_VIEW_APPEND_TO_PICTURE"; break;
case AS_VIEW_END_PICTURE: string = "AS_VIEW_END_PICTURE"; break;
case AS_VIEW_COPY_BITS: string = "AS_VIEW_COPY_BITS"; break;
case AS_VIEW_DRAW_PICTURE: string = "AS_VIEW_DRAW_PICTURE"; break;
case AS_VIEW_INVALIDATE_RECT: string = "AS_VIEW_INVALIDATE_RECT"; break;
case AS_VIEW_INVALIDATE_REGION: string = "AS_VIEW_INVALIDATE_REGION"; break;
case AS_VIEW_INVERT_RECT: string = "AS_VIEW_INVERT_RECT"; break;
case AS_VIEW_MOVE_TO: string = "AS_VIEW_MOVE_TO"; break;
case AS_VIEW_RESIZE_TO: string = "AS_VIEW_RESIZE_TO"; break;
case AS_VIEW_SET_STATE: string = "AS_VIEW_SET_STATE"; break;
case AS_VIEW_SET_FONT_STATE: string = "AS_VIEW_SET_FONT_STATE"; break;
case AS_VIEW_GET_STATE: string = "AS_VIEW_GET_STATE"; break;
case AS_VIEW_SET_VIEW_BITMAP: string = "AS_VIEW_SET_VIEW_BITMAP"; break;
case AS_VIEW_SET_PATTERN: string = "AS_VIEW_SET_PATTERN"; break;
case AS_SET_CURRENT_VIEW: string = "AS_SET_CURRENT_VIEW"; break;
CODE(AS_VIEW_DRAW_STRING);
CODE(AS_VIEW_SET_CLIP_REGION);
CODE(AS_VIEW_LINE_ARRAY);
CODE(AS_VIEW_BEGIN_PICTURE);
CODE(AS_VIEW_APPEND_TO_PICTURE);
CODE(AS_VIEW_END_PICTURE);
CODE(AS_VIEW_COPY_BITS);
CODE(AS_VIEW_DRAW_PICTURE);
CODE(AS_VIEW_INVALIDATE_RECT);
CODE(AS_VIEW_INVALIDATE_REGION);
CODE(AS_VIEW_INVERT_RECT);
CODE(AS_VIEW_MOVE_TO);
CODE(AS_VIEW_RESIZE_TO);
CODE(AS_VIEW_SET_STATE);
CODE(AS_VIEW_SET_FONT_STATE);
CODE(AS_VIEW_GET_STATE);
CODE(AS_VIEW_SET_VIEW_BITMAP);
CODE(AS_VIEW_SET_PATTERN);
CODE(AS_SET_CURRENT_VIEW);
// BDirectWindow codes
case AS_DIRECT_WINDOW_GET_SYNC_DATA: string = "AS_DIRECT_WINDOW_GET_SYNC_DATA"; break;
case AS_DIRECT_WINDOW_SET_FULLSCREEN: string = "AS_DIRECT_WINDOW_SET_FULLSCREEN"; break;
CODE(AS_DIRECT_WINDOW_GET_SYNC_DATA);
CODE(AS_DIRECT_WINDOW_SET_FULLSCREEN);
default:
string << "unkown code: " << code;

View File

@ -379,8 +379,8 @@ ServerApp::_MessageLooper()
case AS_QUIT_APP:
{
// This message is received only when the app_server is asked to
// shut down in test/debug mode. Of course, if we are testing
// This message is received only when the app_server is asked
// to shut down in test/debug mode. Of course, if we are testing
// while using AccelerantDriver, we do NOT want to shut down
// client applications. The server can be quit in this fashion
// through the driver's interface, such as closing the
@ -1159,10 +1159,10 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_SET_MOUSE_MODE:
{
STRACE(("ServerApp %s: Set Focus Follows Mouse mode\n",
STRACE(("ServerApp %s: Set Mouse Focus mode\n",
Signature()));
// Attached Data:
// 1) enum mode_mouse FFM mouse mode
// 1) enum mode_mouse mouse focus mode
mode_mouse mouseMode;
if (link.Read<mode_mouse>(&mouseMode) == B_OK) {
LockedDesktopSettings settings(fDesktop);
@ -1172,7 +1172,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
}
case AS_GET_MOUSE_MODE:
{
STRACE(("ServerApp %s: Get Focus Follows Mouse mode\n",
STRACE(("ServerApp %s: Get Mouse Focus mode\n",
Signature()));
if (fDesktop->LockSingleWindow()) {
@ -1188,6 +1188,65 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
fLink.Flush();
break;
}
case AS_SET_FOCUS_FOLLOWS_MOUSE_MODE:
{
STRACE(("ServerApp %s: Set Focus Follows Mouse mode\n", Signature()));
// Attached Data:
// 1) enum mode_focus_follows_mouse FFM mouse mode
mode_focus_follows_mouse focusFollowsMousMode;
if (link.Read<mode_focus_follows_mouse>(&focusFollowsMousMode) == B_OK) {
LockedDesktopSettings settings(fDesktop);
settings.SetFocusFollowsMouseMode(focusFollowsMousMode);
}
break;
}
case AS_GET_FOCUS_FOLLOWS_MOUSE_MODE:
{
STRACE(("ServerApp %s: Get Focus Follows Mouse mode\n", Signature()));
if (fDesktop->LockSingleWindow()) {
DesktopSettings settings(fDesktop);
fLink.StartMessage(B_OK);
fLink.Attach<mode_focus_follows_mouse>(
settings.FocusFollowsMouseMode());
fDesktop->UnlockSingleWindow();
} else
fLink.StartMessage(B_ERROR);
fLink.Flush();
break;
}
case AS_SET_ACCEPT_FIRST_CLICK:
{
STRACE(("ServerApp %s: Set Accept First Click\n", Signature()));
// Attached Data:
// 1) bool accept_first_click
bool acceptFirstClick;
if (link.Read<bool>(&acceptFirstClick) == B_OK) {
LockedDesktopSettings settings(fDesktop);
settings.SetAcceptFirstClick(acceptFirstClick);
}
break;
}
case AS_GET_ACCEPT_FIRST_CLICK:
{
STRACE(("ServerApp %s: Get Accept First Click\n", Signature()));
if (fDesktop->LockSingleWindow()) {
DesktopSettings settings(fDesktop);
fLink.StartMessage(B_OK);
fLink.Attach<bool>(settings.AcceptFirstClick());
fDesktop->UnlockSingleWindow();
} else
fLink.StartMessage(B_ERROR);
fLink.Flush();
break;
}
case AS_GET_SHOW_ALL_DRAGGERS:
{

View File

@ -7,9 +7,10 @@
* Adrian Oanca <adioanca@gmail.com>
* Stephan Aßmus <superstippi@gmx.de>
* Stefano Ceccherini <stefano.ceccherini@gmail.com>
* Axel Dörfler, axeld@pinc-software.de
* Axel Dörfler <axeld@pinc-software.de>
* Artur Wyszynski <harakash@gmail.com>
* Philippe Saint-Pierre, stpere@gmail.com
* Philippe Saint-Pierre <stpere@gmail.com>
* Brecht Machiels <brecht@mos6581.org>
*/
@ -648,7 +649,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
fDesktop->UnlockSingleWindow();
if (activate)
fDesktop->ActivateWindow(fWindow);
fDesktop->SelectWindow(fWindow);
else
fDesktop->SendWindowBehind(fWindow, NULL);

View File

@ -6,7 +6,8 @@
* DarkWyrm <bpmagic@columbus.rr.com>
* Adi Oanca <adioanca@gmail.com>
* Stephan Aßmus <superstippi@gmx.de>
* Axel Dörfler, axeld@pinc-software.de
* Axel Dörfler <axeld@pinc-software.de>
* Brecht Machiels <brecht@mos6581.org>
*/
@ -774,6 +775,8 @@ static const bigtime_t kWindowActivationTimeout = 500000LL;
void
Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
{
DesktopSettings desktopSettings(fDesktop);
// TODO: move into Decorator
if (!fBorderRegionValid)
GetBorderRegion(&fBorderRegion);
@ -800,11 +803,13 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
action = DEC_DRAG;
}
// ignore clicks on decorator buttons if the
// non-floating window doesn't have focus
if (!IsFocus() && !IsFloating() && action != DEC_MOVETOBACK
&& action != DEC_RESIZE && action != DEC_SLIDETAB)
action = DEC_DRAG;
if (!desktopSettings.AcceptFirstClick()) {
// ignore clicks on decorator buttons if the
// non-floating window doesn't have focus
if (!IsFocus() && !IsFloating() && action != DEC_MOVETOBACK
&& action != DEC_RESIZE && action != DEC_SLIDETAB)
action = DEC_DRAG;
}
// set decorator internals
switch (action) {
@ -869,20 +874,30 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
}
if (action == DEC_MOVETOBACK) {
fDesktop->SendWindowBehind(this);
if (desktopSettings.MouseMode() == B_CLICK_TO_FOCUS_MOUSE) {
bool covered = true;
BRegion fullRegion;
GetFullRegion(&fullRegion);
if (fullRegion == VisibleRegion()) {
// window is overlapped.
covered = false;
}
if (this != fDesktop->FrontWindow() && covered)
fDesktop->ActivateWindow(this);
else
fDesktop->SendWindowBehind(this);
} else
fDesktop->SendWindowBehind(this);
} else {
fDesktop->SetMouseEventWindow(this);
// activate window if not in FFM mode
DesktopSettings desktopSettings(fDesktop);
if (!desktopSettings.FocusFollowsMouse()) {
// activate window if in click to activate mode, else only focus it
if (desktopSettings.MouseMode() == B_NORMAL_MOUSE)
fDesktop->ActivateWindow(this);
} else {
// actually, the window should already be
// focused since the mouse would have to
// be over it, but just for completeness...
else {
fDesktop->SetFocusWindow(this);
if (action == DEC_DRAG) {
if (desktopSettings.MouseMode() == B_FOCUS_FOLLOWS_MOUSE
&& action == DEC_DRAG) {
fActivateOnMouseUp = true;
fMouseMoveDistance = 0.0f;
fLastMoveTime = system_time();
@ -897,13 +912,17 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
// clicking a simple View
if (!IsFocus()) {
DesktopSettings desktopSettings(fDesktop);
bool acceptFirstClick = desktopSettings.AcceptFirstClick()
|| ((Flags() & B_WILL_ACCEPT_FIRST_CLICK) != 0);
bool avoidFocus = (Flags() & B_AVOID_FOCUS) != 0;
// Activate window in case it doesn't accept first click, and
// we're not in FFM mode
if ((Flags() & B_WILL_ACCEPT_FIRST_CLICK) == 0
&& !desktopSettings.FocusFollowsMouse())
// Activate or focus the window in case it doesn't accept first
// click, depending on the mouse mode
if (desktopSettings.MouseMode() == B_NORMAL_MOUSE
&& !acceptFirstClick)
fDesktop->ActivateWindow(this);
else if (!avoidFocus)
fDesktop->SetFocusWindow(this);
// Eat the click if we don't accept first click
// (B_AVOID_FOCUS never gets the focus, so they always accept
@ -911,8 +930,7 @@ Window::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
// TODO: the latter is unlike BeOS - if we really wanted to
// imitate this behaviour, we would need to check if we're
// the front window instead of the focus window
if ((Flags() & (B_WILL_ACCEPT_FIRST_CLICK
| B_AVOID_FOCUS)) == 0)
if (!acceptFirstClick && !avoidFocus)
return;
}
@ -968,6 +986,18 @@ Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
engine->UnlockParallelAccess();
fRegionPool.Recycle(visibleBorder);
int32 buttons;
if (message->FindInt32("buttons", &buttons) != B_OK)
buttons = 0;
// if the primary mouse button is released, stop
// dragging/resizing/sliding
if ((buttons & B_PRIMARY_MOUSE_BUTTON) == 0) {
fIsDragging = false;
fIsResizing = false;
fIsSlidingTab = false;
}
}
// in FFM mode, activate the window and bring it
@ -981,10 +1011,6 @@ Window::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
fDesktop->ActivateWindow(this);
}
fIsDragging = false;
fIsResizing = false;
fIsSlidingTab = false;
if (View* view = ViewAt(where)) {
if (HasModal())
return;

View File

@ -6,7 +6,8 @@
* DarkWyrm <bpmagic@columbus.rr.com>
* Adi Oanca <adioanca@gmail.com>
* Stephan Aßmus <superstippi@gmx.de>
* Axel Dörfler, axeld@pinc-software.de
* Axel Dörfler <axeld@pinc-software.de>
* Brecht Machiels <brecht@mos6581.org>
*/
#ifndef WINDOW_H
#define WINDOW_H

View File

@ -15,19 +15,23 @@
//
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
#include "MouseSettings.h"
#include <stdio.h>
#include <FindDirectory.h>
#include <File.h>
#include <Path.h>
#include <View.h>
#include <stdio.h>
#include "MouseSettings.h"
static const bigtime_t kDefaultClickSpeed = 500000;
static const int32 kDefaultMouseSpeed = 65536;
static const int32 kDefaultMouseType = 3; // 3 button mouse
static const int32 kDefaultAccelerationFactor = 65536;
static const bool kDefaultAcceptFirstClick = false;
MouseSettings::MouseSettings()
@ -41,6 +45,8 @@ MouseSettings::MouseSettings()
fOriginalSettings = fSettings;
fOriginalMode = fMode;
fOriginalFocusFollowsMouseMode = fFocusFollowsMouseMode;
fOriginalAcceptFirstClick = fAcceptFirstClick;
}
@ -68,6 +74,7 @@ MouseSettings::RetrieveSettings()
// retrieve current values
fMode = mouse_mode();
fAcceptFirstClick = accept_first_click();
Defaults();
// also try to load the window position from disk
@ -85,12 +92,16 @@ MouseSettings::RetrieveSettings()
if ((file.Read(&fSettings.type, sizeof(int32)) != sizeof(int32))
|| (file.Read(&fSettings.map, sizeof(int32) * 3) != sizeof(int32) * 3)
|| (file.Read(&fSettings.accel, sizeof(mouse_accel)) != sizeof(mouse_accel))
|| (file.Read(&fSettings.click_speed, sizeof(bigtime_t)) != sizeof(bigtime_t))) {
|| (file.Read(&fSettings.accel, sizeof(mouse_accel))
!= sizeof(mouse_accel))
|| (file.Read(&fSettings.click_speed, sizeof(bigtime_t))
.282
!= sizeof(bigtime_t))) {
Defaults();
}
#else
if (file.ReadAt(0, &fSettings, sizeof(mouse_settings)) != sizeof(mouse_settings)) {
if (file.ReadAt(0, &fSettings, sizeof(mouse_settings))
!= sizeof(mouse_settings)) {
Defaults();
}
#endif
@ -128,7 +139,7 @@ MouseSettings::SaveSettings()
file.Write(&fSettings, sizeof(fSettings));
#endif
// who is responsible for saving the mouse mode?
// who is responsible for saving the mouse mode and accept_first_click?
return B_OK;
}
@ -139,28 +150,44 @@ void
MouseSettings::Dump()
{
printf("type:\t\t%ld button mouse\n", fSettings.type);
printf("map:\t\tleft = %lu : middle = %lu : right = %lu\n", fSettings.map.button[0], fSettings.map.button[2], fSettings.map.button[1]);
printf("map:\t\tleft = %lu : middle = %lu : right = %lu\n",
fSettings.map.button[0], fSettings.map.button[2],
fSettings.map.button[1]);
printf("click speed:\t%Ld\n", fSettings.click_speed);
printf("accel:\t\t%s\n", fSettings.accel.enabled ? "enabled" : "disabled");
printf("accel:\t\t%s\n", fSettings.accel.enabled
? "enabled" : "disabled");
printf("accel factor:\t%ld\n", fSettings.accel.accel_factor);
printf("speed:\t\t%ld\n", fSettings.accel.speed);
char *mode = "unknown";
switch (fMode) {
case B_NORMAL_MOUSE:
mode = "normal";
mode = "activate";
break;
case B_CLICK_TO_FOCUS_MOUSE:
mode = "focus";
break;
case B_FOCUS_FOLLOWS_MOUSE:
mode = "focus follows mouse";
break;
case B_WARP_MOUSE:
mode = "warp mouse";
break;
case B_INSTANT_WARP_MOUSE:
mode = "instant warp mouse";
mode = "auto-focus";
break;
}
printf("mode:\t\t%s\n", mode);
printf("mouse mode:\t%s\n", mode);
char *focus_follows_mouse_mode = "unknown";
switch (fMode) {
case B_NORMAL_FOCUS_FOLLOWS_MOUSE:
focus_follows_mouse_mode = "normal";
break;
case B_WARP_FOCUS_FOLLOWS_MOUSE:
focus_follows_mouse_mode = "warp";
break;
case B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE:
focus_follows_mouse_mode = "instant warp";
break;
}
printf("focus follows mouse mode:\t%s\n", focus_follows_mouse_mode);
printf("accept first click:\t%s\n", fAcceptFirstClick
? "enabled" : "disabled");
}
#endif
@ -176,6 +203,8 @@ MouseSettings::Defaults()
SetMouseType(kDefaultMouseType);
SetAccelerationFactor(kDefaultAccelerationFactor);
SetMouseMode(B_NORMAL_MOUSE);
SetFocusFollowsMouseMode(B_NORMAL_FOCUS_FOLLOWS_MOUSE);
SetAcceptFirstClick(kDefaultAcceptFirstClick);
fSettings.map.button[0] = B_PRIMARY_MOUSE_BUTTON;
fSettings.map.button[1] = B_SECONDARY_MOUSE_BUTTON;
@ -253,3 +282,18 @@ MouseSettings::SetMouseMode(mode_mouse mode)
fMode = mode;
}
void
MouseSettings::SetFocusFollowsMouseMode(mode_focus_follows_mouse mode)
{
fFocusFollowsMouseMode = mode;
}
void
MouseSettings::SetAcceptFirstClick(bool acceptFirstClick)
{
fAcceptFirstClick = acceptFirstClick;
}

View File

@ -18,9 +18,10 @@
#ifndef MOUSE_SETTINGS_H_
#define MOUSE_SETTINGS_H_
#include <SupportDefs.h>
#include <InterfaceDefs.h>
#include <kb_mouse_settings.h>
#include <Path.h>
#include <SupportDefs.h>
class MouseSettings {
@ -40,7 +41,8 @@ class MouseSettings {
int32 MouseSpeed() const { return fSettings.accel.speed; }
void SetMouseSpeed(int32 speed);
int32 AccelerationFactor() const { return fSettings.accel.accel_factor; }
int32 AccelerationFactor() const
{ return fSettings.accel.accel_factor; }
void SetAccelerationFactor(int32 factor);
uint32 Mapping(int32 index) const;
@ -51,6 +53,13 @@ class MouseSettings {
mode_mouse MouseMode() const { return fMode; }
void SetMouseMode(mode_mouse mode);
mode_focus_follows_mouse FocusFollowsMouseMode() const
{ return fFocusFollowsMouseMode; }
void SetFocusFollowsMouseMode(mode_focus_follows_mouse mode);
bool AcceptFirstClick() const { return fAcceptFirstClick; }
void SetAcceptFirstClick(bool acceptFirstClick);
status_t SaveSettings();
private:
@ -59,6 +68,10 @@ class MouseSettings {
mouse_settings fSettings, fOriginalSettings;
mode_mouse fMode, fOriginalMode;
mode_focus_follows_mouse fFocusFollowsMouseMode;
mode_focus_follows_mouse fOriginalFocusFollowsMouseMode;
bool fAcceptFirstClick;
bool fOriginalAcceptFirstClick;
};
#endif