Remove overflow warning surpression

This commit is contained in:
Jarcode
2019-09-08 16:38:46 -07:00
parent 859bfb0b31
commit 04ca255cd2
5 changed files with 48 additions and 17 deletions

View File

@@ -42,7 +42,7 @@ Note that versions since `2.0` use Meson for the build system, although the `Mak
**Ubuntu/Debian users:** the following command ensures you have all the needed packages and headers to compile GLava with the default feature set: **Ubuntu/Debian users:** the following command ensures you have all the needed packages and headers to compile GLava with the default feature set:
```bash ```bash
sudo apt-get install libpulse0 libpulse-dev libxext6 libxext-dev libxrender-dev libxcomposite-dev liblua5.3-dev liblua5.3 lua-lgi lua-filesystem libobs0 libobs-dev meson build-essential gcc sudo apt-get install libgl1-mesa-dev libpulse0 libpulse-dev libxext6 libxext-dev libxrender-dev libxcomposite-dev liblua5.3-dev liblua5.3 lua-lgi lua-filesystem libobs0 libobs-dev meson build-essential gcc
``` ```
## Installation ## Installation

View File

@@ -289,12 +289,20 @@ return function()
end end
if not attrs.entries and not attrs._ignore_restrict then if not attrs.entries and not attrs._ignore_restrict then
-- Handle idenifier formatting for entries without a preset list -- Handle idenifier formatting for entries without a preset list
local handlers = {}
local function run_handlers()
for _, f in ipairs(handlers) do f() end
end
function s.internal:on_changed() function s.internal:on_changed()
local i = s.internal.text local i = s.internal.text
if i:match("[^%w]") ~= nil or i:sub(1, 1):match("[^%a]") ~= nil then if i:match("[^%w]") ~= nil or i:sub(1, 1):match("[^%a]") ~= nil then
s.internal.text = i:gsub("[^%w]", ""):gsub("^[^%a]+", "") s.internal.text = i:gsub("[^%w]", ""):gsub("^[^%a]+", "")
else
run_handlers()
end end
-- todo: handle changed (signal override?) end
s.connect = function(f)
handlers[#handlers + 1] = f
end end
end end
return s return s
@@ -328,7 +336,7 @@ return function()
widget:set_value(x) widget:set_value(x)
return true return true
end, end,
get_data = function() widget:get_text() end, get_data = function() return widget:get_text() end,
connect = function(f) widget.on_value_changed = f end connect = function(f) widget.on_value_changed = f end
} }
end, end,
@@ -354,7 +362,7 @@ return function()
widget:set_value(x) widget:set_value(x)
return true return true
end, end,
get_data = function() widget:get_text() end, get_data = function() return widget:get_text() end,
connect = function(f) widget.on_value_changed = f end connect = function(f) widget.on_value_changed = f end
} }
end, end,
@@ -363,6 +371,11 @@ return function()
-- The benefits of doing this mean we get to use the "nice" Gtk3 -- The benefits of doing this mean we get to use the "nice" Gtk3
-- chooser, and the button rendering itself is much better. -- chooser, and the button rendering itself is much better.
["color"] = function(attrs) ["color"] = function(attrs)
local dialog_open = false
local handlers = {}
local function run_handlers()
for _, f in ipairs(handlers) do f() end
end
local c = Gdk.RGBA { local c = Gdk.RGBA {
red = 1.0, green = 1.0, blue = 1.0, alpha = 1.0 red = 1.0, green = 1.0, blue = 1.0, alpha = 1.0
} }
@@ -408,6 +421,7 @@ return function()
widget:get_style_context():add_class("linked") widget:get_style_context():add_class("linked")
widget = wrap_label(widget, attrs.label) widget = wrap_label(widget, attrs.label)
function btn:on_clicked() function btn:on_clicked()
local c_change_staged = false
local dialog = (use_old_chooser and Gtk.ColorSelectionDialog or Gtk.ColorChooserDialog) local dialog = (use_old_chooser and Gtk.ColorSelectionDialog or Gtk.ColorChooserDialog)
{ title = "Select Color", { title = "Select Color",
transient_for = window, transient_for = window,
@@ -422,6 +436,7 @@ return function()
dialog.color_selection.has_opacity_control = true dialog.color_selection.has_opacity_control = true
end end
function dialog.color_selection:on_color_changed() function dialog.color_selection:on_color_changed()
c_change_staged = true
c = dialog.color_selection.current_rgba c = dialog.color_selection.current_rgba
entry:set_text(attrs.alpha and utils.format_color_rgba(c) or utils.format_color_rgb(c)) entry:set_text(attrs.alpha and utils.format_color_rgba(c) or utils.format_color_rgb(c))
area:queue_draw() area:queue_draw()
@@ -432,20 +447,26 @@ return function()
dialog.use_alpha = true dialog.use_alpha = true
end end
end end
dialog_open = true
local ret = dialog:run() local ret = dialog:run()
dialog_open = false
dialog:set_visible(false) dialog:set_visible(false)
if not use_old_chooser and ret == Gtk.ResponseType.OK then if not use_old_chooser and ret == Gtk.ResponseType.OK then
c = dialog.rgba c = dialog.rgba
entry:set_text(attrs.alpha and utils.format_color_rgba(c) or utils.format_color_rgb(c)) entry:set_text(attrs.alpha and utils.format_color_rgba(c) or utils.format_color_rgb(c))
area:queue_draw() area:queue_draw()
run_handlers()
elseif use_old_chooser and c_change_staged then
run_handlers()
end end
end end
function entry:on_changed() function entry:on_changed()
local s = utils.sanitize_color(entry.text) local s = utils.sanitize_color(entry.text)
c = utils.parse_color_rgba(s) c = utils.parse_color_rgba(s)
area:queue_draw() area:queue_draw()
if not dialog_open then run_handlers() end
end end
return { return {
widget = widget, widget = widget,
@@ -460,7 +481,7 @@ return function()
return attrs.alpha and utils.format_color_rgba(c) or utils.format_color_rgb(c) return attrs.alpha and utils.format_color_rgba(c) or utils.format_color_rgb(c)
end, end,
connect = function(f) connect = function(f)
-- todo signal magic stuff handlers[#handlers + 1] = f
end end
} }
end, end,
@@ -511,14 +532,6 @@ return function()
default = true default = true
} } } }
local function collect_field_data(self)
local fields = {}
for i = 1, #self.fields do
fields[i] = self.gen[i]:get_data()
end
return fields
end
local stack = Gtk.Stack { vhomogeneous = false } local stack = Gtk.Stack { vhomogeneous = false }
local hstack = Gtk.Stack { vhomogeneous = false } local hstack = Gtk.Stack { vhomogeneous = false }
@@ -575,7 +588,16 @@ return function()
end end
end end
v.get_data = function() v.get_data = function()
return string.format(v.output, unpack(collect_field_data())) local fields = {}
for i = 1, #v.fields do
fields[i] = gen[i]:get_data()
end
return string.format(v.output, unpack(fields))
end
v.connect = function(f)
for _, g in ipairs(gen) do
g.connect(f)
end
end end
end end
local cbox = apply { local cbox = apply {
@@ -610,6 +632,11 @@ return function()
end, end,
get_data = function() get_data = function()
return cetypes[cbox:get_active_text()].get_data() return cetypes[cbox:get_active_text()].get_data()
end,
connect = function(f)
for i, v in ipairs(cetypes) do
v.connect(f)
end
end end
} }
end end
@@ -677,6 +704,10 @@ return function()
header = entry.header_widget header = entry.header_widget
end end
fields[#fields + 1] = entry.widget fields[#fields + 1] = entry.widget
-- todo: finish linking config
entry.connect(function()
print(string.format("assign %s->%s->%s[%d] = %s", k, e[1], f, i, tostring(entry.get_data())))
end)
end end
-- disable header display widget if there are multiple fields -- disable header display widget if there are multiple fields
if #fields > 1 then header = nil end if #fields > 1 then header = nil end

View File

@@ -186,6 +186,7 @@ static Atom ATOM__MOTIF_WM_HINTS, ATOM_WM_DELETE_WINDOW, ATOM_WM_PROTOCOLS, ATOM
static GLXContext sharelist_ctx; static GLXContext sharelist_ctx;
static bool sharelist_assigned = false; static bool sharelist_assigned = false;
/* XQuartz */
#ifdef __APPLE__ #ifdef __APPLE__
static const char *dl_names[] = { static const char *dl_names[] = {
"../Frameworks/OpenGL.framework/OpenGL", "../Frameworks/OpenGL.framework/OpenGL",

View File

@@ -1042,7 +1042,7 @@ struct glava_renderer* rd_new(const char** paths, const char* entry,
if (module != NULL) free((char*) module); if (module != NULL) free((char*) module);
size_t len = strlen((char*) args[0]); size_t len = strlen((char*) args[0]);
char* str = malloc(sizeof(char) * (len + 1)); char* str = malloc(sizeof(char) * (len + 1));
strncpy(str, (char*) args[0], len + 1); strcpy(str, (char*) args[0]);
module = str; module = str;
} }
}) })

View File

@@ -5,7 +5,6 @@ project(
default_options:['buildtype=release', 'strip=true', 'optimization=2']) default_options:['buildtype=release', 'strip=true', 'optimization=2'])
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
add_project_arguments('-Wstringop-overflow=0', language: 'c')
if get_option('glad') if get_option('glad')
if get_option('buildtype').startswith('debug') if get_option('buildtype').startswith('debug')