From 6c9169d4cd2188ecb4759a5aac4fde3117aa4f47 Mon Sep 17 00:00:00 2001 From: sabetts Date: Wed, 24 Sep 2003 19:42:03 +0000 Subject: (EXTRA_DIST): add clickframe.pl (pkgdata_DATA): likewise --- contrib/Makefile.am | 4 +-- contrib/clickframe.pl | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 contrib/clickframe.pl (limited to 'contrib') diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 160a69b..a58bfaa 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -1,4 +1,4 @@ bin_SCRIPTS = rpws -pkgdata_DATA = ratpoison.el split.sh genrpbindings rpws allwindows.sh -EXTRA_DIST = ratpoison.el split.sh genrpbindings rpws allwindows.sh +pkgdata_DATA = ratpoison.el split.sh genrpbindings rpws allwindows.sh clickframe.pl +EXTRA_DIST = ratpoison.el split.sh genrpbindings rpws allwindows.sh clickframe.pl diff --git a/contrib/clickframe.pl b/contrib/clickframe.pl new file mode 100644 index 0000000..02d1f1a --- /dev/null +++ b/contrib/clickframe.pl @@ -0,0 +1,73 @@ +#!/usr/bin/perl + +# clickframe.pl is a utility to switch frames by clicking the +# mouse. While it does not require xbindkeys, it has been tested with +# it. You must apply the patch below to xbindkeys for this script to +# work. Add an entry like this to your .xbindkeysrc file: +# +# # bind C-mouse1 to ratpoison click focus hack +# "perl /home/sabetts/src/ratpoison/contrib/clickframe.pl &" +# control + b:1 +# +# REQUIRES xbindkeys-1.6.4 with the following patch applied: +# +# --- xbindkeys.c~ 2003-04-06 08:43:27.000000000 -0700 +# +++ xbindkeys.c 2003-09-24 11:46:20.000000000 -0700 +# @@ -143,7 +143,15 @@ +# +# +# +# +void +# +add_button_env (int x, int y) +# +{ +# + char *env; +# +# + env = malloc (256 * sizeof (char)); +# + snprintf (env, 255, "XBINDKEYS_BUTTONLOC=%d,%d", x, y); +# + putenv (env); +# +} +# +# +# static void +# @@ -240,6 +248,8 @@ +# | Button1Mask | Button2Mask | Button3Mask +# | Button4Mask | Button5Mask); +# +# + add_button_env (e.xbutton.x, e.xbutton.y); +# + +# for (i = 0; i < nb_keys; i++) +# { +# if (keys[i].type == BUTTON && keys[i].event_type == PRESS) +# @@ -266,6 +276,8 @@ +# | Button1Mask | Button2Mask | Button3Mask +# | Button4Mask | Button5Mask); + +# + add_button_env (e.xbutton.x, e.xbutton.y); +# + +# for (i = 0; i < nb_keys; i++) +# { +# if (keys[i].type == BUTTON && keys[i].event_type == RELEASE) +# + +# Make sure the env vars are there +$ENV{XBINDKEYS_BUTTONLOC} || die '$XBINDKEYS_BUTTONLOC not bound'; +$ENV{RATPOISON} || die '$RATPOISON not bound'; + +# Parse the required environment variables +$ratpoison_bin = $ENV{RATPOISON}; +($x_loc,$y_loc) = split(/,/, $ENV{XBINDKEYS_BUTTONLOC}); + +# Rip the frameset from ratpoison +$frameset = `$ratpoison_bin -c fdump`; +@framelist = split(/,/,$frameset); + +# Check each frame to see if the mouse was clicked in that frame. +# FIXME: it goes through all the frames even if it found one. +foreach $frame (@framelist) { + ($num,$left,$top,$width,$height,$win,$access) = split(/ /,$frame); + if ($x_loc > $left && $x_loc < $left + $width && $y_loc > $top && $y_loc < $top + $height) { + # Tell ratpoison to switch to the frame + print "User clicked in frame $num\n"; + system ("$ratpoison_bin -c \"fselect $num\""); + } +} -- cgit v1.2.3