Back to index

easystroke  0.5.5.1
Public Member Functions | Private Member Functions | Private Attributes
Fire Class Reference

#include <fire.h>

Inheritance diagram for Fire:
Inheritance graph
[legend]
Collaboration diagram for Fire:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Fire ()
void draw (Point p)
void start (Point p)
void end ()
bool remove_timeout ()
void set_timeout (int ms)

Private Member Functions

virtual void draw (Point p, Point q)
void add_point (float, float)
virtual void start_ ()
virtual void end_ ()
virtual void timeout ()

Private Attributes

DBusGConnection * bus
DBusGProxy * point_proxy
DBusGProxy * clear_proxy
float leftover

Detailed Description

Definition at line 23 of file fire.h.


Constructor & Destructor Documentation

Definition at line 21 of file fire.cc.

           {
       const char *ofc = "org.freedesktop.compiz";
       GError *error = 0;
       bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
       if (!bus) {
              g_error_free(error);
              throw DBusException();
       }
       char add[256];
       char clear[256];
       snprintf(add, sizeof(add), "/org/freedesktop/compiz/firepaint/screen%d/add_particle", DefaultScreen(dpy));
       snprintf(clear, sizeof(clear), "/org/freedesktop/compiz/firepaint/screen%d/clear_key", DefaultScreen(dpy));

       point_proxy = dbus_g_proxy_new_for_name(bus, ofc, add, ofc);
       clear_proxy = dbus_g_proxy_new_for_name(bus, ofc, clear, ofc);
}

Member Function Documentation

void Fire::add_point ( float  x,
float  y 
) [private]

Definition at line 38 of file fire.cc.

                                     {
       dbus_g_proxy_call_no_reply(point_proxy, "activate",
                     G_TYPE_STRING, "root", G_TYPE_INT,    gint(ROOT),
                     G_TYPE_STRING, "x",   G_TYPE_DOUBLE, gdouble(x),
                     G_TYPE_STRING, "y",   G_TYPE_DOUBLE, gdouble(y),
                     G_TYPE_INVALID);
}

Here is the caller graph for this function:

void Fire::draw ( Point  p,
Point  q 
) [private, virtual]

Implements Trace.

Definition at line 46 of file fire.cc.

                                {
       float dist = hypot(p.x-q.x, p.y-q.y);
       leftover -= dist;
       while (leftover < 0.01) {
              add_point(q.x + (q.x-p.x)*leftover/dist, q.y + (q.y-p.y)*leftover/dist);
              leftover += 5.0;
       }
}

Here is the call graph for this function:

void Trace::draw ( Point  p) [inline, inherited]

Definition at line 38 of file trace.h.

{ draw(last, p); last = p; }

Here is the call graph for this function:

Here is the caller graph for this function:

void Trace::end ( ) [inherited]

Definition at line 781 of file main.cc.

                {
       if (!active)
              return;
       active = false;
       XFixesShowCursor(dpy, ROOT);
       end_();
}

Here is the call graph for this function:

virtual void Fire::end_ ( ) [inline, private, virtual]

Implements Trace.

Definition at line 32 of file fire.h.

{ set_timeout(250); }

Here is the call graph for this function:

bool Timeout::remove_timeout ( ) [inline, inherited]

Definition at line 32 of file util.h.

                             {
              if (c) {
                     c->disconnect();
                     c = 0;
                     return true;
              }
              return false;
       }

Here is the caller graph for this function:

void Timeout::set_timeout ( int  ms) [inline, inherited]

Definition at line 40 of file util.h.

                                {
              remove_timeout();
              connection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Timeout::to), ms);
              c = &connection;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void Trace::start ( Trace::Point  p) [inherited]

Definition at line 774 of file main.cc.

                              {
       last = p;
       active = true;
       XFixesHideCursor(dpy, ROOT);
       start_();
}

Here is the call graph for this function:

virtual void Fire::start_ ( ) [inline, private, virtual]

Implements Trace.

Definition at line 31 of file fire.h.

{ if (remove_timeout()) timeout(); leftover = 0; }

Here is the call graph for this function:

void Fire::timeout ( ) [private, virtual]

Reimplemented from Trace.

Definition at line 54 of file fire.cc.

                   {
       dbus_g_proxy_call_no_reply(clear_proxy, "activate",
                     G_TYPE_STRING, "root", G_TYPE_INT,    gint(ROOT),
                     G_TYPE_INVALID);
}

Here is the caller graph for this function:


Member Data Documentation

DBusGConnection* Fire::bus [private]

Definition at line 24 of file fire.h.

DBusGProxy* Fire::clear_proxy [private]

Definition at line 26 of file fire.h.

float Fire::leftover [private]

Definition at line 27 of file fire.h.

DBusGProxy* Fire::point_proxy [private]

Definition at line 25 of file fire.h.


The documentation for this class was generated from the following files: