prepare searching and highlighting a pid
This commit is contained in:
committed by
Simon Steinbeiss
parent
807a429eb4
commit
0f73bce47e
@@ -769,3 +769,8 @@ xtm_process_tree_view_get_model (XtmProcessTreeView *treeview)
|
|||||||
{
|
{
|
||||||
return GTK_TREE_MODEL (treeview->model);
|
return GTK_TREE_MODEL (treeview->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xtm_process_tree_view_highlight_pid(XtmProcessTreeView *treeview, guint pid) {
|
||||||
|
//TBD: search and highlight the given pid
|
||||||
|
}
|
||||||
|
|||||||
@@ -54,5 +54,6 @@ GtkWidget * xtm_process_tree_view_new (void);
|
|||||||
void xtm_process_tree_view_get_sort_column_id (XtmProcessTreeView *treeview, gint *sort_column_id, GtkSortType *sort_type);
|
void xtm_process_tree_view_get_sort_column_id (XtmProcessTreeView *treeview, gint *sort_column_id, GtkSortType *sort_type);
|
||||||
void xtm_process_tree_view_set_filter (XtmProcessTreeView *treeview, const gchar *cmd_filter);
|
void xtm_process_tree_view_set_filter (XtmProcessTreeView *treeview, const gchar *cmd_filter);
|
||||||
GtkTreeModel * xtm_process_tree_view_get_model (XtmProcessTreeView *treeview);
|
GtkTreeModel * xtm_process_tree_view_get_model (XtmProcessTreeView *treeview);
|
||||||
|
void xtm_process_tree_view_highlight_pid (XtmProcessTreeView *treeview, guint pid);
|
||||||
|
|
||||||
#endif /* !PROCESS_TREE_VIEW_H */
|
#endif /* !PROCESS_TREE_VIEW_H */
|
||||||
|
|||||||
@@ -138,7 +138,8 @@ Select_Window (Display *dpy, int screen)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
xwininfo_clicked_cb (GtkButton *button, gpointer user_data) {
|
xwininfo_clicked_cb (GtkButton *button, gpointer user_data) {
|
||||||
Window window;
|
XtmProcessWindow *window = (XtmProcessWindow *) user_data;
|
||||||
|
Window selected_window;
|
||||||
Display *dpy = NULL;
|
Display *dpy = NULL;
|
||||||
XID id = None;
|
XID id = None;
|
||||||
|
|
||||||
@@ -151,28 +152,29 @@ xwininfo_clicked_cb (GtkButton *button, gpointer user_data) {
|
|||||||
int status;
|
int status;
|
||||||
unsigned long bytes_after;
|
unsigned long bytes_after;
|
||||||
|
|
||||||
int pid = -1;
|
guint pid = 0;
|
||||||
|
|
||||||
dpy = XOpenDisplay (NULL);
|
dpy = XOpenDisplay (NULL);
|
||||||
window = Select_Window (dpy, 0);
|
selected_window = Select_Window (dpy, 0);
|
||||||
if (window) {
|
if (selected_window) {
|
||||||
window = XmuClientWindow (dpy, window);
|
selected_window = XmuClientWindow (dpy, selected_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
atom_NET_WM_PID = XInternAtom(dpy, "_NET_WM_PID", False);
|
atom_NET_WM_PID = XInternAtom(dpy, "_NET_WM_PID", False);
|
||||||
|
|
||||||
status = XGetWindowProperty(dpy, window, atom_NET_WM_PID, 0, (~0L),
|
status = XGetWindowProperty(dpy, selected_window, atom_NET_WM_PID, 0, (~0L),
|
||||||
False, AnyPropertyType, &actual_type,
|
False, AnyPropertyType, &actual_type,
|
||||||
&actual_format, &_nitems, &bytes_after,
|
&actual_format, &_nitems, &bytes_after,
|
||||||
&prop);
|
&prop);
|
||||||
if (status == BadWindow) {
|
if (status == BadWindow) {
|
||||||
g_warning("window id # 0x%lx does not exists!", window);
|
g_warning("window id # 0x%lx does not exists!", selected_window);
|
||||||
} if (status != Success) {
|
} if (status != Success) {
|
||||||
g_warning("XGetWindowProperty failed!");
|
g_warning("XGetWindowProperty failed!");
|
||||||
} else {
|
} else {
|
||||||
if (_nitems > 0) {
|
if (_nitems > 0) {
|
||||||
pid = (int) *((unsigned long*)prop);
|
pid = (guint) *((unsigned long*)prop);
|
||||||
g_warning("PID: %d", pid);
|
g_warning("PID: %d", pid);
|
||||||
|
xtm_process_tree_view_highlight_pid(XTM_PROCESS_TREE_VIEW (window->treeview), pid);
|
||||||
} else {
|
} else {
|
||||||
g_warning("No Pid found");
|
g_warning("No Pid found");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user