summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc95
1 files changed, 84 insertions, 11 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index dfe92fb..a81ee9e 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.260 2004/01/11 16:06:22 fluxgen Exp $ 25// $Id: Screen.cc,v 1.261 2004/01/16 11:47:07 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -485,6 +485,11 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
485 int geom_h = 10; 485 int geom_h = 10;
486 int geom_w = 100; // just initial, will be fixed in render 486 int geom_w = 100; // just initial, will be fixed in render
487 487
488 // create geometry window
489
490 int pos_h = 10;
491 int pos_w = 100; // just initial, will be fixed in render
492
488 XSetWindowAttributes attrib; 493 XSetWindowAttributes attrib;
489 unsigned long mask = CWBorderPixel | CWColormap | CWSaveUnder; 494 unsigned long mask = CWBorderPixel | CWColormap | CWSaveUnder;
490 attrib.border_pixel = winFrameTheme().border().color().pixel(); 495 attrib.border_pixel = winFrameTheme().border().color().pixel();
@@ -502,6 +507,15 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
502 507
503 renderGeomWindow(); 508 renderGeomWindow();
504 509
510 m_pos_window =
511 XCreateWindow(disp, rootWindow().window(),
512 0, 0, pos_w, pos_h, winFrameTheme().border().width(), rootWindow().depth(),
513 InputOutput, rootWindow().visual(), mask, &attrib);
514 pos_visible = false;
515 pos_pixmap = 0;
516
517 renderPosWindow();
518
505 // setup workspaces and workspace menu 519 // setup workspaces and workspace menu
506 520
507 workspacemenu.reset(createMenu("")); 521 workspacemenu.reset(createMenu(""));
@@ -633,6 +647,9 @@ BScreen::~BScreen() {
633 if (geom_pixmap != None) 647 if (geom_pixmap != None)
634 imageControl().removeImage(geom_pixmap); 648 imageControl().removeImage(geom_pixmap);
635 649
650 if (pos_pixmap != None)
651 imageControl().removeImage(pos_pixmap);
652
636 removeWorkspaceNames(); 653 removeWorkspaceNames();
637 654
638 Workspaces::iterator w_it = m_workspaces_list.begin(); 655 Workspaces::iterator w_it = m_workspaces_list.begin();
@@ -731,6 +748,7 @@ void BScreen::update(FbTk::Subject *subj) {
731 // if another signal is added later, will need to differentiate here 748 // if another signal is added later, will need to differentiate here
732 749
733 renderGeomWindow(); 750 renderGeomWindow();
751 renderPosWindow();
734} 752}
735 753
736FbTk::Menu *BScreen::createMenu(const std::string &label) { 754FbTk::Menu *BScreen::createMenu(const std::string &label) {
@@ -800,6 +818,7 @@ void BScreen::reconfigure() {
800 m_menutheme->frameFont().setAntialias(*resource.antialias); 818 m_menutheme->frameFont().setAntialias(*resource.antialias);
801 819
802 renderGeomWindow(); 820 renderGeomWindow();
821 renderPosWindow();
803 822
804 //reconfigure menus 823 //reconfigure menus
805 workspacemenu->reconfigure(); 824 workspacemenu->reconfigure();
@@ -2238,21 +2257,21 @@ void BScreen::showPosition(int x, int y) {
2238 if (!doShowWindowPos()) 2257 if (!doShowWindowPos())
2239 return; 2258 return;
2240 2259
2241 if (! geom_visible) { 2260 if (! pos_visible) {
2242 if (hasXinerama()) { 2261 if (hasXinerama()) {
2243 unsigned int head = getCurrHead(); 2262 unsigned int head = getCurrHead();
2244 2263
2245 m_geom_window.move(getHeadX(head) + (getHeadWidth(head) - m_geom_window.width()) / 2, 2264 m_pos_window.move(getHeadX(head) + (getHeadWidth(head) - m_pos_window.width()) / 2,
2246 getHeadY(head) + (getHeadHeight(head) - m_geom_window.height()) / 2); 2265 getHeadY(head) + (getHeadHeight(head) - m_pos_window.height()) / 2);
2247 2266
2248 } else { 2267 } else {
2249 m_geom_window.move((width() - m_geom_window.width()) / 2, (height() - m_geom_window.height()) / 2); 2268 m_pos_window.move((width() - m_pos_window.width()) / 2, (height() - m_pos_window.height()) / 2);
2250 } 2269 }
2251 2270
2252 m_geom_window.show(); 2271 m_pos_window.show();
2253 m_geom_window.raise(); 2272 m_pos_window.raise();
2254 2273
2255 geom_visible = true; 2274 pos_visible = true;
2256 } 2275 }
2257 char label[256]; 2276 char label[256];
2258 2277
@@ -2260,9 +2279,9 @@ void BScreen::showPosition(int x, int y) {
2260 I18n::instance()->getMessage(FBNLS::ScreenSet, FBNLS::ScreenPositionFormat, 2279 I18n::instance()->getMessage(FBNLS::ScreenSet, FBNLS::ScreenPositionFormat,
2261 "X: %4d x Y: %4d"), x, y); 2280 "X: %4d x Y: %4d"), x, y);
2262 2281
2263 m_geom_window.clear(); 2282 m_pos_window.clear();
2264 2283
2265 winFrameTheme().font().drawText(m_geom_window.window(), 2284 winFrameTheme().font().drawText(m_pos_window.window(),
2266 screenNumber(), 2285 screenNumber(),
2267 winFrameTheme().labelTextFocusGC(), 2286 winFrameTheme().labelTextFocusGC(),
2268 label, strlen(label), 2287 label, strlen(label),
@@ -2273,6 +2292,14 @@ void BScreen::showPosition(int x, int y) {
2273} 2292}
2274 2293
2275 2294
2295void BScreen::hidePosition() {
2296 if (pos_visible) {
2297 m_pos_window.hide();
2298 pos_visible = false;
2299 }
2300}
2301
2302
2276void BScreen::showGeometry(unsigned int gx, unsigned int gy) { 2303void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
2277 if (!doShowWindowPos()) 2304 if (!doShowWindowPos())
2278 return; 2305 return;
@@ -2370,7 +2397,7 @@ bool BScreen::doSkipWindow(const WinClient &winclient, int opts) {
2370void BScreen::renderGeomWindow() { 2397void BScreen::renderGeomWindow() {
2371 2398
2372 const char *s = I18n::instance()->getMessage(FBNLS::ScreenSet, 2399 const char *s = I18n::instance()->getMessage(FBNLS::ScreenSet,
2373 FBNLS::ScreenPositionLength, 2400 FBNLS::ScreenGeometryLength,
2374 "W: 0000 x H: 0000"); 2401 "W: 0000 x H: 0000");
2375 int l = strlen(s); 2402 int l = strlen(s);
2376 2403
@@ -2409,6 +2436,52 @@ void BScreen::renderGeomWindow() {
2409 2436
2410} 2437}
2411 2438
2439
2440void BScreen::renderPosWindow() {
2441
2442 const char *s = I18n::instance()->getMessage(FBNLS::ScreenSet,
2443 FBNLS::ScreenPositionLength,
2444 "0: 0000 x 0: 0000");
2445 int l = strlen(s);
2446
2447 int pos_h = winFrameTheme().font().height() + winFrameTheme().bevelWidth()*2;
2448 int pos_w = winFrameTheme().font().textWidth(s, l) + winFrameTheme().bevelWidth()*2;
2449 m_pos_window.resize(pos_w, pos_h);
2450
2451 m_pos_window.setBorderWidth(winFrameTheme().border().width());
2452 m_pos_window.setBorderColor(winFrameTheme().border().color());
2453
2454
2455 Pixmap tmp = pos_pixmap;
2456
2457 if (winFrameTheme().labelFocusTexture().type() & FbTk::Texture::PARENTRELATIVE) {
2458 if (!winFrameTheme().titleFocusTexture().usePixmap()) {
2459 pos_pixmap = None;
2460 m_pos_window.setBackgroundColor(winFrameTheme().titleFocusTexture().color());
2461 } else {
2462 pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(),
2463 winFrameTheme().titleFocusTexture());
2464 m_pos_window.setBackgroundPixmap(pos_pixmap);
2465 }
2466 } else {
2467 if (!winFrameTheme().labelFocusTexture().usePixmap()) {
2468 pos_pixmap = None;
2469 m_pos_window.setBackgroundColor(winFrameTheme().labelFocusTexture().color());
2470 } else {
2471 pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(),
2472 winFrameTheme().labelFocusTexture());
2473 m_pos_window.setBackgroundPixmap(pos_pixmap);
2474 }
2475 }
2476
2477 if (tmp)
2478 imageControl().removeImage(tmp);
2479
2480}
2481
2482
2483
2484
2412/** 2485/**
2413 Called when a set of watched modifiers has been released 2486 Called when a set of watched modifiers has been released
2414*/ 2487*/