Fix a bug when menu are larger than the screen edge

This commit is contained in:
Emmanuel Lepage Vallee 2014-02-18 22:19:38 -05:00
parent 579f26eb82
commit 1dea6095b0
3 changed files with 41 additions and 41 deletions

View File

@ -48,11 +48,11 @@ local function set_position(self)
--Handle when the menu doesn't fit in the srceen horizontally
if ret.x+self.width > src_geo.x + src_geo.width then
ret.x = src_geo.x + src_geo.width - self.width - parent.width
ret.x = parent.x - self.width
end
-- Handle when the menu doesn't fit on the screen vertically
if ret.y+self.height > src_geo.height then
if ret.y+self.height > src_geo.y + src_geo.height then
ret.y = ret.y - self.height + self.item_height
end
end

View File

@ -39,40 +39,40 @@ local function singalMenu()
return sigMenu
end
sigMenu = radical.context{max_items=10}
sigterm = sigMenu:add_item({text="SIGTERM" , button1 = function() util.spawn("kill -s TERM "..module.client.pid) end,underlay="15"})
sigkill = sigMenu:add_item({text="SIGKILL" , button1 = function() util.spawn("kill -s KILL "..module.client.pid) end,underlay="9"})
sigint = sigMenu:add_item({text="SIGINT" , button1 = function() util.spawn("kill -s INT "..module.client.pid) end,underlay="2"})
sigquit = sigMenu:add_item({text="SIGQUIT" , button1 = function() util.spawn("kill -s QUIT "..module.client.pid) end,underlay="3"})
sigterm = sigMenu:add_item({text="SIGTERM" , button1 = function() util.spawn("kill -s TERM "..module.client.pid);sigMenu.visible = false end,underlay="15"})
sigkill = sigMenu:add_item({text="SIGKILL" , button1 = function() util.spawn("kill -s KILL "..module.client.pid);sigMenu.visible = false end,underlay="9"})
sigint = sigMenu:add_item({text="SIGINT" , button1 = function() util.spawn("kill -s INT "..module.client.pid);sigMenu.visible = false end,underlay="2"})
sigquit = sigMenu:add_item({text="SIGQUIT" , button1 = function() util.spawn("kill -s QUIT "..module.client.pid);sigMenu.visible = false end,underlay="3"})
-- sigMenu:add_widget(radical.widgets.separator())
sig0 = sigMenu:add_item({text="SIG0" , button1 = function() util.spawn("kill -s 0 "..module.client.pid) end,underlay=nil})
sigalrm = sigMenu:add_item({text="SIGALRM" , button1 = function() util.spawn("kill -s ALRM "..module.client.pid) end,underlay="14"})
sighup = sigMenu:add_item({text="SIGHUP" , button1 = function() util.spawn("kill -s HUP "..module.client.pid) end,underlay="1",tooltip="sdfsdfsdf"})
sigpipe = sigMenu:add_item({text="SIGPIPE" , button1 = function() util.spawn("kill -s PIPE "..module.client.pid) end,underlay="13"})
sigpoll = sigMenu:add_item({text="SIGPOLL" , button1 = function() util.spawn("kill -s POLL "..module.client.pid) end,underlay=nil})
sigprof = sigMenu:add_item({text="SIGPROF" , button1 = function() util.spawn("kill -s PROF "..module.client.pid) end,underlay="27"})
sigusr1 = sigMenu:add_item({text="SIGUSR1" , button1 = function() util.spawn("kill -s USR1 "..module.client.pid) end,underlay="10"})
sigusr2 = sigMenu:add_item({text="SIGUSR2" , button1 = function() util.spawn("kill -s USR2 "..module.client.pid) end,underlay="12"})
sigsigvtalrm = sigMenu:add_item({text="SIGVTALRM" , button1 = function() util.spawn("kill -s VTALRM "..module.client.pid) end,underlay=nil})
sigstkflt = sigMenu:add_item({text="SIGSTKFLT" , button1 = function() util.spawn("kill -s STKFLT "..module.client.pid) end,underlay=nil})
sigpwr = sigMenu:add_item({text="SIGPWR" , button1 = function() util.spawn("kill -s PWR "..module.client.pid) end,underlay=nil})
sigwinch = sigMenu:add_item({text="SIGWINCH" , button1 = function() util.spawn("kill -s WINCH "..module.client.pid) end,underlay=nil})
sigchld = sigMenu:add_item({text="SIGCHLD" , button1 = function() util.spawn("kill -s CHLD "..module.client.pid) end,underlay="17"})
sigurg = sigMenu:add_item({text="SIGURG" , button1 = function() util.spawn("kill -s URG "..module.client.pid) end,underlay=nil})
sigtstp = sigMenu:add_item({text="SIGTSTP" , button1 = function() util.spawn("kill -s TSTP "..module.client.pid) end,underlay=nil})
sigttin = sigMenu:add_item({text="SIGTTIN" , button1 = function() util.spawn("kill -s TTIN "..module.client.pid) end,underlay="21"})
sigttou = sigMenu:add_item({text="SIGTTOU" , button1 = function() util.spawn("kill -s TTOU "..module.client.pid) end,underlay="22"})
sigstop = sigMenu:add_item({text="SIGSTOP" , button1 = function() util.spawn("kill -s STOP "..module.client.pid) end,underlay="17"})
sigcont = sigMenu:add_item({text="SIGCONT" , button1 = function() util.spawn("kill -s CONT "..module.client.pid) end,underlay="18"})
sigabrt = sigMenu:add_item({text="SIGABRT" , button1 = function() util.spawn("kill -s ABRT "..module.client.pid) end,underlay="6"})
sigfpe = sigMenu:add_item({text="SIGFPE" , button1 = function() util.spawn("kill -s FPE "..module.client.pid) end,underlay="8"})
sigill = sigMenu:add_item({text="SIGILL" , button1 = function() util.spawn("kill -s ILL "..module.client.pid) end,underlay="4"})
sigsegv = sigMenu:add_item({text="SIGSEGV" , button1 = function() util.spawn("kill -s SEGV "..module.client.pid) end,underlay="11"})
sigtrap = sigMenu:add_item({text="SIGTRAP" , button1 = function() util.spawn("kill -s TRAP "..module.client.pid) end,underlay="5"})
sigsys = sigMenu:add_item({text="SIGSYS" , button1 = function() util.spawn("kill -s SYS "..module.client.pid) end,underlay="12"})
sigemt = sigMenu:add_item({text="SIGEMT" , button1 = function() util.spawn("kill -s EMT "..module.client.pid) end,underlay=nil})
sigbus = sigMenu:add_item({text="SIGBUS" , button1 = function() util.spawn("kill -s BUS "..module.client.pid) end,underlay="7"})
sigxcpu = sigMenu:add_item({text="SIGXCPU" , button1 = function() util.spawn("kill -s XCPU "..module.client.pid) end,underlay=nil})
sigxfsz = sigMenu:add_item({text="SIGXFSZ" , button1 = function() util.spawn("kill -s XFSZ "..module.client.pid) end,underlay=nil})
sig0 = sigMenu:add_item({text="SIG0" , button1 = function() util.spawn("kill -s 0 "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigalrm = sigMenu:add_item({text="SIGALRM" , button1 = function() util.spawn("kill -s ALRM "..module.client.pid);sigMenu.visible = false end,underlay="14"})
sighup = sigMenu:add_item({text="SIGHUP" , button1 = function() util.spawn("kill -s HUP "..module.client.pid);sigMenu.visible = false end,underlay="1",tooltip="sdfsdfsdf"})
sigpipe = sigMenu:add_item({text="SIGPIPE" , button1 = function() util.spawn("kill -s PIPE "..module.client.pid);sigMenu.visible = false end,underlay="13"})
sigpoll = sigMenu:add_item({text="SIGPOLL" , button1 = function() util.spawn("kill -s POLL "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigprof = sigMenu:add_item({text="SIGPROF" , button1 = function() util.spawn("kill -s PROF "..module.client.pid);sigMenu.visible = false end,underlay="27"})
sigusr1 = sigMenu:add_item({text="SIGUSR1" , button1 = function() util.spawn("kill -s USR1 "..module.client.pid);sigMenu.visible = false end,underlay="10"})
sigusr2 = sigMenu:add_item({text="SIGUSR2" , button1 = function() util.spawn("kill -s USR2 "..module.client.pid);sigMenu.visible = false end,underlay="12"})
sigsigvtalrm = sigMenu:add_item({text="SIGVTALRM" , button1 = function() util.spawn("kill -s VTALRM "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigstkflt = sigMenu:add_item({text="SIGSTKFLT" , button1 = function() util.spawn("kill -s STKFLT "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigpwr = sigMenu:add_item({text="SIGPWR" , button1 = function() util.spawn("kill -s PWR "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigwinch = sigMenu:add_item({text="SIGWINCH" , button1 = function() util.spawn("kill -s WINCH "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigchld = sigMenu:add_item({text="SIGCHLD" , button1 = function() util.spawn("kill -s CHLD "..module.client.pid);sigMenu.visible = false end,underlay="17"})
sigurg = sigMenu:add_item({text="SIGURG" , button1 = function() util.spawn("kill -s URG "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigtstp = sigMenu:add_item({text="SIGTSTP" , button1 = function() util.spawn("kill -s TSTP "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigttin = sigMenu:add_item({text="SIGTTIN" , button1 = function() util.spawn("kill -s TTIN "..module.client.pid);sigMenu.visible = false end,underlay="21"})
sigttou = sigMenu:add_item({text="SIGTTOU" , button1 = function() util.spawn("kill -s TTOU "..module.client.pid);sigMenu.visible = false end,underlay="22"})
sigstop = sigMenu:add_item({text="SIGSTOP" , button1 = function() util.spawn("kill -s STOP "..module.client.pid);sigMenu.visible = false end,underlay="17"})
sigcont = sigMenu:add_item({text="SIGCONT" , button1 = function() util.spawn("kill -s CONT "..module.client.pid);sigMenu.visible = false end,underlay="18"})
sigabrt = sigMenu:add_item({text="SIGABRT" , button1 = function() util.spawn("kill -s ABRT "..module.client.pid);sigMenu.visible = false end,underlay="6"})
sigfpe = sigMenu:add_item({text="SIGFPE" , button1 = function() util.spawn("kill -s FPE "..module.client.pid);sigMenu.visible = false end,underlay="8"})
sigill = sigMenu:add_item({text="SIGILL" , button1 = function() util.spawn("kill -s ILL "..module.client.pid);sigMenu.visible = false end,underlay="4"})
sigsegv = sigMenu:add_item({text="SIGSEGV" , button1 = function() util.spawn("kill -s SEGV "..module.client.pid);sigMenu.visible = false end,underlay="11"})
sigtrap = sigMenu:add_item({text="SIGTRAP" , button1 = function() util.spawn("kill -s TRAP "..module.client.pid);sigMenu.visible = false end,underlay="5"})
sigsys = sigMenu:add_item({text="SIGSYS" , button1 = function() util.spawn("kill -s SYS "..module.client.pid);sigMenu.visible = false end,underlay="12"})
sigemt = sigMenu:add_item({text="SIGEMT" , button1 = function() util.spawn("kill -s EMT "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigbus = sigMenu:add_item({text="SIGBUS" , button1 = function() util.spawn("kill -s BUS "..module.client.pid);sigMenu.visible = false end,underlay="7"})
sigxcpu = sigMenu:add_item({text="SIGXCPU" , button1 = function() util.spawn("kill -s XCPU "..module.client.pid);sigMenu.visible = false end,underlay=nil})
sigxfsz = sigMenu:add_item({text="SIGXFSZ" , button1 = function() util.spawn("kill -s XFSZ "..module.client.pid);sigMenu.visible = false end,underlay=nil})
return sigMenu
end
@ -140,8 +140,8 @@ local function new(screen, args)
end
}
itemMaximized = mainMenu:add_item{
text="Fullscreen",
checked=true,
text = "Fullscreen",
checked = true,
button1 = function()
module.client.fullscreen = not module.client.fullscreen
itemMaximized.checked = module.client.fullscreen

View File

@ -11,7 +11,7 @@ local rawset = rawset
local radical = require( "radical" )
local tag = require( "awful.tag" )
local beautiful = require( "beautiful" )
local client = require( "awful.client" )
local client = require( "awful.client" )
local wibox = require( "wibox" )
local client_menu = require("radical.impl.tasklist.client_menu")
@ -20,7 +20,7 @@ local sticky,urgent,instances,module = {},{},{},{}
-- Default button implementation
module.buttons = {
[1] = function (c)
if c == client.focus then
if c == capi.client.focus then
c.minimized = true
else
-- Without this, the following
@ -31,7 +31,7 @@ module.buttons = {
end
-- This will also un-minimize
-- the client, if needed
client.focus = c
capi.client.focus = c
c:raise()
end
end,
@ -46,7 +46,7 @@ module.buttons = {
end,
[5] = function ()
client.focus.byidx(-1)
if client.focus then client.focus:raise() end
if capi.client.focus then client.focus:raise() end
end
}