Compiler warning and code style fixes. No functional changes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37278 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+14
-10
@@ -1,23 +1,29 @@
|
||||
#include "SnowView.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Debug.h>
|
||||
#include <Message.h>
|
||||
#include <MessageRunner.h>
|
||||
#include <OS.h>
|
||||
#include <Screen.h>
|
||||
#include "SnowView.h"
|
||||
#include "Flakes.h"
|
||||
#include <Region.h>
|
||||
|
||||
#include <MessageFilter.h>
|
||||
#include <OS.h>
|
||||
#include <Region.h>
|
||||
#include <Screen.h>
|
||||
|
||||
#include "Flakes.h"
|
||||
|
||||
|
||||
#define FORWARD_TO_PARENT
|
||||
|
||||
|
||||
SnowView::SnowView()
|
||||
: BView(BRect(SNOW_VIEW_RECT), "BSnow", B_FOLLOW_NONE, B_WILL_DRAW|B_PULSE_NEEDED)
|
||||
:
|
||||
BView(BRect(SNOW_VIEW_RECT), "BSnow", B_FOLLOW_NONE,
|
||||
B_WILL_DRAW | B_PULSE_NEEDED)
|
||||
{
|
||||
fAttached = false;
|
||||
fMsgRunner = NULL;
|
||||
@@ -79,7 +85,7 @@ SnowView::SnowView(BMessage *archive)
|
||||
SetFlags(Flags() & ~B_PULSE_NEEDED); /* it's only used when in the app */
|
||||
get_system_info(&si);
|
||||
fNumFlakes = ((int32)(si.cpu_clock_speed/1000000)) * si.cpu_count / 3; //;
|
||||
printf("BSnow: using %d flakes\n", fNumFlakes);
|
||||
printf("BSnow: using %ld flakes\n", fNumFlakes);
|
||||
for (int i = 0; i < WORKSPACES_COUNT; i++) {
|
||||
fFlakes[i] = new flake[fNumFlakes];
|
||||
memset(fFlakes[i], 0, fNumFlakes * sizeof(flake));
|
||||
@@ -545,8 +551,6 @@ void SnowView::KeyUp(const char *bytes, int32 numBytes)
|
||||
int32 SnowView::SnowMakerThread(void *p_this)
|
||||
{
|
||||
SnowView *_this = (SnowView *)p_this;
|
||||
bigtime_t nextDraw = 0LL;
|
||||
int current=0;
|
||||
BView *p = _this->Parent();
|
||||
BRect portion(0,0,(_this->fCachedWsWidth/PORTION_GRAN)-1, (_this->fCachedWsHeight/PORTION_GRAN)-1);
|
||||
int nf = _this->fNumFlakes;
|
||||
|
||||
+44
-37
@@ -1,13 +1,17 @@
|
||||
#ifndef _SNOW_VIEW_H
|
||||
#define _SNOW_VIEW_H
|
||||
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <Dragger.h>
|
||||
#include <List.h>
|
||||
#include <OS.h>
|
||||
#include <View.h>
|
||||
#include <MessageRunner.h>
|
||||
|
||||
#include "Flakes.h"
|
||||
|
||||
|
||||
#define APP_SIG "application/x-vnd.mmu_man.BSnow"
|
||||
#define SNOW_VIEW_RECT 0,0,200,40
|
||||
#define NUM_FLAKES 200
|
||||
@@ -22,58 +26,61 @@
|
||||
#define FALLEN_HEIGHT 30
|
||||
#define INVALIDATOR_THREAD_NAME "You're Neo? I'm the Snow Maker!"
|
||||
|
||||
|
||||
#define MSG_DRAG_ME "Drag me on your desktop..."
|
||||
#define MSG_CLICK_ME "Click me to remove BSnow..."
|
||||
|
||||
|
||||
typedef struct flake {
|
||||
BPoint pos;
|
||||
BPoint opos;
|
||||
float weight;
|
||||
} flake;
|
||||
|
||||
|
||||
class SnowView : public BView
|
||||
{
|
||||
public:
|
||||
SnowView();
|
||||
SnowView(BMessage *archive);
|
||||
~SnowView();
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
void AttachedToWindow();
|
||||
void DetachedFromWindow();
|
||||
void MessageReceived(BMessage *msg);
|
||||
void Draw(BRect ur);
|
||||
void Pulse();
|
||||
SnowView();
|
||||
SnowView(BMessage *archive);
|
||||
~SnowView();
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
void AttachedToWindow();
|
||||
void DetachedFromWindow();
|
||||
void MessageReceived(BMessage *msg);
|
||||
void Draw(BRect ur);
|
||||
void Pulse();
|
||||
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void MouseMoved(BPoint where, uint32 code, const BMessage *a_message);
|
||||
virtual void KeyDown(const char *bytes, int32 numBytes);
|
||||
virtual void KeyUp(const char *bytes, int32 numBytes);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void MouseMoved(BPoint where, uint32 code,
|
||||
const BMessage *a_message);
|
||||
virtual void KeyDown(const char *bytes, int32 numBytes);
|
||||
virtual void KeyUp(const char *bytes, int32 numBytes);
|
||||
|
||||
static int32 SnowMakerThread(void *p_this);
|
||||
void Calc();
|
||||
void InvalFlakes();
|
||||
|
||||
static int32 SnowMakerThread(void *p_this);
|
||||
void Calc();
|
||||
void InvalFlakes();
|
||||
private:
|
||||
BMessageRunner *fMsgRunner;
|
||||
BDragger *fDragger;
|
||||
long fNumFlakes;
|
||||
flake *fFlakes[WORKSPACES_COUNT];
|
||||
BList *fFallenFlakes[WORKSPACES_COUNT];
|
||||
uint32 fCurrentWorkspace;
|
||||
uint32 fCachedWsWidth;
|
||||
uint32 fCachedWsHeight;
|
||||
float fWind;
|
||||
bigtime_t fWindDuration;
|
||||
bool fAttached;
|
||||
BBitmap *fFlakeBitmaps[NUM_PATTERNS];
|
||||
thread_id fInvalidator;
|
||||
BView *fCachedParent;
|
||||
BBitmap *fFallenBmp;
|
||||
BView *fFallenView;
|
||||
BRegion *fFallenReg;
|
||||
bool fShowClickMe;
|
||||
BMessageRunner *fMsgRunner;
|
||||
BDragger *fDragger;
|
||||
long fNumFlakes;
|
||||
flake *fFlakes[WORKSPACES_COUNT];
|
||||
BList *fFallenFlakes[WORKSPACES_COUNT];
|
||||
uint32 fCurrentWorkspace;
|
||||
uint32 fCachedWsWidth;
|
||||
uint32 fCachedWsHeight;
|
||||
float fWind;
|
||||
bigtime_t fWindDuration;
|
||||
bool fAttached;
|
||||
BBitmap *fFlakeBitmaps[NUM_PATTERNS];
|
||||
thread_id fInvalidator;
|
||||
BView *fCachedParent;
|
||||
BBitmap *fFallenBmp;
|
||||
BView *fFallenView;
|
||||
BRegion *fFallenReg;
|
||||
bool fShowClickMe;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user