[BeFree CVS] panel/src ChangeLog,1.5,1.6 task.h,1.1.1.1,1.2 taskicon.cpp,1.2,1.3 tasklistwindow.cpp,
Status: Planning
Brought to you by:
plfiorini
|
From: Pier L. F. <plf...@us...> - 2005-01-08 10:17:33
|
Update of /cvsroot/befree/panel/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13563 Modified Files: ChangeLog task.h taskicon.cpp tasklistwindow.cpp x11panelwindow.cpp xutils.cpp xutils.h Log Message: Fixes Index: xutils.h =================================================================== RCS file: /cvsroot/befree/panel/src/xutils.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- xutils.h 7 Jan 2005 03:27:54 -0000 1.3 +++ xutils.h 8 Jan 2005 10:17:20 -0000 1.4 @@ -52,7 +52,7 @@ Window xutils_get_group_leader(Window win); QString xutils_get_name(Window win); QString xutils_get_class(Window win); -QPixmap xutils_get_leader_icon(Window leader); +Q_ULONG xutils_get_pid(Window win); QPixmap xutils_get_window_icon(Window win); bool xutils_skip_taskbar(Window win); Index: x11panelwindow.cpp =================================================================== RCS file: /cvsroot/befree/panel/src/x11panelwindow.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- x11panelwindow.cpp 7 Jan 2005 03:27:54 -0000 1.3 +++ x11panelwindow.cpp 8 Jan 2005 10:17:20 -0000 1.4 @@ -96,11 +96,14 @@ } else { - icon = xutils_get_leader_icon(leader); + icon = xutils_get_window_icon(leader); + if (icon.isNull()) + icon = xutils_get_window_icon(win); // Create a new task task = new Task; task->setId(leader); + task->setPid(xutils_get_pid(leader)); // Set name QString className = xutils_get_class(leader); @@ -112,7 +115,8 @@ task->setIcon(icon); // Add this window to its task - TaskWindow taskWin(task, name, icon); + TaskWindow taskWin(task, name, xutils_get_window_icon(win)); + taskWin.setId(win); task->addWindow(taskWin); // Append task to the list Index: ChangeLog =================================================================== RCS file: /cvsroot/befree/panel/src/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ChangeLog 7 Jan 2005 03:27:54 -0000 1.5 +++ ChangeLog 8 Jan 2005 10:17:20 -0000 1.6 @@ -1,10 +1,11 @@ 2005-01-07 Pier Luigi Fiorini <pie...@mo...> + * xutils.cpp (xutils_get_leader_icon): + First check for icon name (using BIconTheme). + * x11panelwindow.cpp (X11PanelWindow::tasksList): First check for leader icon name. - * xutils.cpp (xutils_get_leader_icon): Get leader icon. - * x11panelwindow.cpp (X11PanelWindow::tasksList): Skip if window has "skip taskbar". Index: xutils.cpp =================================================================== RCS file: /cvsroot/befree/panel/src/xutils.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- xutils.cpp 7 Jan 2005 03:27:54 -0000 1.4 +++ xutils.cpp 8 Jan 2005 10:17:20 -0000 1.5 @@ -184,6 +184,7 @@ return true; } + bool xutils_get_cardinal_atom(Window win, Atom atom, Q_ULONG *val) { Atom type = None; @@ -472,6 +473,17 @@ return retval; } +Q_ULONG xutils_get_pid(Window win) +{ + Q_ULONG ret; + Atom atom = XInternAtom(qt_xdisplay(), "_NET_WM_PID", False); + + if (!xutils_get_cardinal_atom(win, atom, &ret)) + return 0; + + return ret; +} + /* * Heavily inspired by KDE core code in * netwm.cpp, readIcon() function. @@ -574,29 +586,24 @@ return true; } -QPixmap xutils_get_leader_icon(Window leader) +QPixmap xutils_get_window_icon(Window win) { - Atom atom = XInternAtom(qt_xdisplay(), "_NET_WM_ICON_NAME", False); + WindowIcons icons; + QPixmap retval; - QString iconName = xutils_get_utf8_string_atom(leader, atom); + // First, check for icon name + Atom atom = XInternAtom(qt_xdisplay(), "_NET_WM_ICON_NAME", False); + QString iconName = xutils_get_utf8_string_atom(win, atom); if (!iconName.isEmpty()) { QIcon icon = BNeptuneXDG::iconTheme()->loadIcon(iconName); - QPixmap retval = icon.pixmap(Qt::LargeIconSize, QIcon::Normal); + QPixmap ret = icon.pixmap(Qt::LargeIconSize, QIcon::Normal); // Return pixmap only if it's not null - if (!retval.isNull()) - return retval; + if (!ret.isNull()) + return ret; } - return xutils_get_window_icon(leader); -} - -QPixmap xutils_get_window_icon(Window win) -{ - WindowIcons icons; - QPixmap retval; - // Search first available icon if (xutils_get_icons(win, &icons)) { @@ -618,7 +625,8 @@ // Image setup image.setAlphaBuffer(true); - image = image.scale(48, 48); + if ((w != 48) || (h != 48)) + image = image.scale(48, 48); // Get pixmap from image retval = image; Index: tasklistwindow.cpp =================================================================== RCS file: /cvsroot/befree/panel/src/tasklistwindow.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- tasklistwindow.cpp 5 Jan 2005 20:05:22 -0000 1.1.1.1 +++ tasklistwindow.cpp 8 Jan 2005 10:17:20 -0000 1.2 @@ -49,7 +49,6 @@ // Layout fLayout = new QVBoxLayout(this); - fLayout->setResizeMode(QLayout::Fixed); fLayout->setMargin(2); fLayout->addWidget(fTitle); @@ -61,15 +60,7 @@ fLayout->addWidget(view); } - //fLayout->addWidget(fActions); - -#if 0 - // Set fixed width - Q_INT32 w = BApplication::desktop()->geometry().width(); - Q_INT32 h = BApplication::desktop()->geometry().height(); - setFixedWidth(w / 10); - setFixedHeight(h / 10); -#endif + fLayout->addWidget(fActions); } TaskListWindow::~TaskListWindow() Index: taskicon.cpp =================================================================== RCS file: /cvsroot/befree/panel/src/taskicon.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- taskicon.cpp 7 Jan 2005 02:11:40 -0000 1.2 +++ taskicon.cpp 8 Jan 2005 10:17:20 -0000 1.3 @@ -44,16 +44,22 @@ void TaskIcon::enterEvent(QEvent *event) { + // Update task list window geometry + fTaskList->updateGeometry(); + QPoint pos = mapToGlobal(QPoint(0, 0)); QPoint mouse = QCursor::pos(); QSize size = sizeHint() + contentsMarginSize(); QRect screen = BApplication::desktop()->screenGeometry(pos); + QWidget *parent = parentWidget(); + Q_UINT32 parentHeight = parent ? parent->rect().height() : 0; + // Set coordinates if (pos.x() + size.width() > screen.right()) pos.setX(mouse.x() - size.width()); if (pos.x() < screen.left()) pos.setX(mouse.x()); - pos.setY(pos.y() - rect().height()); + pos.setY(screen.bottom() - fTaskList->rect().height() - parentHeight); // Show task list window fTaskList->move(pos); Index: task.h =================================================================== RCS file: /cvsroot/befree/panel/src/task.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- task.h 5 Jan 2005 14:30:04 -0000 1.1.1.1 +++ task.h 8 Jan 2005 10:17:20 -0000 1.2 @@ -36,6 +36,9 @@ void setId(Q_ULONG id); Q_ULONG id() const; + void setPid(Q_ULONG pid); + Q_ULONG pid() const; + void setName(const QString &name); QString name() const; @@ -46,7 +49,7 @@ QList<TaskWindow> windows() const; private: - Q_ULONG fId; + Q_ULONG fId, fPid; QString fName; QPixmap fIcon; QList<TaskWindow> fWindows; @@ -62,6 +65,16 @@ fId = id; } +inline Q_ULONG Task::pid() const +{ + return fPid; +} + +inline void Task::setPid(Q_ULONG pid) +{ + fPid = pid; +} + inline QString Task::name() const { return fName; |