Newer
Older
{
Cursor no_ptr;
XColor black, dummy;
Pixmap bm_no;
static char bm_no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
if (visible)
XUndefineCursor(disp, winwid->win);
else {
bm_no = XCreateBitmapFromData(disp, winwid->win, bm_no_data, 8, 8);
XAllocNamedColor(disp, DefaultColormapOfScreen(DefaultScreenOfDisplay(disp)), "black", &black, &dummy);
no_ptr = XCreatePixmapCursor(disp, bm_no, bm_no, &black, &black, 0, 0);
XDefineCursor(disp, winwid->win, no_ptr);
}
}
int winwidget_get_width(winwidget winwid)
{
int rect[4];
winwidget_get_geometry(winwid, rect);
Birte Kristina Friesel
committed
return(rect[2]);
int winwidget_get_height(winwidget winwid)
{
int rect[4];
winwidget_get_geometry(winwid, rect);
Birte Kristina Friesel
committed
return(rect[3]);
void winwidget_get_geometry(winwidget winwid, int *rect)
{
unsigned int bw, bp;
Window child;
if (!rect)
return;
XGetGeometry(disp, winwid->win, &root, &(rect[0]), &(rect[1]), (unsigned
int *)&(rect[2]), (unsigned int *)&(rect[3]), &bw, &bp);
XTranslateCoordinates(disp, winwid->win, root, 0, 0, &(rect[0]), &(rect[1]), &child);
/* update the window geometry (in case it's inaccurate) */
winwid->x = rect[0];
winwid->y = rect[1];
winwid->w = rect[2];
winwid->h = rect[3];
Birte Kristina Friesel
committed
return;
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
void winwidget_show_menu(winwidget winwid)
{
int x, y, b;
unsigned int c;
Window r;
XQueryPointer(disp, winwid->win, &r, &r, &x, &y, &b, &b, &c);
if (winwid->type == WIN_TYPE_ABOUT) {
if (!menu_about_win)
feh_menu_init_about_win();
feh_menu_show_at_xy(menu_about_win, winwid, x, y);
} else if (winwid->type == WIN_TYPE_SINGLE) {
if (!menu_single_win)
feh_menu_init_single_win();
feh_menu_show_at_xy(menu_single_win, winwid, x, y);
} else if (winwid->type == WIN_TYPE_THUMBNAIL) {
if (!menu_thumbnail_win)
feh_menu_init_thumbnail_win();
feh_menu_show_at_xy(menu_thumbnail_win, winwid, x, y);
} else if (winwid->type == WIN_TYPE_THUMBNAIL_VIEWER) {
if (!menu_single_win)
feh_menu_init_thumbnail_viewer();
feh_menu_show_at_xy(menu_thumbnail_viewer, winwid, x, y);
} else {
if (!menu_main)
feh_menu_init_main();
feh_menu_show_at_xy(menu_main, winwid, x, y);
}