Merge branch 'master' of ssh://git.haiku-os.org/haiku

This commit is contained in:
Humdinger
2012-04-18 15:16:29 +02:00
27 changed files with 285 additions and 239 deletions
@@ -75,6 +75,8 @@
#define CP_QUEUE_THRESHOLDS 0x8760
#define ROQ_IB1_START(x) ((x) << 0)
#define ROQ_IB2_START(x) ((x) << 8)
#define CP_DEBUG 0xC1FC
#define CP_RB_BASE 0xC100
#define CP_RB_CNTL 0xC104
#define RB_BUFSZ(x) ((x) << 0)
#define RB_BLKSZ(x) ((x) << 8)
+121 -1
View File
@@ -531,7 +531,127 @@ radeon_gpu_ring_boot(uint32 ringType)
return B_ERROR;
}
// TODO: Write initial ring state
// We don't execute this code until it's more complete.
ERROR("%s: TODO\n", __func__);
return B_OK;
// TODO: Write initial ring PACKET3 STATE
// *** r600_cp_init_ring_buffer
// Reset command processor
Write32(OUT, GRBM_SOFT_RESET, RADEON_SOFT_RESET_CP);
Read32(OUT, GRBM_SOFT_RESET);
snooze(15000);
Write32(OUT, GRBM_SOFT_RESET, 0);
// Set ring buffer size
uint32 controlScratch = RB_NO_UPDATE
| (compute_order(4096 / 8) << 8) // rptr_update_l2qw
| compute_order(ring->GetSize() / 8); // size_l2qw
#ifdef __BIG_ENDIAN
controlScratch |= BUF_SWAP_32BIT;
#endif
Write32(OUT, CP_RB_CNTL, controlScratch);
// Set delays and timeouts
Write32(OUT, CP_SEM_WAIT_TIMER, 0);
Write32(OUT, CP_RB_WPTR_DELAY, 0);
// Enable RenderBuffer Reads
controlScratch |= RB_RPTR_WR_ENA;
Write32(OUT, CP_RB_CNTL, controlScratch);
// Zero out command processor read and write pointers
Write32(OUT, CP_RB_RPTR_WR, 0);
Write32(OUT, CP_RB_WPTR, 0);
#if 0
int ringPointer = 0;
// TODO: AGP cards
/*
if (RADEON_IS_AGP) {
ringPointer = dev_priv->ring_rptr->offset
- dev->agp->base
+ dev_priv->gart_vm_start;
} else {
*/
ringPointer = dev_priv->ring_rptr->offset
- ((unsigned long) dev->sg->virtual)
+ dev_priv->gart_vm_start;
Write32(OUT, CP_RB_RPTR_ADDR, (ringPointer & 0xfffffffc));
Write32(OUT, CP_RB_RPTR_ADDR_HI, upper_32_bits(ringPointer));
// Drop RPTR_WR_ENA and update CP RB Control
controlScratch &= ~R600_RB_RPTR_WR_ENA;
Write32(OUT, CP_RB_CNTL, controlScratch);
#endif
#if 0
// Update command processor pointer
int commandPointer = 0;
// TODO: AGP cards
/*
if (RADEON_IS_AGP) {
commandPointer = (dev_priv->cp_ring->offset
- dev->agp->base
+ dev_priv->gart_vm_start);
}
*/
commandPointer = (dev_priv->cp_ring->offset
- (unsigned long)dev->sg->virtual
+ dev_priv->gart_vm_start);
#endif
#if 0
Write32(OUT, CP_RB_BASE, commandPointer >> 8);
Write32(OUT, CP_ME_CNTL, 0xff);
Write32(OUT, CP_DEBUG, (1 << 27) | (1 << 28));
#endif
#if 0
// Initialize scratch register pointer.
// This wil lcause the scratch register values to be wtitten
// to memory whenever they are updated.
uint64 scratchAddr = Read32(OUT, CP_RB_RPTR_ADDR) & 0xFFFFFFFC;
scratchAddr |= ((uint64)Read32(OUT, CP_RB_RPTR_ADDR_HI)) << 32;
scratchAddr += R600_SCRATCH_REG_OFFSET;
scratchAddr >>= 8;
scratchAddr &= 0xffffffff;
Write32(OUT, R600_SCRATCH_ADDR, (uint32)scratchAddr);
Write32(OUT, R600_SCRATCH_UMSK, 0x7);
#endif
#if 0
// Enable bus mastering
radeon_enable_bm(dev_priv);
radeon_write_ring_rptr(dev_priv, R600_SCRATCHOFF(0), 0);
Write32(OUT, R600_LAST_FRAME_REG, 0);
radeon_write_ring_rptr(dev_priv, R600_SCRATCHOFF(1), 0);
Write32(OUT, R600_LAST_DISPATCH_REG, 0);
radeon_write_ring_rptr(dev_priv, R600_SCRATCHOFF(2), 0);
Write32(OUT, R600_LAST_CLEAR_REG, 0);
#endif
// Reset sarea?
#if 0
master_priv = file_priv->master->driver_priv;
if (master_priv->sarea_priv) {
master_priv->sarea_priv->last_frame = 0;
master_priv->sarea_priv->last_dispatch = 0;
master_priv->sarea_priv->last_clear = 0;
}
r600_do_wait_for_idle(dev_priv);
#endif
return B_OK;
}
@@ -31,7 +31,7 @@ static const char* queueName[RADEON_QUEUE_MAX] = {
};
static int
int
compute_order(unsigned long size)
{
int order;
@@ -11,15 +11,20 @@
#include "Accelerant.h"
#include <stdint.h>
#define RADEON_QUEUE_MAX 3
// Basic r100+ graphic data ring
// Basic r100+ graphic data ring
#define RADEON_QUEUE_TYPE_GFX_INDEX 0
// Cayman+ have two compute command processor rings
#define CAYMAN_QUEUE_TYPE_CP1_INDEX 1
#define CAYMAN_QUEUE_TYPE_CP2_INDEX 2
int compute_order(unsigned long size);
// A basic ring buffer for passing render data into card.
// Data flows from the host to the GPU
class RingQueue {
@@ -33,6 +38,8 @@ public:
size_t GetSize() {return fSize;};
size_t GetWriteAvail() {return fWriteBytesAvail;}
size_t GetReadAvail() {return fSize - fWriteBytesAvail;}
intptr_t GetLocation() {return (intptr_t)fData;}
private:
uint32 fQueueType;
+1 -1
View File
@@ -47,6 +47,6 @@ UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mesa x86 ] ;
AddResources Legacy\ Software\ Rasterizer : MesaSoftwareRenderer.rdef ;
Addon Legacy\ Software\ Rasterizer :
MesaSoftwareRenderer.cpp :
MesaSoftwareRenderer.cpp
: libGL.so be $(TARGET_LIBSUPC++)
;
+4 -9
View File
@@ -207,7 +207,6 @@ TBarApp::SaveSettings()
storedSettings.AddBool("showTime", fSettings.showTime);
storedSettings.AddBool("showSeconds", fSettings.showSeconds);
storedSettings.AddBool("showDayOfWeek", fSettings.showDayOfWeek);
storedSettings.AddBool("showTimeZone", fSettings.showTimeZone);
storedSettings.AddPoint("switcherLoc", fSettings.switcherLoc);
storedSettings.AddInt32("recentAppsCount", fSettings.recentAppsCount);
@@ -248,7 +247,6 @@ TBarApp::InitSettings()
settings.showTime = true;
settings.showSeconds = false;
settings.showDayOfWeek = false;
settings.showTimeZone = false;
settings.state = kExpandoState;
settings.width = 0;
settings.switcherLoc = BPoint(5000, 5000);
@@ -315,10 +313,6 @@ TBarApp::InitSettings()
!= B_OK) {
settings.showDayOfWeek = false;
}
if (storedSettings.FindBool("showTimeZone", &settings.showTimeZone)
!= B_OK) {
settings.showTimeZone = false;
}
if (storedSettings.FindPoint("switcherLoc", &settings.switcherLoc)
!= B_OK) {
settings.switcherLoc = BPoint(5000, 5000);
@@ -640,10 +634,11 @@ TBarApp::MessageReceived(BMessage* message)
if (message->FindBool("filesys", &localize) == B_OK)
gLocalizedNamePreferred = localize;
BMessenger(fBarWindow->FindView("_deskbar_tv_")).SendMessage(
BMessenger(fBarWindow->FindView("_deskbar_rt_")).SendMessage(
message);
// Notify the TimeView that the format has changed and it should
// recompute its size
// Notify the replicant tray that the time interval has
// changed and it should update the time view and reflow
// the tray icons.
break;
}
-1
View File
@@ -78,7 +78,6 @@ struct desk_settings {
bool showTime;
bool showSeconds;
bool showDayOfWeek;
bool showTimeZone;
uint32 state;
float width;
BPoint switcherLoc;
-2
View File
@@ -399,10 +399,8 @@ TDeskbarMenu::ResetTargets()
break;
case kShowHideTime:
case kTimeIntervalChanged:
case kShowSeconds:
case kShowDayOfWeek:
case kShowTimeZone:
item->SetTarget(fBarView->fReplicantTray);
break;
}
+9 -52
View File
@@ -16,6 +16,7 @@
#include <Button.h>
#include <Catalog.h>
#include <CheckBox.h>
#include <ControlLook.h>
#include <FormattingConventions.h>
#include <GroupLayout.h>
#include <Locale.h>
@@ -33,9 +34,14 @@
#include "StatusView.h"
static const float kIndentSpacing
= be_control_look->DefaultItemSpacing() * 2.3;
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "PreferencesWindow"
PreferencesWindow::PreferencesWindow(BRect frame)
:
BWindow(frame, B_TRANSLATE("Deskbar preferences"), B_TITLED_WINDOW,
@@ -86,22 +92,10 @@ PreferencesWindow::PreferencesWindow(BRect frame)
new BMessage(kAutoHide));
// Clock controls
BMessage* timeInterval12HoursMessage = new BMessage(kTimeIntervalChanged);
timeInterval12HoursMessage->AddBool("use24HourClock", false);
fTimeInterval12HourRadioButton = new BRadioButton("time inteval",
B_TRANSLATE("12 hour"), timeInterval12HoursMessage);
BMessage* timeInterval24HoursMessage = new BMessage(kTimeIntervalChanged);
timeInterval24HoursMessage->AddBool("use24HourClock", true);
fTimeInterval24HourRadioButton = new BRadioButton("time inteval",
B_TRANSLATE("24 hour"), timeInterval24HoursMessage);
fShowSeconds = new BCheckBox(B_TRANSLATE("Show seconds"),
new BMessage(kShowSeconds));
fShowDayOfWeek = new BCheckBox(B_TRANSLATE("Show day of week"),
new BMessage(kShowDayOfWeek));
fShowTimeZone = new BCheckBox(B_TRANSLATE("Show time zone"),
new BMessage(kShowTimeZone));
// Get settings from BarApp
TBarApp* barApp = static_cast<TBarApp*>(be_app);
@@ -163,22 +157,13 @@ PreferencesWindow::PreferencesWindow(BRect frame)
fWindowAutoHide->SetValue(settings->autoHide);
// Clock settings
BFormattingConventions conventions;
BLocale::Default()->GetFormattingConventions(&conventions);
if (conventions.Use24HourClock())
fTimeInterval24HourRadioButton->SetValue(B_CONTROL_ON);
else
fTimeInterval12HourRadioButton->SetValue(B_CONTROL_ON);
TReplicantTray* replicantTray = barApp->BarView()->ReplicantTray();
if (replicantTray->Time() != NULL) {
fShowSeconds->SetValue(replicantTray->Time()->ShowSeconds());
fShowDayOfWeek->SetValue(replicantTray->Time()->ShowDayOfWeek());
fShowTimeZone->SetValue(replicantTray->Time()->ShowTimeZone());
} else {
fShowSeconds->SetValue(settings->showSeconds);
fShowDayOfWeek->SetValue(settings->showDayOfWeek);
fShowTimeZone->SetValue(settings->showTimeZone);
}
EnableDisableDependentItems();
@@ -194,12 +179,8 @@ PreferencesWindow::PreferencesWindow(BRect frame)
fWindowAutoRaise->SetTarget(be_app);
fWindowAutoHide->SetTarget(be_app);
fTimeInterval12HourRadioButton->SetTarget(replicantTray);
fTimeInterval24HourRadioButton->SetTarget(replicantTray);
fShowSeconds->SetTarget(replicantTray);
fShowDayOfWeek->SetTarget(replicantTray);
fShowTimeZone->SetTarget(replicantTray);
// Layout
fMenuBox = new BBox("fMenuBox");
@@ -244,7 +225,7 @@ PreferencesWindow::PreferencesWindow(BRect frame)
.Add(fAppsSortTrackerFirst)
.Add(fAppsShowExpanders)
.AddGroup(B_HORIZONTAL, 0)
.SetInsets(B_USE_BIG_SPACING, 0, 0, 0)
.SetInsets(kIndentSpacing, 0, 0, 0)
.Add(fAppsExpandNew)
.End()
.Add(fAppsHideLabels)
@@ -271,29 +252,10 @@ PreferencesWindow::PreferencesWindow(BRect frame)
.View();
fWindowBox->AddChild(view);
BGroupLayout* timeIntervalLayout = new BGroupLayout(B_VERTICAL, 0);
timeIntervalLayout->SetInsets(B_USE_DEFAULT_SPACING, 0, 0, 0);
BView* timeIntervalView = new BView("interval", 0, timeIntervalLayout);
timeIntervalView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
timeIntervalView->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
timeIntervalView->AddChild(fTimeInterval12HourRadioButton);
timeIntervalView->AddChild(fTimeInterval24HourRadioButton);
view = BLayoutBuilder::Group<>()
.AddGroup(B_VERTICAL, 0)
.AddGroup(B_VERTICAL, 0)
.SetInsets(0, 0, 0, B_USE_DEFAULT_SPACING)
.Add(new BStringView("interval", B_TRANSLATE("Interval")))
.Add(timeIntervalView)
.End()
.AddGroup(B_VERTICAL, 0)
.SetInsets(0, 0, 0, B_USE_DEFAULT_SPACING)
.Add(fShowSeconds)
.Add(fShowDayOfWeek)
.Add(fShowTimeZone)
.End()
.Add(new BButton(B_TRANSLATE("Time preferences" B_UTF8_ELLIPSIS),
new BMessage(kTimePreferences)))
.Add(fShowSeconds)
.Add(fShowDayOfWeek)
.AddGlue()
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
@@ -344,11 +306,6 @@ PreferencesWindow::MessageReceived(BMessage* message)
EnableDisableDependentItems();
break;
case kTimePreferences:
// launch the time prefs app
be_roster->Launch("application/x-vnd.Haiku-Time");
break;
default:
BWindow::MessageReceived(message);
break;
-7
View File
@@ -24,11 +24,8 @@ const uint32 kAutoRaise = 'AtRs';
const uint32 kAutoHide = 'AtHd';
const uint32 kShowHideTime = 'ShTm';
const uint32 kTimeIntervalChanged = 'TiCh';
const uint32 kShowSeconds = 'SwSc';
const uint32 kShowDayOfWeek = 'SwDw';
const uint32 kShowTimeZone = 'SwTz';
const uint32 kTimePreferences = 'TmPr';
class BBox;
class BButton;
@@ -75,12 +72,8 @@ private:
BCheckBox* fWindowAutoRaise;
BCheckBox* fWindowAutoHide;
BRadioButton* fTimeInterval24HourRadioButton;
BRadioButton* fTimeInterval12HourRadioButton;
BCheckBox* fShowSeconds;
BCheckBox* fShowDayOfWeek;
BCheckBox* fShowTimeZone;
};
+17 -37
View File
@@ -54,7 +54,6 @@ All rights reserved.
#include <FindDirectory.h>
#include <Locale.h>
#include <MenuItem.h>
#include <MutableLocaleRoster.h>
#include <NodeInfo.h>
#include <NodeMonitor.h>
#include <Path.h>
@@ -125,8 +124,9 @@ DumpList(BList* itemlist)
// don't change the name of this view to anything other than "Status"!
TReplicantTray::TReplicantTray(TBarView* parent, bool vertical)
: BView(BRect(0, 0, 1, 1), "Status", B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_FRAME_EVENTS),
:
BView(BRect(0, 0, 1, 1), "_deskbar_rt_", B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_FRAME_EVENTS),
fTime(NULL),
fBarView(parent),
fShelf(new TReplicantShelf(this)),
@@ -150,8 +150,7 @@ TReplicantTray::TReplicantTray(TBarView* parent, bool vertical)
// Create the time view
fTime = new TTimeView(fMinimumTrayWidth, kMaxReplicantHeight - 1.0,
use24HourClock, settings->showSeconds, settings->showDayOfWeek,
settings->showTimeZone);
use24HourClock, settings->showSeconds, settings->showDayOfWeek);
}
@@ -276,33 +275,27 @@ void
TReplicantTray::MessageReceived(BMessage* message)
{
switch (message->what) {
case kShowHideTime:
// from context menu in clock and in this view
ShowHideTime();
break;
case kTimeIntervalChanged:
case B_LOCALE_CHANGED:
{
if (fTime == NULL)
return;
bool use24HourClock;
if (message->FindBool("use24HourClock", &use24HourClock)
== B_OK) {
BFormattingConventions conventions;
BLocale::Default()->GetFormattingConventions(&conventions);
conventions.SetExplicitUse24HourClock(use24HourClock);
BPrivate::MutableLocaleRoster::Default()->
SetDefaultFormattingConventions(conventions);
fTime->SetUse24HourClock(use24HourClock);
// time string reformat -> realign
RealignReplicants();
AdjustPlacement();
}
// Locale may have updated 12/24 hour clock
BFormattingConventions conventions;
BLocale::Default()->GetFormattingConventions(&conventions);
fTime->SetUse24HourClock(conventions.Use24HourClock());
// time string reformat -> realign
RealignReplicants();
AdjustPlacement();
break;
}
case kShowHideTime:
// from context menu in clock and in this view
ShowHideTime();
break;
case kShowSeconds:
if (fTime == NULL)
return;
@@ -325,17 +318,6 @@ TReplicantTray::MessageReceived(BMessage* message)
AdjustPlacement();
break;
case kShowTimeZone:
if (fTime == NULL)
return;
fTime->SetShowTimeZone(!fTime->ShowTimeZone());
// time string reformat -> realign
RealignReplicants();
AdjustPlacement();
break;
#ifdef DB_ADDONS
case B_NODE_MONITOR:
HandleEntryUpdate(message);
@@ -1258,7 +1240,6 @@ TReplicantTray::SaveTimeSettings()
settings->showTime = !fTime->IsHidden();
settings->showSeconds = fTime->ShowSeconds();
settings->showDayOfWeek = fTime->ShowDayOfWeek();
settings->showTimeZone = fTime->ShowTimeZone();
}
@@ -1605,4 +1586,3 @@ TDragRegion::SetDragRegionLocation(int32 location)
fDragLocation = location;
Invalidate();
}
+6 -36
View File
@@ -66,8 +66,9 @@ enum {
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "TimeView"
TTimeView::TTimeView(float maxWidth, float height, bool use24HourClock,
bool showSeconds, bool showDayOfWeek, bool showTimeZone)
bool showSeconds, bool showDayOfWeek)
:
BView(BRect(-100, -100, -90, -90), "_deskbar_tv_",
B_FOLLOW_RIGHT | B_FOLLOW_TOP,
@@ -78,8 +79,7 @@ TTimeView::TTimeView(float maxWidth, float height, bool use24HourClock,
fOrientation(true),
fUse24HourClock(use24HourClock),
fShowSeconds(showSeconds),
fShowDayOfWeek(showDayOfWeek),
fShowTimeZone(showTimeZone)
fShowDayOfWeek(showDayOfWeek)
{
fCurrentTime = fLastTime = time(NULL);
fSeconds = fMinute = fHour = 0;
@@ -194,10 +194,6 @@ void
TTimeView::MessageReceived(BMessage* message)
{
switch (message->what) {
case B_LOCALE_CHANGED:
Update();
break;
case kChangeTime:
// launch the time prefs app
be_roster->Launch("application/x-vnd.Haiku-Time");
@@ -357,21 +353,6 @@ TTimeView::SetShowDayOfWeek(bool show)
}
bool
TTimeView::ShowTimeZone() const
{
return fShowTimeZone;
}
void
TTimeView::SetShowTimeZone(bool show)
{
fShowTimeZone = show;
Update();
}
void
TTimeView::ShowCalendar(BPoint where)
{
@@ -436,14 +417,6 @@ TTimeView::CalculateTextPlacement()
BFont font;
GetFont(&font);
// If 12 hour clock with all options turned on shrink font size to fit.
if (!fUse24HourClock && fShowSeconds && fShowDayOfWeek && fShowTimeZone)
font.SetSize(11.0);
else
font.SetSize(12.0);
SetFont(&font, B_FONT_SIZE);
const char* stringArray[1];
stringArray[0] = fCurrentTimeStr;
BRect rectArray[1];
@@ -487,16 +460,16 @@ void
TTimeView::Update()
{
fLocale = *BLocale::Default();
UpdateTimeFormat();
GetCurrentTime();
GetCurrentDate();
SetToolTip(fCurrentDateStr);
UpdateTimeFormat();
CalculateTextPlacement();
ResizeToPreferred();
if (fParent)
if (fParent != NULL)
fParent->Invalidate();
}
@@ -520,8 +493,5 @@ TTimeView::UpdateTimeFormat()
if (!fUse24HourClock)
timeFormat.Append(" a");
if (fShowTimeZone)
timeFormat.Append(" V");
fTimeFormat = timeFormat;
}
+1 -5
View File
@@ -55,7 +55,7 @@ class TTimeView : public BView {
public:
TTimeView(float maxWidth, float height,
bool use24HourClock, bool showSeconds,
bool showDayOfWeek, bool showTimeZone);
bool showDayOfWeek);
TTimeView(BMessage* data);
~TTimeView();
@@ -86,9 +86,6 @@ public:
bool ShowDayOfWeek() const;
void SetShowDayOfWeek(bool show);
bool ShowTimeZone() const;
void SetShowTimeZone(bool show);
void ShowCalendar(BPoint where);
private:
@@ -123,7 +120,6 @@ private:
bool fUse24HourClock;
bool fShowSeconds;
bool fShowDayOfWeek;
bool fShowTimeZone;
BString fTimeFormat;
BPoint fTimeLocation;
+45 -25
View File
@@ -152,9 +152,6 @@ CalcView::CalcView(BRect frame, rgb_color rgbBaseColor, BMessage* settings)
// colorize based on base color.
_Colorize();
// create pop-up menu system
_CreatePopUpMenu();
// Fetch the calc icon for compact view
_FetchAppIcon(fCalcIcon);
}
@@ -196,9 +193,6 @@ CalcView::CalcView(BMessage* archive)
// read data from archive
_LoadSettings(archive);
// create pop-up menu system
_CreatePopUpMenu();
// Fetch the calc icon for compact view
_FetchAppIcon(fCalcIcon);
}
@@ -221,21 +215,43 @@ CalcView::AttachedToWindow()
BRect frame(Frame());
FrameResized(frame.Width(), frame.Height());
SetKeypadMode(fOptions->keypad_mode);
bool addKeypadModeMenuItems = true;
if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) {
// don't add these items if we are a replicant on the desktop
addKeypadModeMenuItems = false;
}
// create and attach the pop-up menu
_CreatePopUpMenu(addKeypadModeMenuItems);
if (addKeypadModeMenuItems)
SetKeypadMode(fOptions->keypad_mode);
}
void
CalcView::MessageReceived(BMessage* message)
{
if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) {
// if we are embedded in desktop we need to receive these
// message here since we don't have a parent BWindow
switch (message->what) {
case MSG_OPTIONS_AUTO_NUM_LOCK:
ToggleAutoNumlock();
return;
case MSG_OPTIONS_AUDIO_FEEDBACK:
ToggleAudioFeedback();
return;
}
}
// check if message was dropped
if (message->WasDropped()) {
// pass message on to paste
if (message->IsSourceRemote())
Paste(message);
} else {
// act on posted message type
switch (message->what) {
@@ -510,8 +526,8 @@ CalcView::MouseDown(BPoint point)
int32 buttons = 0;
Window()->CurrentMessage()->FindInt32("buttons", &buttons);
// display popup menu if not primary mouse button
if ((B_PRIMARY_MOUSE_BUTTON & buttons) == 0) {
// display popup menu if not primary mouse button
BMenuItem* selected;
if ((selected = fPopUpMenu->Go(ConvertToScreen(point))) != NULL
&& selected->Message() != NULL) {
@@ -1233,36 +1249,40 @@ CalcView::_Colorize()
void
CalcView::_CreatePopUpMenu()
CalcView::_CreatePopUpMenu(bool addKeypadModeMenuItems)
{
// construct items
fAutoNumlockItem = new BMenuItem(B_TRANSLATE("Enable Num Lock on startup"),
new BMessage(MSG_OPTIONS_AUTO_NUM_LOCK));
fAudioFeedbackItem = new BMenuItem(B_TRANSLATE("Audio Feedback"),
new BMessage(MSG_OPTIONS_AUDIO_FEEDBACK));
fKeypadModeCompactItem = new BMenuItem(B_TRANSLATE("Compact"),
new BMessage(MSG_OPTIONS_KEYPAD_MODE_COMPACT), '0');
fKeypadModeBasicItem = new BMenuItem(B_TRANSLATE("Basic"),
new BMessage(MSG_OPTIONS_KEYPAD_MODE_BASIC), '1');
fKeypadModeScientificItem = new BMenuItem(B_TRANSLATE("Scientific"),
new BMessage(MSG_OPTIONS_KEYPAD_MODE_SCIENTIFIC), '2');
if (addKeypadModeMenuItems) {
fKeypadModeCompactItem = new BMenuItem(B_TRANSLATE("Compact"),
new BMessage(MSG_OPTIONS_KEYPAD_MODE_COMPACT), '0');
fKeypadModeBasicItem = new BMenuItem(B_TRANSLATE("Basic"),
new BMessage(MSG_OPTIONS_KEYPAD_MODE_BASIC), '1');
fKeypadModeScientificItem = new BMenuItem(B_TRANSLATE("Scientific"),
new BMessage(MSG_OPTIONS_KEYPAD_MODE_SCIENTIFIC), '2');
}
// apply current settings
fAutoNumlockItem->SetMarked(fOptions->auto_num_lock);
fAudioFeedbackItem->SetMarked(fOptions->audio_feedback);
_MarkKeypadItems(fOptions->keypad_mode);
// construct menu
fPopUpMenu = new BPopUpMenu("pop-up", false, false);
fPopUpMenu->AddItem(fAutoNumlockItem);
// TODO: Enabled when we use beep events which can be configured in the Sounds
// preflet.
// fPopUpMenu->AddItem(fAudioFeedbackItem);
fPopUpMenu->AddSeparatorItem();
fPopUpMenu->AddItem(fKeypadModeCompactItem);
fPopUpMenu->AddItem(fKeypadModeBasicItem);
fPopUpMenu->AddItem(fKeypadModeScientificItem);
// TODO: Enable this when we use beep events which can be configured
// in the Sounds preflet.
//fPopUpMenu->AddItem(fAudioFeedbackItem);
if (addKeypadModeMenuItems) {
fPopUpMenu->AddSeparatorItem();
fPopUpMenu->AddItem(fKeypadModeCompactItem);
fPopUpMenu->AddItem(fKeypadModeBasicItem);
fPopUpMenu->AddItem(fKeypadModeScientificItem);
_MarkKeypadItems(fOptions->keypad_mode);
}
}
+1 -1
View File
@@ -104,7 +104,7 @@ class CalcView : public BView {
void _Colorize();
void _CreatePopUpMenu();
void _CreatePopUpMenu(bool addKeypadModeMenuItems);
BRect _ExpressionRect() const;
BRect _KeypadRect() const;
+3 -3
View File
@@ -77,9 +77,9 @@ CalcWindow::~CalcWindow()
void
CalcWindow::MessageReceived(BMessage* msg)
CalcWindow::MessageReceived(BMessage* message)
{
switch (msg->what) {
switch (message->what) {
case MSG_OPTIONS_AUTO_NUM_LOCK:
fCalcView->ToggleAutoNumlock();
break;
@@ -101,7 +101,7 @@ CalcWindow::MessageReceived(BMessage* msg)
break;
default:
BWindow::MessageReceived(msg);
BWindow::MessageReceived(message);
break;
}
}
+16 -4
View File
@@ -560,6 +560,7 @@ BControlLook::DrawScrollBarBackground(BView* view, BRect& rect1, BRect& rect2,
DrawScrollBarBackground(view, rect2, updateRect, base, flags, orientation);
}
void
BControlLook::DrawScrollBarBackground(BView* view, BRect& rect,
const BRect& updateRect, const rgb_color& base, uint32 flags,
@@ -1920,10 +1921,12 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect,
defaultIndicatorTint = (B_NO_TINT + defaultIndicatorTint) / 2;
rgb_color defaultIndicatorColor = tint_color(base, defaultIndicatorTint);
rgb_color cornerBgColor = background;
rgb_color cornerBgColor;
drawing_mode oldMode = view->DrawingMode();
if ((flags & B_DEFAULT_BUTTON) != 0) {
// draw default button indicator
cornerBgColor = defaultIndicatorColor;
edgeLightColor = _EdgeLightColor(defaultIndicatorColor,
contrast * ((flags & B_DISABLED) != 0 ? 0.3 : 0.8),
brightness * ((flags & B_DISABLED) != 0 ? 1.0 : 0.9), flags);
@@ -1931,8 +1934,7 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect,
contrast * ((flags & B_DISABLED) != 0 ? 0.3 : 0.8),
brightness * ((flags & B_DISABLED) != 0 ? 1.0 : 0.9), flags);
cornerBgColor = defaultIndicatorColor;
// draw default button indicator
view->SetHighColor(background);
view->FillRect(rect);
view->SetHighColor(base);
@@ -1946,6 +1948,14 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect,
view->StrokeRoundRect(rect, leftTopRadius, leftTopRadius);
rect.InsetBy(1, 1);
} else {
cornerBgColor = background;
if ((flags & B_BLEND_FRAME) != 0) {
// set the background color to transparent for the case
// that we are on the desktop
cornerBgColor.alpha = 0;
view->SetDrawingMode(B_OP_ALPHA);
}
edgeLightColor = _EdgeLightColor(background,
contrast * ((flags & B_DISABLED) != 0 ? 0.0 : 1.0),
brightness * 1.0, flags);
@@ -2021,6 +2031,8 @@ BControlLook::_DrawButtonFrame(BView* view, BRect& rect,
brightness * 1.0, flags, borders);
}
view->SetDrawingMode(oldMode);
// draw frame
if ((flags & B_BLEND_FRAME) != 0) {
drawing_mode oldDrawingMode = view->DrawingMode();
+10 -1
View File
@@ -1,4 +1,5 @@
SubDir HAIKU_TOP src tests kits opengl demos gears ;
SubDirSysHdrs $(HAIKU_MESA_HEADERS) ;
SetSubDirSupportedPlatformsBeOSCompatible ;
@@ -9,7 +10,15 @@ if $(TARGET_PLATFORM) != haiku {
UsePublicHeaders opengl ;
}
SimpleTest GLGears :
local sources =
gears.c
;
Includes [ FGristFiles $(sources) ] : $(HAIKU_MESA_HEADERS_DEPENDENCY) ;
SimpleTest GLGears :
$(sources)
: be GL
;
+7 -1
View File
@@ -10,8 +10,14 @@ if $(TARGET_PLATFORM) != haiku {
UsePublicHeaders opengl ;
}
SimpleTest GLDirectMode :
local sources =
GLDirectMode.cpp
;
Includes [ FGristFiles $(sources) ] : $(HAIKU_MESA_HEADERS_DEPENDENCY) ;
SimpleTest GLDirectMode :
$(sources)
: be game GL $(TARGET_LIBSUPC++)
: GLDirectMode.rdef
;
@@ -35,7 +35,7 @@ CapabilitiesView::CapabilitiesView()
{
// add the columns
float capabilityColWidth = this->StringWidth("M") * 23;
float capabilityColWidth = this->StringWidth("M") * 28;
fCapabilityColumn = new BStringColumn(B_TRANSLATE("Capability"),
capabilityColWidth, capabilityColWidth - 20.0,
@@ -44,7 +44,7 @@ CapabilitiesView::CapabilitiesView()
fCapabilitiesList->SetSortingEnabled(true);
fCapabilitiesList->SetSortColumn(fCapabilityColumn, true, true);
float valueColWidth = this->StringWidth("M") * 6;
float valueColWidth = this->StringWidth("M") * 8;
fValueColumn = new BStringColumn(B_TRANSLATE("Value"), valueColWidth,
valueColWidth, valueColWidth, B_TRUNCATE_MIDDLE);
@@ -33,7 +33,7 @@ ExtensionsView::ExtensionsView()
{
// add the columns
float availableColWidth = this->StringWidth("M") * 27;
float availableColWidth = this->StringWidth("M") * 28;
fAvailableColumn = new BStringColumn(B_TRANSLATE("Available extensions"),
availableColWidth, availableColWidth, availableColWidth,
+1 -1
View File
@@ -52,7 +52,7 @@ GearsView::Draw(BRect updateRect)
SetDrawingMode(B_OP_ALPHA);
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
DrawBitmapAsync(fGears, BPoint(5.0, 18.0));
DrawBitmapAsync(fGears, BPoint(5.0, 10.0));
}
+11 -26
View File
@@ -11,6 +11,7 @@
#include "InfoView.h"
#include <Box.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <GL/gl.h>
@@ -32,15 +33,6 @@ const BAlignment kLabelAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
const BAlignment kValueAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET);
// <bold>Render name</bold>
// Vendor Name GL Version
// GLU version GLUT API version
//
// example:
// Software rasterizer for X86/MMX/SSE2
// Mesa Project 2.1 Mesa 8.1-devel (git-2402c0)
// GLU 1.3 GLUT API 5
InfoView::InfoView()
:
BGroupView(B_TRANSLATE("Information"), B_HORIZONTAL)
@@ -52,32 +44,25 @@ InfoView::InfoView()
BStringView* vendorNameView = new BStringView(NULL,
(const char*)glGetString(GL_VENDOR));
vendorNameView->SetExplicitAlignment(kLabelAlignment);
vendorNameView->SetExplicitAlignment(kLabelAlignment);
BStringView* glVersionView = new BStringView(NULL,
(const char*)glGetString(GL_VERSION));
glVersionView->SetExplicitAlignment(kLabelAlignment);
BString gluString("GLU ");
gluString << (const char*)gluGetString(GLU_VERSION);
BStringView* gluVersionView = new BStringView(NULL, gluString.String());
gluVersionView->SetExplicitAlignment(kLabelAlignment);
BString glutAPIString("GLUT API ");
glutAPIString << (int32)GLUT_API_VERSION;
BStringView* glutVersionView = new BStringView(NULL,
glutAPIString.String());
glutVersionView->SetExplicitAlignment(kLabelAlignment);
BString apiString("GLU ");
apiString << (const char*)gluGetString(GLU_VERSION);
apiString << ", GLUT ";
apiString << (int32)GLUT_API_VERSION;
BStringView* apiVersionView = new BStringView(NULL, apiString.String());
apiVersionView->SetExplicitAlignment(kLabelAlignment);
BLayoutBuilder::Group<>(this)
.AddGroup(B_VERTICAL, 0)
.Add(rendererView)
.Add(BGridLayoutBuilder(0, 0)
.Add(vendorNameView, 0, 0)
.Add(glVersionView, 1, 0)
.Add(gluVersionView, 0, 1)
.Add(glutVersionView, 1, 1)
)
.Add(vendorNameView)
.Add(glVersionView)
.Add(apiVersionView)
.End();
}
+1 -18
View File
@@ -44,23 +44,7 @@ OpenGLView::OpenGLView()
glView->LockGL();
BPopUpMenu* menu = new BPopUpMenu(B_TRANSLATE("Automatic"), true, true);
menu->AddItem(new BMenuItem(B_TRANSLATE("Automatic"),
new BMessage(MENU_AUTO_MESSAGE)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Software Rasterizer"),
new BMessage(MENU_SWRAST_MESSAGE)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Gallium Software Pipe"),
new BMessage(MENU_SWPIPE_MESSAGE)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Gallium LLVM Pipe"),
new BMessage(MENU_SWLLVM_MESSAGE)));
BMenuField* menuField = new BMenuField("renderer",
B_TRANSLATE("3D Rendering Engine:"), menu);
menuField->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
// TODO: Set current Renderer
menuField->SetEnabled(false);
float tabViewWidth = this->StringWidth("M") * 36;
float tabViewWidth = this->StringWidth("M") * 42;
float tabViewHeight = this->StringWidth("M") * 16;
BTabView *tabView = new BTabView("tab view", B_WIDTH_FROM_LABEL);
@@ -77,7 +61,6 @@ OpenGLView::OpenGLView()
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(0, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.Add(menuField)
.Add(new InfoView())
.Add(tabView)
.End()
@@ -23,7 +23,7 @@
OpenGLWindow::OpenGLWindow()
:
BWindow(BRect(50, 50, 300, 300),
BWindow(BRect(50, 50, 300, 400),
B_TRANSLATE_SYSTEM_NAME("GL Info"), B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
| B_AUTO_UPDATE_SIZE_LIMITS)
+8 -1
View File
@@ -1,4 +1,5 @@
SubDir HAIKU_TOP src tests kits opengl glsl ;
SubDirSysHdrs $(HAIKU_MESA_HEADERS) ;
SetSubDirSupportedPlatformsBeOSCompatible ;
@@ -9,10 +10,16 @@ if $(TARGET_PLATFORM) != haiku {
UsePublicHeaders opengl ;
}
StaticLibrary libshaderutil.a :
local shadersources =
shaderutil.c
;
Includes [ FGristFiles $(shadersources) ] : $(HAIKU_MESA_HEADERS_DEPENDENCY) ;
StaticLibrary libshaderutil.a :
$(shadersources)
;
SimpleTest brick :
brick.c
: libshaderutil.a be GL
+8 -1
View File
@@ -1,4 +1,5 @@
SubDir HAIKU_TOP src tests kits opengl glut game_mode ;
SubDirSysHdrs $(HAIKU_MESA_HEADERS) ;
SetSubDirSupportedPlatformsBeOSCompatible ;
@@ -9,7 +10,13 @@ if $(TARGET_PLATFORM) != haiku {
UsePublicHeaders opengl ;
}
SimpleTest GLUTGameMode :
local sources =
game_mode.c
;
Includes [ FGristFiles $(sources) ] : $(HAIKU_MESA_HEADERS_DEPENDENCY) ;
SimpleTest GLUTGameMode :
$(sources)
: be GL
;