subwindow.c File Reference

Handling windows of selected threads. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <l4/dope/dopelib.h>
#include <l4/util/atomic.h>
#include <l4/util/bitops.h>
#include <l4/log/l4log.h>
#include "threadinfo.h"
#include "subwindow.h"
#include "jtop.h"
#include "startup.h"
#include "service.h"
#include "scope.h"
#include "debug.h"

Functions

static void press_callback (dope_event *ev, void *arg)
static void sort_callback (dope_event *ev, void *arg)
 Callback for setting sort-orders in windows.
static void select_all_callback (dope_event *ev, void *arg)
 Callback for Top "X" select-button press.
static void disp_insert (load_display_t *disp)
 Insert a disp into the list.
static load_display_t * disp_unlink (int id)
 Remove a disp from the list.
load_display_t * disp_by_nr (int id)
 Return a locked display by its number.
static load_display_t * disp_alloc (void)
 Allocate a new display.
static void disp_free (load_display_t *disp)
 Free a load display with all its items.
int subwindow_create (int id_parent)
 Generate a new window from the selected threads of a parent.
static void subwindow_close (int id)
static void zap_threads (int id)
static void subwindow_scroll (int id, int dir)
static void subwindow_scrollpage (int id, int dir)
static void subwindow_scrolledge (int id, int which)
static void subwindow_toggletimedisp (int id)
int do_nonmouse_event (dope_event *ev, void *arg)
 Check if it is a non-mouse event and call press_callback if so.
void subwindow_name_callback (dope_event *ev, void *arg)
 Callback for name-label press.
void subwindow_thread_callback (dope_event *ev, void *arg)
 Callback for thread-label press.

Variables

load_display_t main_disp
os_mutex disp_list_lock
static long id_mask = -1


Detailed Description

Handling windows of selected threads.

Date:
01/15/2004
Author:
Jork Loeser <jork.loeser@inf.tu-dresden.de>
Locking order: list first (list_lock()), disp then (lock_disp()).

Function Documentation

static load_display_t* disp_alloc ( void   )  [static]

Allocate a new display.

This function returns a new display structure. The fields win, grid and name are already filled in. If it is called the first time (i.e., list_count==0), main_disp is returned.

Postcondition:
the returned display is in init state, unlocked, and not linked
Return values:
!0 Ok
<0 Error

References gen_name().

Referenced by subwindow_create().

load_display_t* disp_by_nr ( int  id  ) 

Return a locked display by its number.

This function uses the list-lock.

Referenced by scope_create(), select_all_callback(), select_callback(), sort_callback(), subwindow_create(), subwindow_name_callback(), and subwindow_thread_callback().

static void disp_free ( load_display_t *  disp  )  [static]

Free a load display with all its items.

Precondition:
No references to the display are hanging around, and that the disp is not on the list anymore.

disp is unlocked.

Referenced by subwindow_create().

static void disp_insert ( load_display_t *  disp  )  [static]

Insert a disp into the list.

This function uses the list-lock

Referenced by subwindow_create().

static load_display_t* disp_unlink ( int  id  )  [static]

Remove a disp from the list.

This function removes the load-display specified by idx from the list.

This function uses the list-lock.

Postcondition:
The disp is locked, state is LD_STATE_INIT

int do_nonmouse_event ( dope_event *  ev,
void *  arg 
) [inline]

Check if it is a non-mouse event and call press_callback if so.

If the event is not a mouse-event, it is probably a keyboard-event, meant for the press_callback. An event-specific bind (press-mouse, press-keyboard) would be nice here.

Returns:
1 if it was a non-mouse event, 0 else

Referenced by select_all_callback(), sort_callback(), subwindow_name_callback(), and subwindow_thread_callback().

void select_all_callback ( dope_event *  ev,
void *  arg 
) [static]

Callback for Top "X" select-button press.

Parameters:
arg a jtop_callback_t type, which win and idx set. win is the window-id, idx is the nr of the row (0..)
As we get all pres-events of the label (including keyboard), we have to check this first and conditionally jump to press_callback.

References disp_by_nr(), and do_nonmouse_event().

Referenced by subwindow_create().

static void sort_callback ( dope_event *  ev,
void *  arg 
) [static]

Callback for setting sort-orders in windows.

Parameters:
arg a jtop_callback_t type, which win and idx set. win is the window-id, idx is the sort_t

References disp_by_nr(), do_nonmouse_event(), and update_values().

Referenced by subwindow_create().

int subwindow_create ( int  id_parent  ) 

Generate a new window from the selected threads of a parent.

No reference is held to the parent, so the parent can be destroyed when this function returned.

Parameters:
id_parent Id of the parent disp. Used for getting the switch- setting. Set it to -1 to create the root-window.

References disp_alloc(), disp_by_nr(), disp_free(), disp_insert(), select_all_callback(), sort_callback(), and update_values().

void subwindow_name_callback ( dope_event *  ev,
void *  arg 
)

Callback for name-label press.

Left key toggles selection, right key disables.

Parameters:
arg a jtop_callback_t type, which win and idx set. win is the window-id, idx is the nr of the row (0..)
As we get all pres-events of the label (including keyboard), we have to check this first and conditionally jump to press_callback.

References disp_by_nr(), and do_nonmouse_event().

void subwindow_thread_callback ( dope_event *  ev,
void *  arg 
)

Callback for thread-label press.

This callback selects threads that are similar to the clicked one. With L4, this is the same task, with Linux, this is something else.

Left key toggles selection, right key disables.

Parameters:
arg a jtop_callback_t type, which win and idx set. win is the window-id, idx is the nr of the row (0..)
As we get all pres-events of the label (including keyboard), we have to check this first and conditionally jump to press_callback.

References disp_by_nr(), and do_nonmouse_event().


Generated on Wed Apr 11 06:39:34 2012 for JTop - Top for DROPS by  doxygen 1.5.6