aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/fbrun/FbRun.cc37
1 files changed, 8 insertions, 29 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc
index 2adde5f..2042c17 100644
--- a/util/fbrun/FbRun.cc
+++ b/util/fbrun/FbRun.cc
@@ -19,10 +19,12 @@
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: FbRun.cc,v 1.2 2002/09/03 10:55:02 fluxgen Exp $ 22// $Id: FbRun.cc,v 1.3 2002/11/12 17:10:13 fluxgen Exp $
23 23
24#include "FbRun.hh" 24#include "FbRun.hh"
25 25
26#include "BaseDisplay.hh"
27
26#include <X11/Xlib.h> 28#include <X11/Xlib.h>
27#include <X11/keysym.h> 29#include <X11/keysym.h>
28#include <X11/Xutil.h> 30#include <X11/Xutil.h>
@@ -32,22 +34,14 @@
32#include <iostream> 34#include <iostream>
33 35
34using namespace std; 36using namespace std;
35FbRun::FbRun(Display *disp, int x, int y, size_t width): 37FbRun::FbRun(int x, int y, size_t width):
36m_font(disp, "fixed"), 38m_font("fixed"),
37m_win(None), 39m_win(None),
38m_display(disp), 40m_display(BaseDisplay::getXDisplay()),
39m_bevel(4), 41m_bevel(4),
40m_gc(None), 42m_gc(DefaultGC(m_display, DefaultScreen(m_display))),
41m_end(false) { 43m_end(false) {
42
43 createWindow(x, y, width + m_bevel, m_font.height()); 44 createWindow(x, y, width + m_bevel, m_font.height());
44 // create GC
45 XGCValues gcv;
46
47 if (m_font.fontStruct())
48 gcv.font = m_font.fontStruct()->fid;
49
50 m_gc = XCreateGC(m_display, m_win, GCFont, &gcv);
51} 45}
52 46
53FbRun::~FbRun() { 47FbRun::~FbRun() {
@@ -72,12 +66,6 @@ bool FbRun::loadFont(const string &fontname) {
72 if (!m_font.load(fontname.c_str())) 66 if (!m_font.load(fontname.c_str()))
73 return false; 67 return false;
74 68
75 // reconfigure m_gc for the new font
76 XGCValues gcv;
77 if (m_font.fontStruct())
78 gcv.font = m_font.fontStruct()->fid;
79 XChangeGC(m_display, m_gc, GCFont, &gcv);
80
81 // resize to fit new font height 69 // resize to fit new font height
82 resize(m_width, m_font.height() + m_bevel); 70 resize(m_width, m_font.height() + m_bevel);
83 return true; 71 return true;
@@ -139,16 +127,7 @@ void FbRun::drawString(int x, int y,
139 const char *text, size_t len) { 127 const char *text, size_t len) {
140 assert(m_win); 128 assert(m_win);
141 assert(m_gc); 129 assert(m_gc);
142 130 m_font.drawText(m_win, DefaultScreen(m_display), m_gc, text, len, x, y);
143 if (FbTk::Font::multibyte()) {
144 XmbDrawString(m_display, m_win, m_font.fontSet(),
145 m_gc, x, y,
146 text, len);
147 } else {
148 XDrawString(m_display, m_win,
149 m_gc, x, y,
150 text, len);
151 }
152} 131}
153 132
154 133