aboutsummaryrefslogtreecommitdiff
path: root/util/fbrun
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-27 14:04:12 (GMT)
committerfluxgen <fluxgen>2003-08-27 14:04:12 (GMT)
commitb039f2076e81db88768e3c1935988baaadcf374d (patch)
treea751448f535314ff9986124dfd67b4cbebae265f /util/fbrun
parentf81055e4af3d73947734727b331ad84850b47100 (diff)
downloadfluxbox-b039f2076e81db88768e3c1935988baaadcf374d.zip
fluxbox-b039f2076e81db88768e3c1935988baaadcf374d.tar.bz2
using GContext and FbPixmap
Diffstat (limited to 'util/fbrun')
-rw-r--r--util/fbrun/FbRun.cc24
-rw-r--r--util/fbrun/FbRun.hh16
2 files changed, 21 insertions, 19 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc
index 701f985..f2ebbac 100644
--- a/util/fbrun/FbRun.cc
+++ b/util/fbrun/FbRun.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: FbRun.cc,v 1.18 2003/08/27 00:20:19 fluxgen Exp $ 22// $Id: FbRun.cc,v 1.19 2003/08/27 14:04:12 fluxgen Exp $
23 23
24#include "FbRun.hh" 24#include "FbRun.hh"
25 25
@@ -55,13 +55,12 @@ FbRun::FbRun(int x, int y, size_t width):
55 m_font("fixed"), 55 m_font("fixed"),
56 m_display(FbTk::App::instance()->display()), 56 m_display(FbTk::App::instance()->display()),
57 m_bevel(4), 57 m_bevel(4),
58 m_gc(DefaultGC(m_display, DefaultScreen(m_display))), 58 m_gc(*this),
59 m_end(false), 59 m_end(false),
60 m_current_history_item(0), 60 m_current_history_item(0),
61 m_cursor(XCreateFontCursor(FbTk::App::instance()->display(), XC_xterm)), 61 m_cursor(XCreateFontCursor(FbTk::App::instance()->display(), XC_xterm)) {
62 m_pixmap(0) { 62
63 63 setGC(m_gc.gc());
64 setGC(m_gc);
65 setCursor(m_cursor); 64 setCursor(m_cursor);
66 // setting nomaximize in local resize 65 // setting nomaximize in local resize
67 resize(width, font().height() + m_bevel); 66 resize(width, font().height() + m_bevel);
@@ -77,20 +76,23 @@ FbRun::FbRun(int x, int y, size_t width):
77 XFree(class_hint); 76 XFree(class_hint);
78#ifdef HAVE_XPM 77#ifdef HAVE_XPM
79 Pixmap mask = 0; 78 Pixmap mask = 0;
79 Pixmap pm;
80 XpmCreatePixmapFromData(m_display, 80 XpmCreatePixmapFromData(m_display,
81 window(), 81 window(),
82 fbrun_xpm, 82 fbrun_xpm,
83 &m_pixmap, 83 &pm,
84 &mask, 84 &mask,
85 0); // attribs 85 0); // attribs
86 if (mask != 0) 86 if (mask != 0)
87 XFreePixmap(m_display, mask); 87 XFreePixmap(m_display, mask);
88
89 m_pixmap = pm;
88#endif // HAVE_XPM 90#endif // HAVE_XPM
89 91
90 if (m_pixmap) { 92 if (m_pixmap.drawable()) {
91 XWMHints wmhints; 93 XWMHints wmhints;
92 wmhints.flags = IconPixmapHint; 94 wmhints.flags = IconPixmapHint;
93 wmhints.icon_pixmap = m_pixmap; 95 wmhints.icon_pixmap = m_pixmap.drawable();
94 XSetWMHints(m_display, window(), &wmhints); 96 XSetWMHints(m_display, window(), &wmhints);
95 } 97 }
96} 98}
@@ -98,8 +100,6 @@ FbRun::FbRun(int x, int y, size_t width):
98 100
99FbRun::~FbRun() { 101FbRun::~FbRun() {
100 hide(); 102 hide();
101 if (m_pixmap != 0)
102 XFreePixmap(FbTk::App::instance()->display(), m_pixmap);
103} 103}
104 104
105void FbRun::run(const std::string &command) { 105void FbRun::run(const std::string &command) {
@@ -187,7 +187,7 @@ bool FbRun::loadFont(const string &fontname) {
187} 187}
188 188
189void FbRun::setForegroundColor(const FbTk::Color &color) { 189void FbRun::setForegroundColor(const FbTk::Color &color) {
190 XSetForeground(m_display, m_gc, color.pixel()); 190 m_gc.setForeground(color);
191} 191}
192 192
193void FbRun::setTitle(const string &title) { 193void FbRun::setTitle(const string &title) {
diff --git a/util/fbrun/FbRun.hh b/util/fbrun/FbRun.hh
index f6a544c..7856bdd 100644
--- a/util/fbrun/FbRun.hh
+++ b/util/fbrun/FbRun.hh
@@ -19,15 +19,17 @@
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.hh,v 1.13 2003/08/27 00:19:57 fluxgen Exp $ 22// $Id: FbRun.hh,v 1.14 2003/08/27 14:04:12 fluxgen Exp $
23 23
24#ifndef FBRUN_HH 24#ifndef FBRUN_HH
25#define FBRUN_HH 25#define FBRUN_HH
26 26
27#include "EventHandler.hh" 27#include "FbTk/EventHandler.hh"
28#include "Font.hh" 28#include "FbTk/Font.hh"
29#include "FbWindow.hh" 29#include "FbTk/FbWindow.hh"
30#include "TextBox.hh" 30#include "FbTk/TextBox.hh"
31#include "FbTk/GContext.hh"
32#include "FbTk/FbPixmap.hh"
31 33
32#include <string> 34#include <string>
33#include <vector> 35#include <vector>
@@ -84,14 +86,14 @@ private:
84 FbTk::Font m_font; ///< font used to draw command text 86 FbTk::Font m_font; ///< font used to draw command text
85 Display *m_display; ///< display connection 87 Display *m_display; ///< display connection
86 int m_bevel; 88 int m_bevel;
87 GC m_gc; ///< graphic context 89 FbTk::GContext m_gc; ///< graphic context
88 bool m_end; ///< marks when this object is done 90 bool m_end; ///< marks when this object is done
89 std::vector<std::string> m_history; ///< history list of commands 91 std::vector<std::string> m_history; ///< history list of commands
90 size_t m_current_history_item; ///< holds current position in command history 92 size_t m_current_history_item; ///< holds current position in command history
91 std::string m_history_file; ///< holds filename for command history file 93 std::string m_history_file; ///< holds filename for command history file
92 Cursor m_cursor; 94 Cursor m_cursor;
93 95
94 Pixmap m_pixmap; 96 FbTk::FbPixmap m_pixmap;
95}; 97};
96 98
97#endif // FBRUN_HH 99#endif // FBRUN_HH