oocairo.image_surface_create_from_png TO awesome.load_image

Replaced all references to image_surface_create_from_png to
awesome.load_image

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Arvydas Sidorenko 2012-01-29 15:17:51 +01:00 committed by Uli Schlachter
parent 9451fec6f1
commit e052bd99b0
7 changed files with 17 additions and 12 deletions

View File

@ -28,6 +28,7 @@ local capi = {
mouse = mouse, mouse = mouse,
client = client, client = client,
keygrabber = keygrabber, keygrabber = keygrabber,
awesome = awesome,
oocairo = oocairo } oocairo = oocairo }
@ -543,7 +544,7 @@ function entry(parent, args)
if args.icon then if args.icon then
icon = args.icon icon = args.icon
if type(icon) == "string" then if type(icon) == "string" then
icon = capi.oocairo.image_surface_create_from_png(icon) icon = capi.awesome.load_image(icon)
end end
end end
if icon then if icon then
@ -580,7 +581,7 @@ function entry(parent, args)
if args.theme.submenu_icon then if args.theme.submenu_icon then
submenu = wibox.widget.imagebox() submenu = wibox.widget.imagebox()
submenu:set_image( submenu:set_image(
capi.oocairo.image_surface_create_from_png( capi.awesome.load_image(
args.theme.submenu_icon)) args.theme.submenu_icon))
else else
submenu = wibox.widget.textbox() submenu = wibox.widget.textbox()

View File

@ -9,6 +9,7 @@ local type = type
local button = require("awful.button") local button = require("awful.button")
local imagebox = require("wibox.widget.imagebox") local imagebox = require("wibox.widget.imagebox")
local capi = { mouse = mouse, local capi = { mouse = mouse,
awesome = awesome,
oocairo = oocairo } oocairo = oocairo }
module("awful.widget.button") module("awful.widget.button")
@ -21,7 +22,7 @@ function new(args)
if not args or not args.image then return end if not args or not args.image then return end
local img_release local img_release
if type(args.image) == "string" then if type(args.image) == "string" then
img_release = capi.oocairo.image_surface_create_from_png(args.image) img_release = capi.awesome.load_image(args.image)
elseif type(args.image) == "userdata" and args.image.type and args.image:type() == "cairo_surface_t" then elseif type(args.image) == "userdata" and args.image.type and args.image:type() == "cairo_surface_t" then
img_release = args.image img_release = args.image
elseif type(args.image) == "userdata" and args.image._NAME and args.image._NAME == "cairo surface object" then elseif type(args.image) == "userdata" and args.image._NAME and args.image._NAME == "cairo surface object" then

View File

@ -6,7 +6,7 @@
-- Grab environment we need -- Grab environment we need
local capi = { screen = screen, local capi = { screen = screen,
oocairo = oocairo, awesome = awesome,
client = client } client = client }
local type = type local type = type
local setmetatable = setmetatable local setmetatable = setmetatable
@ -53,7 +53,7 @@ function taglist_label(t, args)
local seltags = sel:tags() local seltags = sel:tags()
for _, v in ipairs(seltags) do for _, v in ipairs(seltags) do
if v == t then if v == t then
bg_image = capi.oocairo.image_surface_create_from_png(taglist_squares_sel) bg_image = capi.awesome.load_image(taglist_squares_sel)
bg_resize = taglist_squares_resize == "true" bg_resize = taglist_squares_resize == "true"
is_selected = true is_selected = true
break break
@ -64,7 +64,7 @@ function taglist_label(t, args)
if not is_selected then if not is_selected then
local cls = t:clients() local cls = t:clients()
if #cls > 0 and taglist_squares_unsel then if #cls > 0 and taglist_squares_unsel then
bg_image = capi.oocairo.image_surface_create_from_png(taglist_squares_unsel) bg_image = capi.awesome.load_image(taglist_squares_unsel)
bg_resize = taglist_squares_resize == "true" bg_resize = taglist_squares_resize == "true"
end end
for k, c in pairs(cls) do for k, c in pairs(cls) do
@ -87,7 +87,7 @@ function taglist_label(t, args)
if tag.geticon(t) and type(tag.geticon(t)) == "image" then if tag.geticon(t) and type(tag.geticon(t)) == "image" then
icon = tag.geticon(t) icon = tag.geticon(t)
elseif tag.geticon(t) then elseif tag.geticon(t) then
icon = capi.oocairo.image_surface_create_from_png(tag.geticon(t)) icon = capi.awesome.load_image(tag.geticon(t))
end end
return text, bg_color, bg_image, icon return text, bg_color, bg_image, icon

View File

@ -12,6 +12,7 @@ local unpack = unpack
local pairs = pairs local pairs = pairs
local type = type local type = type
local capi = { local capi = {
awesome = awesome,
oocairo = oocairo oocairo = oocairo
} }
@ -63,7 +64,7 @@ end
-- @param file The filename of the file -- @param file The filename of the file
-- @return a cairo pattern object -- @return a cairo pattern object
function create_png_pattern(file) function create_png_pattern(file)
local image = capi.oocairo.image_surface_create_from_png(file) local image = capi.awesome.load_image(file)
return capi.oocairo.pattern_create_for_surface(image) return capi.oocairo.pattern_create_for_surface(image)
end end

View File

@ -14,6 +14,7 @@ local capi = { screen = screen,
awesome = awesome, awesome = awesome,
dbus = dbus, dbus = dbus,
timer = timer, timer = timer,
awesome = awesome,
oocairo = oocairo } oocairo = oocairo }
local button = require("awful.button") local button = require("awful.button")
local util = require("awful.util") local util = require("awful.util")
@ -400,7 +401,7 @@ function notify(args)
iconmargin = wibox.layout.margin(iconbox, margin, margin, margin, margin) iconmargin = wibox.layout.margin(iconbox, margin, margin, margin, margin)
local img = icon local img = icon
if type(icon) == "string" then if type(icon) == "string" then
img = capi.oocairo.image_surface_create_from_png(icon) img = capi.awesome.load_image(icon)
else else
img = icon img = icon
end end

View File

@ -11,6 +11,7 @@ local layout_base = require("wibox.layout.base")
local setmetatable = setmetatable local setmetatable = setmetatable
local pairs = pairs local pairs = pairs
local type = type local type = type
local awesome = awesome
module("wibox.widget.background") module("wibox.widget.background")
@ -91,7 +92,7 @@ function set_bgimage(box, image)
local image = image local image = image
if type(image) == "string" then if type(image) == "string" then
image = oocairo.image_surface_create_from_png(image) image = awesome.load_image(image)
end end
box.bgimage = image box.bgimage = image

View File

@ -4,13 +4,13 @@
-- @release @AWESOME_VERSION@ -- @release @AWESOME_VERSION@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
local oocairo = require("oocairo")
local base = require("wibox.widget.base") local base = require("wibox.widget.base")
local setmetatable = setmetatable local setmetatable = setmetatable
local pairs = pairs local pairs = pairs
local type = type local type = type
local pcall = pcall local pcall = pcall
local print = print local print = print
local awesome = awesome
module("wibox.widget.imagebox") module("wibox.widget.imagebox")
@ -74,7 +74,7 @@ function set_image(box, image)
local image = image local image = image
if type(image) == "string" then if type(image) == "string" then
local success, result = pcall(oocairo.image_surface_create_from_png, image) local success, result = pcall(awesome.load_image, image)
if not success then if not success then
print("Error while reading '" .. image .. "': " .. result) print("Error while reading '" .. image .. "': " .. result)
return false return false