void
LauncherApplication::endForceUrgent()
{
    bool wasUrgent = urgent();
    m_forceUrgent = false;
    if (wasUrgent != urgent()) {
        Q_EMIT urgentChanged(urgent());
    }
}
void
LauncherApplication::beginForceUrgent(int duration)
{
    bool wasUrgent = urgent();
    m_forceUrgent = true;
    if (wasUrgent != urgent()) {
        Q_EMIT urgentChanged(urgent());
    }
    QTimer::singleShot(duration, this, SLOT(endForceUrgent()));
}
Exemple #3
0
void AttackTask::onUpdate() {
	CGroup *group = firstGroup();

	if (group->isMicroing() && group->isIdle()) {
		targetAlt = -1; // for sure
		group->micro(false);
	}

	if (isMoving) {
		/* Keep tracking the target */
		pos = ai->cbc->GetUnitPos(target);

		float3 gpos = group->pos();
		float dist = gpos.distance2D(pos);
		float range = group->getRange();

		/* See if we can attack our target already */
		if (dist <= range) {
			bool canAttack = true;

			/*
			// for ground units prevent shooting across hill...
			if ((group->cats&AIR).none()) {
				// FIXME: improve
				dist = ai->pathfinder->getPathLength(*group, pos);
				canAttack = (dist <= range * 1.1f);
			}
			*/

			if (canAttack) {
				if ((group->cats&BUILDER).any())
					group->reclaim(target);
				else
					group->attack(target);
				isMoving = false;
				ai->pathfinder->remove(*group);
				group->micro(true);
			}
		}
	}

	/* See if we can attack a target we found on our path */
	if (!(group->isMicroing() || urgent())) {
		if ((group->cats&BUILDER).any())
			resourceScan(); // builders should not be too aggressive
		else
			enemyScan(targetAlt);
	}
}
void
LauncherApplication::activate()
{
    if (urgent()) {
        show();
    } else if (active()) {
        if (windowCountOnCurrentWorkspace() > 0 && windowCount() > 1) {
            spread(windowCount() > windowCountOnCurrentWorkspace());
        }
    } else if (running() && has_visible_window()) {
        show();
    } else {
        launch();
    }
}
void
LauncherApplication::updateBamfApplicationDependentProperties()
{
    activeChanged(active());
    runningChanged(running());
    urgentChanged(urgent());
    nameChanged(name());
    iconChanged(icon());
    applicationTypeChanged(application_type());
    desktopFileChanged(desktop_file());
    m_launching_timer.stop();
    launchingChanged(launching());
    updateHasVisibleWindow();
    updateWindowCount();
    fetchIndicatorMenus();
}
Exemple #6
0
static void
notify(PurpleConversation *conv, const char *fmt, ...)
{
	GntWidget *window;
	GntToast *toast;
	char *str;
	int h, w, i;
	va_list args;

	if (purple_prefs_get_bool(PREFS_BEEP))
		beep();

	if (conv != NULL) {
		FinchConv *fc = FINCH_CONV(conv);
		if (gnt_widget_has_focus(fc->window))
			return;
	}

#ifdef HAVE_X11
	if (purple_prefs_get_bool(PREFS_URGENT))
		urgent();
#endif

	window = gnt_vbox_new(FALSE);
	GNT_WIDGET_SET_FLAGS(window, GNT_WIDGET_TRANSIENT);
	GNT_WIDGET_UNSET_FLAGS(window, GNT_WIDGET_NO_BORDER);

	va_start(args, fmt);
	str = g_strdup_vprintf(fmt, args);
	va_end(args);

	gnt_box_add_widget(GNT_BOX(window),
			gnt_label_new_with_format(str, GNT_TEXT_FLAG_HIGHLIGHT));

	g_free(str);
	gnt_widget_size_request(window);
	gnt_widget_get_size(window, &w, &h);
	for (i = 0; i < MAX_COLS && gpsy[i] + h >= getmaxy(stdscr) ; ++i)
		;
	if (i >= MAX_COLS) {
		purple_debug_warning("GntGf", "Dude, that's way too many popups\n");
		gnt_widget_destroy(window);
		return;
	}

	toast = g_new0(GntToast, 1);
	toast->window = window;
	toast->column = i;
	gpsy[i] += h;
	if (w > gpsw[i]) {
		if (i == 0)
			gpsw[i] = w;
		else
			gpsw[i] = gpsw[i - 1] + w + 1;
	}

	if (i == 0 || (w + gpsw[i - 1] >= getmaxx(stdscr))) {
		/* if it's going to be too far left, overlap. */
		gnt_widget_set_position(window, getmaxx(stdscr) - w - 1,
				getmaxy(stdscr) - gpsy[i] - 1);
	} else {
		gnt_widget_set_position(window, getmaxx(stdscr) - gpsw[i - 1] - w - 1,
				getmaxy(stdscr) - gpsy[i] - 1);
	}
	gnt_widget_draw(window);

	toast->timer = purple_timeout_add_seconds(4, (GSourceFunc)remove_toaster, toast);
	toasters = g_list_prepend(toasters, toast);
}