aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-01-09 01:19:48 (GMT)
committerfluxgen <fluxgen>2004-01-09 01:19:48 (GMT)
commit08f6ca0514de8e24fb98e6a8b057598fc70ebd64 (patch)
treedcd547fac4692b721e9b6c6817caea83eef3595c
parenta48d734251fd8ee0aec24c7e295bcbc2a3e1a188 (diff)
downloadfluxbox_paul-08f6ca0514de8e24fb98e6a8b057598fc70ebd64.zip
fluxbox_paul-08f6ca0514de8e24fb98e6a8b057598fc70ebd64.tar.bz2
save some memory
-rw-r--r--src/FbTk/GContext.cc20
-rw-r--r--src/FbTk/GContext.hh4
2 files changed, 15 insertions, 9 deletions
diff --git a/src/FbTk/GContext.cc b/src/FbTk/GContext.cc
index e0f66a4..dae8fac 100644
--- a/src/FbTk/GContext.cc
+++ b/src/FbTk/GContext.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: GContext.cc,v 1.5 2003/11/28 22:50:55 fluxgen Exp $ 22// $Id: GContext.cc,v 1.6 2004/01/09 01:19:48 fluxgen Exp $
23 23
24#include "GContext.hh" 24#include "GContext.hh"
25 25
@@ -31,27 +31,33 @@
31 31
32namespace FbTk { 32namespace FbTk {
33 33
34Display *GContext::m_display = 0;
35
34GContext::GContext(const FbTk::FbDrawable &drawable): 36GContext::GContext(const FbTk::FbDrawable &drawable):
35 m_display(FbTk::App::instance()->display()), 37 m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
36 m_gc(XCreateGC(m_display,
37 drawable.drawable(), 38 drawable.drawable(),
38 0, 0)) { 39 0, 0)) {
40 if (m_display == 0)
41 m_display = FbTk::App::instance()->display();
42
39 setGraphicsExposure(false); 43 setGraphicsExposure(false);
40} 44}
41 45
42GContext::GContext(Drawable drawable): 46GContext::GContext(Drawable drawable):
43 m_display(FbTk::App::instance()->display()), 47 m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
44 m_gc(XCreateGC(m_display,
45 drawable, 48 drawable,
46 0, 0)) { 49 0, 0)) {
50 if (m_display == 0)
51 m_display = FbTk::App::instance()->display();
47 setGraphicsExposure(false); 52 setGraphicsExposure(false);
48} 53}
49 54
50GContext::GContext(Drawable d, const GContext &gc): 55GContext::GContext(Drawable d, const GContext &gc):
51 m_display(FbTk::App::instance()->display()), 56 m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
52 m_gc(XCreateGC(m_display,
53 d, 57 d,
54 0, 0)) { 58 0, 0)) {
59 if (m_display == 0)
60 m_display = FbTk::App::instance()->display();
55 setGraphicsExposure(false); 61 setGraphicsExposure(false);
56 copy(gc); 62 copy(gc);
57} 63}
diff --git a/src/FbTk/GContext.hh b/src/FbTk/GContext.hh
index 94aec3e..462ea32 100644
--- a/src/FbTk/GContext.hh
+++ b/src/FbTk/GContext.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: GContext.hh,v 1.6 2003/12/16 17:06:51 fluxgen Exp $ 22// $Id: GContext.hh,v 1.7 2004/01/09 01:19:48 fluxgen Exp $
23 23
24#ifndef FBTK_GCONTEXT_HH 24#ifndef FBTK_GCONTEXT_HH
25#define FBTK_GCONTEXT_HH 25#define FBTK_GCONTEXT_HH
@@ -98,7 +98,7 @@ public:
98private: 98private:
99 GContext(const GContext &cont); 99 GContext(const GContext &cont);
100 100
101 Display *m_display; // worth caching 101 static Display *m_display; // worth caching
102 GC m_gc; 102 GC m_gc;
103}; 103};
104 104