Esempio n. 1
0
void configure_notify(XConfigureEvent ev)
{
	struct TrayIcon *ti;
	struct Point sz;
	XWindowAttributes xwa;
	if (ev.window == tray_data.tray) {
		/* Tray window was resized */
		/* TODO: distinguish between synthetic and real configure notifies */
		/* TODO: catch rejected configure requests */
		/* XXX: Geometry stuff is a mess. Geometry
		 * is specified in slots, but almost always is 
		 * stored in pixels... */
		LOG_TRACE(("tray window geometry from event: %ux%u+%d+%d\n", ev.width, ev.height, ev.x, ev.y));
		/* Sometimes, configure notifies come too late, so we fetch real geometry ourselves */
		XGetWindowAttributes(tray_data.dpy, tray_data.tray, &xwa);
		x11_get_window_abs_coords(tray_data.dpy, tray_data.tray, &tray_data.xsh.x, &tray_data.xsh.y);
		LOG_TRACE(("tray window geometry from X11 calls: %dx%d+%d+%d\n", xwa.width, xwa.height, tray_data.xsh.x, tray_data.xsh.y));
		tray_data.xsh.width = xwa.width;
		tray_data.xsh.height = xwa.height;
		/* Update icons positions */
		/* XXX: internal API is bad. example below */
		icon_list_forall(&layout_translate_to_window);
		embedder_update_positions(True);
		/* Adjust window background if necessary */
		tray_update_bg(False);
		tray_refresh_window(True);
		tray_update_window_strut();
		scrollbars_update();
	} else if ((ti = icon_list_find(ev.window)) != NULL) { /* Some icon has resized its window */
		/* KDE icons are not allowed to change their size. Reset icon size. */
		if (ti->cmode == CM_KDE || settings.kludge_flags & KLUDGE_FORCE_ICONS_SIZE) {
			embedder_reset_size(ti);
			return;
		}
		if (settings.kludge_flags & KLUDGE_FORCE_ICONS_SIZE) return;
		/* Get new window size */
		if (!x11_get_window_size(tray_data.dpy, ti->wid, &sz.x, &sz.y)) {
			embedder_unembed(ti);
			return;
		}
		LOG_TRACE(("icon 0x%x was resized, new size: %ux%u, old size: %ux%u\n", ev.window, 
					sz.x, sz.y, ti->l.wnd_sz.x, ti->l.wnd_sz.y));
		/* Check if the size has really changed */
		if (sz.x == ti->l.wnd_sz.x && sz.y == ti->l.wnd_sz.y) return;
		ti->l.wnd_sz = sz;
		ti->is_resized = True;
		/* Do the job */
		layout_handle_icon_resize(ti);
		embedder_refresh(ti);
#ifdef DEBUG
		print_icon_data(ti);
#endif
		embedder_update_positions(False);
		tray_update_window_props();
#ifdef DEBUG
		dump_tray_status();
#endif
	}
}
Esempio n. 2
0
/* Remove icon from the tray */
void remove_icon(Window w)
{
	struct TrayIcon *ti;
	//char *name;
	/* Ignore false alarms */
	if ((ti = icon_list_find(w)) == NULL) return;
	dump_tray_status();
	embedder_unembed(ti);
	xembed_unembed(ti);
	//layout_remove(ti);
	icon_list_free(ti);
	LOG_INFO(("removed icon %s (wid 0x%x)\n", x11_get_window_name(tray_data.dpy, ti->wid, "<unknown>"), w));

	refresh_icons_later(FALSE);

	dump_tray_status();
}
Esempio n. 3
0
/* Remove a destroyed icon from the tray */
void destroy_icon(Window w)
{
	struct TrayIcon *ti;
	//char *name;
	/* Ignore false alarms */
	if ((ti = icon_list_find(w)) == NULL) return;
	dump_tray_status();
	ti->is_destroyed = True;
	embedder_unembed(ti);
	xembed_unembed(ti);
	//layout_remove(ti);
	icon_list_free(ti);
	LOG_INFO(("destroy icon (wid 0x%x)\n", w));

	refresh_icons_later(FALSE);

	dump_tray_status();
}
Esempio n. 4
0
/* Remove icon from the tray */
void remove_icon(Window w)
{
	struct TrayIcon *ti;
	char *name;
	/* Ignore false alarms */
	if ((ti = icon_list_find(w)) == NULL) return;
	dump_tray_status();
	embedder_unembed(ti);
	xembed_unembed(ti);
	layout_remove(ti);
	icon_list_free(ti);
	LOG_INFO(("removed icon %s (wid 0x%x)\n",
				x11_get_window_name(tray_data.dpy, ti->wid, "<unknown>"), 
				w));
	/* no need to call embedde_update_positions(), as
	 * scrollbars_click(SB_WND_MAX) will call it */
	/* XXX: maybe we need a different name for this
	 * routine instad of passing cryptinc constant? */
	scrollbars_click(SB_WND_MAX);
	tray_update_window_props();
	dump_tray_status();
}