Bug 187907 - Restore resolution after application crash
Summary: Restore resolution after application crash
Status: RESOLVED UPSTREAM
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Unspecified
: NOR wishlist
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-23 08:14 UTC by BRULE Herman
Modified: 2009-11-01 00:06 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description BRULE Herman 2009-03-23 08:14:36 UTC
Version:            (using Devel)
Installed from:    Compiled sources

Hello, when game crash linux native or wine game, that's stay resolution at moment when have crashed. Please detect crash or close the application for restore the good resolution who have before open this game.
Thanks.
Comment 1 Dario Andres 2009-10-22 00:57:43 UTC
I think this is out of KDE's scope, have you tried to report this to Wine developers ?
Regards
Comment 2 BRULE Herman 2009-10-22 11:34:17 UTC
Yes, but I thinks it to KDE at do the right resolution, because it have kwin, it can by detect when full screen application with low resolution is closed (bug or not) and restore the right resolution.
Else need adapt: wine, gtk, ... and all lib which use X.
Comment 3 Martin Flöser 2009-10-31 20:51:38 UTC
kwin is not responsible for screen resolution management and kwin doesn't know if an application changes the resolution or not and doesn't know if it crashed or not. This is out of scope of kwin and probably out of scope of all KDE workspace applications. This has to be fixed in the offending application and we should not add hackish workarounds for bugs in other parts.
Comment 4 BRULE Herman 2009-10-31 21:03:08 UTC
I thinks the event of screen resolution can by detected (plasma detect it for rearange plasmoid?) et list of application can by get (ksysguard) and I thinks it's possible.
It's usefull feature for kde, asked by lot of beginner.
Comment 5 Martin Flöser 2009-10-31 22:00:43 UTC
(In reply to comment #4)
> I thinks the event of screen resolution can by detected
Of course it can be detected. But how should an application know which other application caused the resolution to change, how should the application know that the app should return the resolution and how should it detect that the other application crashed?

Just think of a crash in systemsettings? Would the user expect that the resolution is reset just because systemsettings (maybe even in a different module) crashed? An application cannot know if the resolution changed due to an application requesting it or due to a user choice.

It may be a useful feature but it's in my opinion also an impossible feature. And really KDE should not workaround buggy applications. An application which changes the resolution is buggy.
Comment 6 Thomas Lübking 2009-10-31 22:22:04 UTC
a) Martin is right. You request KWin to determine external intentions.
b) Trying to be smart on this will most likely introduce unwanted side effects (i.e. reverting wanted resolutions) because of a)
c) work around buggy apps like this

-- snip ---
#!/bin/bash

# store resolution id
mode=$(($(xrandr -q | grep -n '*' | cut -d':' -f1) - 3))

# store composite state
composite=$(qdbus org.kde.kwin /KWin compositingActive)

#turn off composite
$composite && qdbus org.kde.kwin /KWin toggleCompositing

#run game etc., must not go to bg
wine broken_app

#restore resolution /before/ starting composition
xrandr -s $mode

# restart composite in case, but don't stop it
$composite && ! $(qdbus org.kde.kwin /KWin compositingActive) &&  qdbus org.kde.kwin /KWin toggleCompositing

-- end snip --
Comment 7 BRULE Herman 2009-10-31 22:30:52 UTC
> Of course it can be detected. But how should an application know which other
application caused the resolution to change, how should the application know
that the app should return the resolution and how should it detect that the
other application crashed?

It can by detect my multiple method (dmesg under linux, survey process list).
And change of resolution is detected by plasma because it reorder my desktop icon when application crash under wine.
I thinks I particular of wine application crash, because the application which can by crash easy && change resolution is game.
But it's available too for all X only application (native game under linux).

I hard is detect which application change the resolution, after it's easy should only detect when this application is crashed/closed.
Linux is more structured of other OS (windows), and I thinks it's possible directly or via library. And other OS (windows) do it. I thinks nothing is impossible, the problem it's just detect when application change resolution (talk with X server?).

I thinks too it's the only way for attract the hard gamer under linux (community which can influence on common people)

KDE desktop is not closed environment, it interact with external environment via multiple lib (I thinks particular to hald)

For my the solution is:
1) detect change os resolution, and the the pid linked (of the application)
2) if application crash (see in monitor process list && dmesg for linux) restore the resolution
Comment 8 BRULE Herman 2009-10-31 22:33:48 UTC
Add detection of application crash it usefull for informe the user when the application is crash, and can usze kbug for repport the backtrace of other kind os application (gtk, X, ...)
Comment 9 Dario Andres 2009-10-31 22:35:31 UTC
About comment 8, that is a bit offtopic, but I think it can't be achieved without using some hacks like LD_PRELOAD=somelib ...
Comment 10 Thomas Lübking 2009-11-01 00:06:39 UTC
(In reply to comment #7)
> For my the solution is:
> 1) detect change os resolution, and the the pid linked (of the application)

X11 provides only a loose binding between Wid and pid by NETWM conventions, and i really can't find a pid field in XConfigureEvent

> 2) if application crash (see in monitor process list && dmesg for linux)
> restore the resolution
even /if/ kwin could detect whether some arbitrary application just crashed (definition? sigsev? - my dmesg doesn't log sigsevs. what about bsd? would you want to poll /proc anyway?)
who says that just because the related process got a sigsev, this means that the resolution change was unintended?
e.g. some apps (belive it or not) could sigsev on exit due to bad deconstructors - that does not mean all their actions were invalid.

Sum up:
- I guess we all agree that the orginal bug is external (the res. changing and crashing app)
- The detecion of such incident (if possible at all) would have to be heuristical.
- As soon as KWin takes some action on this, it will be responsible for the outcome, including all side effects -> bugs or annoyances triggered by this workaround would be KWin bugs :-(

- Workarounds should be as tight as possible to prevent any interference/side effects
-> the workaround should happen on the broken process
--> if you /know/ that a bunch of (esp. wine games) apps is "broken" in this and other regards and you cannot fix them you should work towards them by presenting an environment they can deal with and restore the former environment after they exited.

btw:
a) trust me, you want to start all wine games through scripts that prepare a certain environment, disable or force aa or aniso settings - depending on the game... this just is not windows, purchase cedega in doubt
b) i guess "hard gamers" would rather request DX11 support first - or EAX4... ;-P