WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
100942
[EFL][WK2] Add --window-size command line option to EFL MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=100942
Summary
[EFL][WK2] Add --window-size command line option to EFL MiniBrowser
Mikhail Pozdnyakov
Reported
2012-11-01 04:12:03 PDT
Would be nice to add --window-size command line option to EFL MiniBrowser (same Qt MiniBrowser has).
Attachments
patch
(4.32 KB, patch)
2012-11-02 09:06 PDT
,
Mikhail Pozdnyakov
no flags
Details
Formatted Diff
Diff
patch v2
(3.88 KB, patch)
2012-11-05 01:28 PST
,
Mikhail Pozdnyakov
no flags
Details
Formatted Diff
Diff
patch v3
(3.88 KB, patch)
2012-11-05 01:45 PST
,
Mikhail Pozdnyakov
no flags
Details
Formatted Diff
Diff
patch v3
(3.88 KB, patch)
2012-11-05 01:49 PST
,
Mikhail Pozdnyakov
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Mikhail Pozdnyakov
Comment 1
2012-11-02 09:06:40 PDT
Created
attachment 172075
[details]
patch
Chris Dumez
Comment 2
2012-11-02 09:17:34 PDT
Comment on
attachment 172075
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=172075&action=review
> Tools/MiniBrowser/efl/main.c:42 > +static char *window_size_string = NULL;
Does this one really need to be global? Can it be defined in elm_main() instead?
> Tools/MiniBrowser/efl/main.c:44 > +static int window_width = 800;
If you do it this way, then the command line argument affects the size of ALL future windows, not just the main one. I don't think we want this behavior, do we?
> Tools/MiniBrowser/efl/main.c:964 > +#define MAX_LENGTH 3
Why #define instead of a simple const int?
> Tools/MiniBrowser/efl/main.c:966 > + Eina_Strbuf *buf;
Those variables can be defined as they are needed, right? We don't really need to define all of them at the beginning of the function (unless in pedantic mode).
> Tools/MiniBrowser/efl/main.c:979 > + for (c = input_string; c!= delimeter; ++c)
eina_strbuf_append_n() ?
> Tools/MiniBrowser/efl/main.c:993 > + for (c = delimeter + 1; c!= input_string + string_length; ++c)
eina_strbuf_append_n() ?
Kenneth Rohde Christiansen
Comment 3
2012-11-02 09:18:08 PDT
Comment on
attachment 172075
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=172075&action=review
Nice
> Tools/MiniBrowser/efl/main.c:964 > +#define MAX_LENGTH 3
why not just static unsigned ?
Kenneth Rohde Christiansen
Comment 4
2012-11-02 09:19:38 PDT
> If you do it this way, then the command line argument affects the size of ALL future windows, not just the main one. I don't think we want this behavior, do we?
Isn't that OK? Think if I want to emulate the size of the iPhone, then I would like all new windows to start out using the same size
Chris Dumez
Comment 5
2012-11-02 09:24:46 PDT
(In reply to
comment #4
)
> > If you do it this way, then the command line argument affects the size of ALL future windows, not just the main one. I don't think we want this behavior, do we? > > Isn't that OK? Think if I want to emulate the size of the iPhone, then I would like all new windows to start out using the same size
If that's the use case, then ok. I just wanted to highlight this and make sure it is the expected behavior.
Chris Dumez
Comment 6
2012-11-02 10:58:28 PDT
Comment on
attachment 172075
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=172075&action=review
> Tools/MiniBrowser/efl/main.c:962 > +parse_window_size(const char *input_string, int *width, int *height)
Actually, using eina_str_split_full() may help simplify this function:
http://docs.enlightenment.org/auto/eina/group__Eina__String__Group.html#gac408efa406ea8e03d0f6b989ef579a29
Mikhail Pozdnyakov
Comment 7
2012-11-05 01:27:47 PST
(In reply to
comment #6
)
> (From update of
attachment 172075
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=172075&action=review
> > > Tools/MiniBrowser/efl/main.c:962 > > +parse_window_size(const char *input_string, int *width, int *height) > > Actually, using eina_str_split_full() may help simplify this function: >
http://docs.enlightenment.org/auto/eina/group__Eina__String__Group.html#gac408efa406ea8e03d0f6b989ef579a29
thanks for the hint
Mikhail Pozdnyakov
Comment 8
2012-11-05 01:28:19 PST
Created
attachment 172291
[details]
patch v2 using eina_str_split_full
Kenneth Rohde Christiansen
Comment 9
2012-11-05 01:33:13 PST
Comment on
attachment 172291
[details]
patch v2 View in context:
https://bugs.webkit.org/attachment.cgi?id=172291&action=review
> Tools/MiniBrowser/efl/main.c:966 > + char **arr;
Pirate day? :) arrrrr
> Tools/MiniBrowser/efl/main.c:973 > + if (elements == 2 && (strlen(arr[0]) <= max_length) && (strlen(arr[1]) <= max_length)) { > + > + parsed_width = atoi(arr[0]);
why this newline?
> Tools/MiniBrowser/efl/main.c:983 > + free(arr[0]); > + free(arr);
What about arr[1]?
Chris Dumez
Comment 10
2012-11-05 01:33:29 PST
Comment on
attachment 172291
[details]
patch v2 View in context:
https://bugs.webkit.org/attachment.cgi?id=172291&action=review
> Tools/MiniBrowser/efl/main.c:963 > + static const unsigned max_length = 3;
Maximum resolution of 999x999?
Mikhail Pozdnyakov
Comment 11
2012-11-05 01:40:32 PST
Comment on
attachment 172291
[details]
patch v2 View in context:
https://bugs.webkit.org/attachment.cgi?id=172291&action=review
>> Tools/MiniBrowser/efl/main.c:963 >> + static const unsigned max_length = 3; > > Maximum resolution of 999x999?
Well yes, what's your suggestion? ;)
>> Tools/MiniBrowser/efl/main.c:966 >> + char **arr; > > Pirate day? :) arrrrr
took naming from
http://docs.enlightenment.org/auto/eina/eina_str_01_8c-example.html#a1
>> Tools/MiniBrowser/efl/main.c:973 >> + parsed_width = atoi(arr[0]); > > why this newline?
it's more readable imho, but I can remove it if you want
>> Tools/MiniBrowser/efl/main.c:983 >> + free(arr); > > What about arr[1]?
http://docs.enlightenment.org/auto/eina/group__Eina__String__Group.html#ga601dd2f2032b2a09184164db6f36cc87
To free it, free the first element of the array and the array itself
Chris Dumez
Comment 12
2012-11-05 01:41:20 PST
Comment on
attachment 172291
[details]
patch v2 View in context:
https://bugs.webkit.org/attachment.cgi?id=172291&action=review
> Tools/MiniBrowser/efl/main.c:969 > + arr = eina_str_split_full(input_string, "x", 0, &elements);
eina_str_split_full(input_string, "x", 2, &elements); ? since we know we want 2 strings max.
>> Tools/MiniBrowser/efl/main.c:983 >> + free(arr); > > What about arr[1]?
It is probably safer to iterate over the array and free the elements until you find a NULL element.
Kenneth Rohde Christiansen
Comment 13
2012-11-05 01:41:56 PST
Sizes bigger than 1024 are pretty common today :)
Mikhail Pozdnyakov
Comment 14
2012-11-05 01:45:46 PST
Created
attachment 172293
[details]
patch v3 max length=4.
Mikhail Pozdnyakov
Comment 15
2012-11-05 01:49:18 PST
Created
attachment 172294
[details]
patch v3 max length=4.
Mikhail Pozdnyakov
Comment 16
2012-11-05 01:51:30 PST
(In reply to
comment #12
)
> (From update of
attachment 172291
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=172291&action=review
> > > Tools/MiniBrowser/efl/main.c:969 > > + arr = eina_str_split_full(input_string, "x", 0, &elements); > > eina_str_split_full(input_string, "x", 2, &elements); ? > > since we know we want 2 strings max.
elements==2 is validation, so would keep '0'
> > >> Tools/MiniBrowser/efl/main.c:983 > >> + free(arr); > > > > What about arr[1]? > > It is probably safer to iterate over the array and free the elements until you find a NULL element.
As already replied in
comment #11
To free it, free the first element of the array and the array itself. This is EFL.
WebKit Review Bot
Comment 17
2012-11-05 02:34:27 PST
Comment on
attachment 172294
[details]
patch v3 Clearing flags on attachment: 172294 Committed
r133450
: <
http://trac.webkit.org/changeset/133450
>
WebKit Review Bot
Comment 18
2012-11-05 02:34:31 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug