Re: DPMS event notification

2018-01-19 Thread Nick
(re: https://www.mail-archive.com/xorg@lists.freedesktop.org/msg14972.html)

Hello Taylor,

I have the same problem as you! I want to hook DPMS events in X. Given that you 
never got any
responses to this message, I take it the answer is that it's impossible, but 
it's been half a
decade so I thought I'd ask again: do you, or anyone else on this list, know 
how to hook DPMS state
changes in X?

My use case is a little of the more-things-change-the-more-they-stay-the-same: 
I have a tablet and
I want it to behave like Android: to save power, it should time out and blank 
the screen, or react
to the power button by blanking the screen, and it should either immediately 
lock (using slock or
i3lock) or lock after some idle time blanked (`sleep 300; slock` or `xlock 
-lockdelay 300` are
equally good), and it should disable the mouse and touchscreen while blanked 
because it's just too easy to knock the screen while it's off and wake it back 
up again (and possibly tap a button in the offing).

I can blank the screen and lock it after a delay like this:

xset dpms 0 0 45
xautolock -time 5 -locker "xlock -lockdelay 300"

And make the power button trigger:

# (this is i3 syntax but you could do it with xmodmap or the Gnome GUI or 
whatever)
bindsym XF86PowerOff exec xset dpms force off

It's a bit grungry, because xautolock works in minutes whereas xlock and xset 
work in seconds, and
you have to do a mental subtraction to work out the gap between blanking and 
locking, but it
roughly works.

It's the bit about the touchscreen/mouse that makes this really hard. I found
https://superuser.com/questions/71704/dpms-keep-screen-off-when-lid-shut from 
years ago but there's
no good solutions there. I could add a `xinput set-int-prop $TOUCHSCREEN 
"Device Enabled" 8 "0"` to the
PowerOff trigger, but there's no place to hook it in the same way for the 
timeout because y; maybe I could
use two xautolocks, one to turn off the screen and mouse and one to lock later, 
except xautolock
specifically denies that.
Maybe I could write a "locker" that looks like

#!/bin/sh
xset dpms force off
xinput set-int-prop $TOUCHSCREEN "Device Enabled" 8 "0"
xinput set-int-prop $MOUSE "Device Enabled" 8 "0"
sleep 300
xlock

and have xautolock run that. But I'd need to be careful about trapping signals 
and relaying them to
children, and it still doesn't know when to re-enable the mouse -- which should 
be tied to the
screen being on. It would be infinitely easier if there was a dpms-events and I 
could just run a
script

#!/bin/sh
TOUCHSCREEN=...
MOUSE=...
dpms-events | while read event; do
case $event in
BLANK)
xinput set-int-prop $TOUCHSCREEN "Device Enabled" 8 "0"
xinput set-int-prop $MOUSE "Device Enabled" 8 "0"
;;
UNBLANK)
xinput set-int-prop $TOUCHSCREEN "Device Enabled" 8 "1"
xinput set-int-prop $MOUSE "Device Enabled" 8 "1"
;;
done

And then let X timeout and blank the screen or run "xset force dpms off" at 
will, or "xset force
dpms on" (which is what waking the machine by tapping a button on the keyboard 
or press the power
button should do).

For clues, I went digging into jwz's xscreensaver in order to see how he 
handles it; it turns out
he wrote his own eventing system for screensavers (see 
https://www.jwz.org/xscreensaver/man3.html
-> `open (IN, "xscreensaver-command -watch |"); while () { if 
(m/^(BLANK|LOCK)/) { ...`), but
how that's actually implemented is on top of a huge pile of hacks and 
second-guessing X in order to
handle the mismash of X variants out in the wild. The main() comment
 reads

> * We do this in one of three different ways: periodically
> * checking with the XIdle server extension; selecting key and mouse events
> * on (nearly) all windows; or by waiting for the MIT-SCREEN-SAVER extension
> * to send us a "you are idle" event.

The only thing it has to do with DPMS is forcing the monitor settings to match 
what xscreensaver
thinks they should be
.

So after all that, I'm pretty sure what I'm looking for doesn't exist, but I am 
not very familiar
with X internals so maybe there's a secret DPMSSelectInput to match 
XScreenSaverSelectInput. Anyone got a clue?
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

XLib to XCB Window Manager

2019-03-18 Thread nick
Greetings All,

What is the easiest way to convert xlib error handling in a window manager 
example to xcb.
I'm understand most of is the same but would like to know how this works. My 
forked code 
is here:
https://github.com/xerofoify/basic_wm

Thanks,
Nick
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Help enabling sub-pixel order on Mac. Seeing sub-pixel order Unknown.

2025-02-02 Thread Nick
I'm using xorg from macports on an iMac 27" and am trying to enable
sub-pixel ordering.  I modify ~/.fonts.conf and there is no update to the
variable.  Does anyone have suggestions on how to enable it?

$ xdpyinfo -ext RENDER | grep sub-pixel
Screen 0 (sub-pixel order Unknown)

$ fc-cache

$ vi .fonts.conf



~/.fonts/


false




rgb




Tried this section as well with no effect:


false


rgb



$ xdpyinfo -ext RENDER | grep sub-pixel
Screen 0 (sub-pixel order Unknown)


Re: XInput: Atmel maXTouch Digitizer touch screen

2012-01-09 Thread Nick Dyer

Ben Bucksch wrote:

On 07.01.2012 17:40, Chase Douglas wrote:

Are you sure you are running that version of the driver? Did you change
drivers since you posted your evtest log? The evtest log shows
BTN_TOOL_FINGER being registered, but the upstream driver does not
register it.


The log I posted was from an older Linux kernel. As I wrote back then,
it was a Ubuntu 11.10 kernel 3.0.0-14-generic. I then got linux 3.1.5
and modified the driver there, that's the patch I sent. IIRC (!) I also
tried unchanged linux 3.1.5 and that showed the same problem as the
Ubuntu kernel. So, if I'm not mistaken (see IIRC), my patch did cause a
positive change, but also a negative one.
I am now using linux 3.2 and the touchscreen doesn't work *at all*, but
I use a different .config, so that could be messup here, I'll have to
check.


There is a fair amount of confusion in this thread! The maXTouch chips 
can work in i2c or USB HID mode. The evtest log was from the USB HID 
mode. The atmel_mxt_ts.c driver is only for i2c. So it's impossible that 
the changes that Chase is suggesting would have any effect.


Some more dmesg output would be useful, but it sounds like it's using 
the generic HID driver.


Hardcoding relative/absolute in the driver is a bit of a red herring 
since it depends on the particular hardware device as to what it's being 
used for.

___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


[PATCH xf86-video-nested] Do not error out if XShmAttach fails.

2012-10-15 Thread Nick Alcock
It is normal for XShmAttach to fail with BadAccess if we are connected to a 
remote
X server.  Do not fail in this case.  (Largely copied from x11perf.)

Signed-off-by: Nick Alcock 
---
 src/xlibclient.c | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/xlibclient.c b/src/xlibclient.c
index 1aa3590..cadb87e 100644
--- a/src/xlibclient.c
+++ b/src/xlibclient.c
@@ -95,6 +95,18 @@ NestedClientValidDepth(int depth) {
 return TRUE;
 }
 
+static Bool hadShmError;
+static int (*origErrorHandler)(Display *, XErrorEvent *);
+
+static int ShmErrorHandler(Display *d, XErrorEvent *e) {
+if(e->error_code == BadAccess) {
+   /* Probably a remote display.  Fall back to non-SHM. */
+hadShmError = True;
+return 0;
+} else
+return (*origErrorHandler)(d, e);
+}
+
 static Bool
 NestedClientTryXShm(NestedClientPrivatePtr pPriv, int scrnIndex, int width, 
int height, int depth) {
 int shmMajor, shmMinor;
@@ -147,11 +159,21 @@ NestedClientTryXShm(NestedClientPrivatePtr pPriv, int 
scrnIndex, int width, int
 return FALSE;
 }
 
+XSync(pPriv->display, True);
+hadShmError = False;
+origErrorHandler = XSetErrorHandler(ShmErrorHandler);
 pPriv->img->data = pPriv->shminfo.shmaddr;
 pPriv->shminfo.readOnly = FALSE;
 XShmAttach(pPriv->display, &pPriv->shminfo);
+XSync(pPriv->display, True);
+XSetErrorHandler(origErrorHandler);
+if (hadShmError) {
+xf86DrvMsg(scrnIndex, X_ERROR, "XShmAttach failed.  Dropping XShm 
support.\n");
+shmdt(pPriv->shminfo.shmaddr);
+XDestroyImage(pPriv->img);
+return FALSE;
+}
 pPriv->usingShm = TRUE;
-
 return TRUE;
 }
 
-- 
1.7.12.1.157.geb3194e

___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


Triple monitor, one card; xrandr => xorg.conf

2013-05-25 Thread Nick Urbanik

Dear Folks,

It is trivially easy to set up three monitors with an ATI 5450 video
card.  One is plugged into the VGA, the other into the DVI, and the
last into the DisplayPort connector.

Now I want the display port monitor in the middle, as it is the most
fabulous.

This is easy with xrandr:
xrandr --output DVI-0 --mode 1920x1200 --output DisplayPort-0 --mode
1920x1200 --right-of DVI-0 --output VGA-0 --mode 1600x1200 --right-of
DisplayPort-0

which works like a charm.

Now trying to write that as xorg.conf.  Miserable failure.  And Gnome
3 is unable to start.

So here is the xorg.conf I have tried so far:

Section "Device"
  Identifier "ati-5450"
  Option "Monitor-DVI-0" "left"
  Option "Monitor-DisplayPort-0" "middle"
  Option "Monitor-VGA-0" "right"
EndSection

Section "Monitor"
  Identifier "left"
EndSection

Section "Monitor"
  Identifier "middle"
  Option "RightOf" "left"
EndSection

Section "Monitor"
  Identifier "right"
  Option "RightOf" "middle"
EndSection

and here is the output of xrandr:
$ xrandr
Screen 0: minimum 320 x 200, current 5440 x 1200, maximum 8192 x 8192
DisplayPort-0 connected 1920x1200+1920+0 (normal left inverted right x axis y 
axis) 518mm x 324mm
   1920x1200  60.0*+
   1920x1080  60.0  
   1600x1200  60.0  
   1680x1050  60.0  
   1280x1024  60.0  
   1280x960   60.0  
   1024x768   60.0  
   800x60060.3  
   640x48060.0  
   720x40070.1  
DVI-0 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm

   1920x1200  60.0*+
   1920x1080  50.0 60.0  
   1600x1200  60.0  
   1680x1050  59.9  
   1280x1024  60.0  
   1440x900   59.9  
   1280x960   60.0  
   1280x800   59.9  
   1280x720   50.0 60.0  
   1024x768   60.0  
   800x60060.3 56.2  
   720x57650.0  
   720x48059.9  
   640x48060.0  
VGA-0 connected 1600x1200+3840+0 (normal left inverted right x axis y axis) 408mm x 306mm

   1600x1200  60.0*+
   1280x1024  75.0 60.0  
   1280x960   60.0  
   1152x864   75.0  
   1024x768   75.1 70.1 60.0  
   832x62474.6  
   800x60072.2 75.0 60.3 56.2  
   640x48072.8 75.0 66.7 60.0  
   720x40070.1  


Any suggestions on how to make a working xorg.conf?

Fedora 18 x86_64:
xorg-x11-server-Xorg-1.13.3-3.fc18.x86_64
xorg-x11-drv-ati-7.0.0-0.9.20121015gitbd9e2c064.fc18.x86_64
$ xrandr --version
xrandr program version   1.4.0
Server reports RandR version 1.4
--
Nick Urbanik http://nicku.org   ni...@nicku.org
GPG: 7FFA CDC7 5A77 0558 DC7A 790A 16DF EC5B BB9D 2C24 ID: BB9D2C24
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


Re: Triple monitor, one card; xrandr => xorg.conf

2013-05-25 Thread Nick Urbanik

Dear Etienne,

Thank you for taking time to share your thoughts.

On 25/05/13 07:50 -0700, animelo...@gmail.com wrote:

On Sat, 25 May 2013 23:00:43 +1000
Nick Urbanik  wrote:

Any suggestions on how to make a working xorg.conf?


you should probably delete /etc/X11/xorg.conf and use automatic
configuration. It worked for me as for making intel 965GM card
switching between LVDS1 and VGA1 output.


Sorry, perhaps I have been insufficiently clear on what my aim is.

1. If you look at the xrandr command (which, as I said, works like a
   charm), you will see that I want to put the DisplayPort-0 in the
   middle, the DVI-0 on the left, the VGA-0 on the right.

2. Automatic configuration works just fine, with DisplayPort-0 on the
   left, DVI-0 in the middle, VGA-0 on the right.  But I don't want
   that order, because the DisplayPort-0 monitor is new and fabulous,
   while the other two monitors are old and not so good.

3. I am trying to make the xorg.conf do what the xrandr command does,
   when X starts up.

Perhaps I need to specify that the DVI-0 should be on the left?

Hmm: here's something from Xorg.0.log:
[ 16343.789] (==) Using config file: "/etc/X11/xorg.conf"
[ 16343.789] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[ 16343.789] (==) No Layout section.  Using the first Screen section.
[ 16343.789] (==) No screen section available. Using defaults.
[ 16343.789] (**) |-->Screen "Default Screen Section" (0)
[ 16343.789] (**) |   |-->Monitor ""
[ 16343.789] (==) No device specified for screen "Default Screen Section".
Using the first device section listed.
[ 16343.789] (**) |   |-->Device "ati-5450"
[ 16343.789] (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.

So do I need to make a Screen section?
--
Nick Urbanik http://nicku.org   ni...@nicku.org
GPG: 7FFA CDC7 5A77 0558 DC7A 790A 16DF EC5B BB9D 2C24 ID: BB9D2C24
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


Re: Triple monitor, one card; xrandr => xorg.conf

2013-05-28 Thread Nick Urbanik

Dear Folks,

On 26/05/13 08:52 +1000, Nick Urbanik wrote:

Sorry, perhaps I have been insufficiently clear on what my aim is.

1. If you look at the xrandr command (which, as I said, works like a
  charm), you will see that I want to put the DisplayPort-0 in the
  middle, the DVI-0 on the left, the VGA-0 on the right.

2. Automatic configuration works just fine, with DisplayPort-0 on the
  left, DVI-0 in the middle, VGA-0 on the right.  But I don't want
  that order, because the DisplayPort-0 monitor is new and fabulous,
  while the other two monitors are old and not so good.

3. I am trying to make the xorg.conf do what the xrandr command does,
  when X starts up.

Perhaps I need to specify that the DVI-0 should be on the left?


Making a tiny amount of progress: with this configuration, X can start
(a nice change from some previous attempts!), and lightdm shows the
screens in the correct order!  Hooray!

But when I log in, the behaviour is rather odd; the VGA appears on the
left; the DisplayPort is next, with the DVI mirroring the DisplayPort.
My xrandr command gets it back into the desired state and order.  But
I still wish that I could achieve the same result with xorg.conf as
with the xrandr command, right from the beginning.

Advice most welcome.

Section "ServerLayout"
   Identifier "home"
   Screen "left-screen" 0 0
   Screen "middle-screen" RightOf "left-screen"
   Screen "right-screen"  RightOf "middle-screen"
EndSection

Section "Device"
   Identifier "ati-5450"
   #Screen 0
   #Screen 1
   #Screen 2
   Option "Monitor-DVI-0" "left"
   Option "Monitor-DisplayPort-0" "middle"
   Option "Monitor-VGA-0" "right"
   #BusID "PCI:01:00.0"
   Driver "radeon"
EndSection

Section "Screen"
   Identifier "left-screen"
   Device "ati-5450"
   Monitor "left"
EndSection

Section "Screen"
   Identifier "middle-screen"
   Device "ati-5450"
   Monitor "middle"
EndSection

Section "Screen"
   Identifier "right-screen"
   Device "ati-5450"
   Monitor "right"
EndSection

Section "Monitor"
   Identifier "left"
   Option "LeftOf" "DisplayPort-0"
EndSection

Section "Monitor"
   Identifier "middle"
   Option "RightOf" "DVI-0"
EndSection

Section "Monitor"
   Identifier "right"
   Option "RightOf" "DisplayPort-0"
EndSection
--
Nick Urbanik http://nicku.org   ni...@nicku.org
GPG: 7FFA CDC7 5A77 0558 DC7A 790A 16DF EC5B BB9D 2C24 ID: BB9D2C24
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


Re: Triple monitor, one card; xrandr => xorg.conf

2013-05-28 Thread Nick Urbanik

Dear Alex,

Thank you so much for taking the time to make a thoughtful reply.

On 29/05/13 00:21 -0400, Alex Deucher wrote:

On Sat, May 25, 2013 at 9:00 AM, Nick Urbanik  wrote:
You can skip the above lines if you just change the monitor
identifiers to match your output names.  Also, I'm not sure that
having relative locations for every monitor will work correctly.  For
the farthest left one, leave out the orientation.


EndSection


Try something like this:


Section "Device"
 Identifier "ati-5450"
EndSection

Section "Monitor"
  Identifier "DVI-0"
EndSection

Section "Monitor"
  Identifier "DisplayPort-0"
  Option "RightOf" "DVI-0"
EndSection


Yes, that works for when lightdm starts: the screens are in the right
order.  Its simplicity is beautiful (the xorg.conf you wrote).

But when I log into XFCE 4.10, then it does as described in my last
post on this topic: VGA-0 on the left, then DVI-0, then at 1900 pixels
from the left of VGA-0, which takes us into the territory of DVI-0,
then DisplayPort-0 continues, mirroring DVI-0 for all but 150 pixels
on the left and 150 on the right.  Is it XFCE being naughty?

As before, my xrandr command makes everything pop into the right place
and behave properly, but I'd like to have things "just work".

As a probably unrelated side issue, neither gdm nor Gnome 3 start up,
regardless of presence or shape of xorg.conf.
--
Nick Urbanik http://nicku.org   ni...@nicku.org
GPG: 7FFA CDC7 5A77 0558 DC7A 790A 16DF EC5B BB9D 2C24 ID: BB9D2C24
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com